19 changed files with 934 additions and 1 deletions
@ -0,0 +1,106 @@ |
|||||
|
package org.dromara.system.controller.system; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||
|
import jakarta.validation.constraints.*; |
||||
|
import cn.dev33.satoken.annotation.SaCheckPermission; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
||||
|
import org.dromara.common.log.annotation.Log; |
||||
|
import org.dromara.common.web.core.BaseController; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
import org.dromara.common.core.domain.R; |
||||
|
import org.dromara.common.core.validate.AddGroup; |
||||
|
import org.dromara.common.core.validate.EditGroup; |
||||
|
import org.dromara.common.log.enums.BusinessType; |
||||
|
import org.dromara.common.excel.utils.ExcelUtil; |
||||
|
import org.dromara.system.domain.vo.AiLabelVo; |
||||
|
import org.dromara.system.domain.bo.AiLabelBo; |
||||
|
import org.dromara.system.service.IAiLabelService; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
|
||||
|
/** |
||||
|
* ai 识别类型 |
||||
|
* 前端访问路由地址为:/system/label |
||||
|
* |
||||
|
* @author LionLi |
||||
|
* @date 2025-03-11 |
||||
|
*/ |
||||
|
@Validated |
||||
|
@RequiredArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/label") |
||||
|
public class AiLabelController extends BaseController { |
||||
|
|
||||
|
private final IAiLabelService aiLabelService; |
||||
|
|
||||
|
/** |
||||
|
* 查询ai 识别类型列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:label:list") |
||||
|
@GetMapping("/list") |
||||
|
public TableDataInfo<AiLabelVo> list(AiLabelBo bo, PageQuery pageQuery) { |
||||
|
return aiLabelService.queryPageList(bo, pageQuery); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导出ai 识别类型列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:label:export") |
||||
|
@Log(title = "ai 识别类型", businessType = BusinessType.EXPORT) |
||||
|
@PostMapping("/export") |
||||
|
public void export(AiLabelBo bo, HttpServletResponse response) { |
||||
|
List<AiLabelVo> list = aiLabelService.queryList(bo); |
||||
|
ExcelUtil.exportExcel(list, "ai 识别类型", AiLabelVo.class, response); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取ai 识别类型详细信息 |
||||
|
* |
||||
|
* @param lableId 主键 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:label:query") |
||||
|
@GetMapping("/{lableId}") |
||||
|
public R<AiLabelVo> getInfo(@NotNull(message = "主键不能为空") |
||||
|
@PathVariable Long lableId) { |
||||
|
return R.ok(aiLabelService.queryById(lableId)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增ai 识别类型 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:label:add") |
||||
|
@Log(title = "ai 识别类型", businessType = BusinessType.INSERT) |
||||
|
@RepeatSubmit() |
||||
|
@PostMapping() |
||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody AiLabelBo bo) { |
||||
|
return toAjax(aiLabelService.insertByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改ai 识别类型 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:label:edit") |
||||
|
@Log(title = "ai 识别类型", businessType = BusinessType.UPDATE) |
||||
|
@RepeatSubmit() |
||||
|
@PutMapping() |
||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody AiLabelBo bo) { |
||||
|
return toAjax(aiLabelService.updateByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除ai 识别类型 |
||||
|
* |
||||
|
* @param lableIds 主键串 |
||||
|
*/ |
||||
|
@SaCheckPermission("system:label:remove") |
||||
|
@Log(title = "ai 识别类型", businessType = BusinessType.DELETE) |
||||
|
@DeleteMapping("/{lableIds}") |
||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
||||
|
@PathVariable Long[] lableIds) { |
||||
|
return toAjax(aiLabelService.deleteWithValidByIds(List.of(lableIds), true)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,51 @@ |
|||||
|
package org.dromara.system.domain; |
||||
|
|
||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity; |
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
|
||||
|
/** |
||||
|
* ai 识别类型对象 ai_label |
||||
|
* |
||||
|
* @author LionLi |
||||
|
* @date 2025-03-11 |
||||
|
*/ |
||||
|
@Data |
||||
|
|
||||
|
@TableName("ai_label") |
||||
|
public class AiLabel { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* id |
||||
|
*/ |
||||
|
@TableId(value = "lable_id") |
||||
|
private Long lableId; |
||||
|
|
||||
|
/** |
||||
|
* 标签名-英 |
||||
|
*/ |
||||
|
private String labelEn; |
||||
|
|
||||
|
/** |
||||
|
* 标签名-中 |
||||
|
*/ |
||||
|
private String labelCn; |
||||
|
|
||||
|
/** |
||||
|
* 算法类型 |
||||
|
*/ |
||||
|
private String aiType; |
||||
|
|
||||
|
/** |
||||
|
* 算法名称 |
||||
|
*/ |
||||
|
private String aiName; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
package org.dromara.system.domain; |
||||
|
|
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
import java.io.Serial; |
||||
|
|
||||
|
/** |
||||
|
* 职能-标签关系对象 ai_lable_post |
||||
|
* |
||||
|
* @author LionLi |
||||
|
* @date 2025-03-11 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName("ai_lable_post") |
||||
|
public class AiLablePost { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@TableId(value = "id") |
||||
|
private Long id; |
||||
|
/** |
||||
|
* 标签id |
||||
|
*/ |
||||
|
private Long lableId; |
||||
|
|
||||
|
/** |
||||
|
* 岗位id |
||||
|
*/ |
||||
|
|
||||
|
private Long postId; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,71 @@ |
|||||
|
package org.dromara.system.domain.bo; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||
|
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||
|
import com.fasterxml.jackson.annotation.JsonInclude; |
||||
|
import org.dromara.system.domain.AiLabel; |
||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity; |
||||
|
import org.dromara.common.core.validate.AddGroup; |
||||
|
import org.dromara.common.core.validate.EditGroup; |
||||
|
import io.github.linpeilie.annotations.AutoMapper; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import jakarta.validation.constraints.*; |
||||
|
|
||||
|
import java.util.HashMap; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* ai 识别类型业务对象 ai_label |
||||
|
* |
||||
|
* @author LionLi |
||||
|
* @date 2025-03-11 |
||||
|
*/ |
||||
|
@Data |
||||
|
@AutoMapper(target = AiLabel.class, reverseConvertGenerate = false) |
||||
|
public class AiLabelBo { |
||||
|
|
||||
|
/** |
||||
|
* 搜索值 |
||||
|
*/ |
||||
|
@JsonIgnore |
||||
|
@TableField(exist = false) |
||||
|
private String searchValue; |
||||
|
/** |
||||
|
* id |
||||
|
*/ |
||||
|
@NotNull(message = "id不能为空", groups = { EditGroup.class }) |
||||
|
private Long lableId; |
||||
|
|
||||
|
/** |
||||
|
* 标签名-英 |
||||
|
*/ |
||||
|
@NotBlank(message = "标签名-英不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String labelEn; |
||||
|
|
||||
|
/** |
||||
|
* 标签名-中 |
||||
|
*/ |
||||
|
@NotBlank(message = "标签名-中不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String labelCn; |
||||
|
|
||||
|
/** |
||||
|
* 算法类型 |
||||
|
*/ |
||||
|
|
||||
|
private String aiType; |
||||
|
|
||||
|
/** |
||||
|
* 算法名称 |
||||
|
*/ |
||||
|
|
||||
|
private String aiName; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 请求参数 |
||||
|
*/ |
||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY) |
||||
|
@TableField(exist = false) |
||||
|
private Map<String, Object> params = new HashMap<>(); |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package org.dromara.system.domain.bo; |
||||
|
|
||||
|
import jakarta.validation.constraints.NotNull; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @auther yq |
||||
|
* @data 2025/3/11 |
||||
|
*/ |
||||
|
|
||||
|
@Data |
||||
|
public class AiLablePostBindBo { |
||||
|
|
||||
|
@NotNull(message = "postId不能为空") |
||||
|
private Long postId; |
||||
|
|
||||
|
|
||||
|
@NotNull(message = "标签不能为空") |
||||
|
private List<Long> lableIdList; |
||||
|
|
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
package org.dromara.system.domain.bo; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||
|
import com.fasterxml.jackson.annotation.JsonInclude; |
||||
|
import org.dromara.common.core.validate.EditGroup; |
||||
|
import org.dromara.system.domain.AiLablePost; |
||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity; |
||||
|
import org.dromara.common.core.validate.AddGroup; |
||||
|
import io.github.linpeilie.annotations.AutoMapper; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import jakarta.validation.constraints.*; |
||||
|
|
||||
|
import java.util.HashMap; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 职能-标签关系业务对象 ai_lable_post |
||||
|
* |
||||
|
* @author LionLi |
||||
|
* @date 2025-03-11 |
||||
|
*/ |
||||
|
@Data |
||||
|
@AutoMapper(target = AiLablePost.class, reverseConvertGenerate = false) |
||||
|
public class AiLablePostBo { |
||||
|
|
||||
|
/** |
||||
|
* 标签id |
||||
|
*/ |
||||
|
@NotNull(message = "标签id不能为空", groups = { AddGroup.class , EditGroup.class }) |
||||
|
private Long lableId; |
||||
|
|
||||
|
/** |
||||
|
* 岗位id |
||||
|
*/ |
||||
|
@NotNull(message = "岗位id不能为空" ) |
||||
|
private Long postId; |
||||
|
|
||||
|
/** |
||||
|
* 请求参数 |
||||
|
*/ |
||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY) |
||||
|
@TableField(exist = false) |
||||
|
private Map<String, Object> params = new HashMap<>(); |
||||
|
|
||||
|
} |
@ -0,0 +1,58 @@ |
|||||
|
package org.dromara.system.domain.vo; |
||||
|
|
||||
|
import org.dromara.system.domain.AiLabel; |
||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||
|
import io.github.linpeilie.annotations.AutoMapper; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* ai 识别类型视图对象 ai_label |
||||
|
* |
||||
|
* @author LionLi |
||||
|
* @date 2025-03-11 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ExcelIgnoreUnannotated |
||||
|
@AutoMapper(target = AiLabel.class) |
||||
|
public class AiLabelVo implements Serializable { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* id |
||||
|
*/ |
||||
|
// @ExcelProperty(value = "id")
|
||||
|
private Long lableId; |
||||
|
|
||||
|
/** |
||||
|
* 标签名-英 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "标签名-英") |
||||
|
private String labelEn; |
||||
|
|
||||
|
/** |
||||
|
* 标签名-中 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "标签名-中") |
||||
|
private String labelCn; |
||||
|
|
||||
|
/** |
||||
|
* 算法类型 |
||||
|
*/ |
||||
|
// @ExcelProperty(value = "算法类型")
|
||||
|
private String aiType; |
||||
|
|
||||
|
/** |
||||
|
* 算法名称 |
||||
|
*/ |
||||
|
// @ExcelProperty(value = "算法名称")
|
||||
|
private String aiName; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
package org.dromara.system.domain.vo; |
||||
|
|
||||
|
import org.dromara.system.domain.AiLablePost; |
||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
||||
|
import io.github.linpeilie.annotations.AutoMapper; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 职能-标签关系视图对象 ai_lable_post |
||||
|
* |
||||
|
* @author LionLi |
||||
|
* @date 2025-03-11 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ExcelIgnoreUnannotated |
||||
|
@AutoMapper(target = AiLablePost.class) |
||||
|
public class AiLablePostVo implements Serializable { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 标签id |
||||
|
*/ |
||||
|
private Long lableId; |
||||
|
|
||||
|
private String labelCn; |
||||
|
|
||||
|
/** |
||||
|
* 岗位id |
||||
|
*/ |
||||
|
|
||||
|
private Long postId; |
||||
|
|
||||
|
private String postName; |
||||
|
|
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
package org.dromara.system.mapper; |
||||
|
|
||||
|
import org.dromara.system.domain.AiLabel; |
||||
|
import org.dromara.system.domain.vo.AiLabelVo; |
||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
||||
|
|
||||
|
/** |
||||
|
* ai 识别类型Mapper接口 |
||||
|
* |
||||
|
* @author LionLi |
||||
|
* @date 2025-03-11 |
||||
|
*/ |
||||
|
public interface AiLabelMapper extends BaseMapperPlus<AiLabel, AiLabelVo> { |
||||
|
|
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
package org.dromara.system.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.dromara.system.domain.AiLablePost; |
||||
|
import org.dromara.system.domain.bo.AiLablePostBo; |
||||
|
import org.dromara.system.domain.vo.AiLablePostVo; |
||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
||||
|
|
||||
|
/** |
||||
|
* 职能-标签关系Mapper接口 |
||||
|
* |
||||
|
* @author LionLi |
||||
|
* @date 2025-03-11 |
||||
|
*/ |
||||
|
public interface AiLablePostMapper extends BaseMapperPlus<AiLablePost, AiLablePostVo> { |
||||
|
Page<AiLablePostVo> selectAiLablePostPage(@Param("page") Page<?> page, @Param("ew") QueryWrapper<AiLablePost> wrapper); |
||||
|
} |
@ -0,0 +1,69 @@ |
|||||
|
package org.dromara.system.service; |
||||
|
|
||||
|
import org.dromara.system.domain.AiLabel; |
||||
|
import org.dromara.system.domain.vo.AiLabelVo; |
||||
|
import org.dromara.system.domain.bo.AiLabelBo; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
|
||||
|
import java.util.Collection; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* ai 识别类型Service接口 |
||||
|
* |
||||
|
* @author LionLi |
||||
|
* @date 2025-03-11 |
||||
|
*/ |
||||
|
public interface IAiLabelService { |
||||
|
|
||||
|
/** |
||||
|
* 查询ai 识别类型 |
||||
|
* |
||||
|
* @param lableId 主键 |
||||
|
* @return ai 识别类型 |
||||
|
*/ |
||||
|
AiLabelVo queryById(Long lableId); |
||||
|
|
||||
|
/** |
||||
|
* 分页查询ai 识别类型列表 |
||||
|
* |
||||
|
* @param bo 查询条件 |
||||
|
* @param pageQuery 分页参数 |
||||
|
* @return ai 识别类型分页列表 |
||||
|
*/ |
||||
|
TableDataInfo<AiLabelVo> queryPageList(AiLabelBo bo, PageQuery pageQuery); |
||||
|
|
||||
|
/** |
||||
|
* 查询符合条件的ai 识别类型列表 |
||||
|
* |
||||
|
* @param bo 查询条件 |
||||
|
* @return ai 识别类型列表 |
||||
|
*/ |
||||
|
List<AiLabelVo> queryList(AiLabelBo bo); |
||||
|
|
||||
|
/** |
||||
|
* 新增ai 识别类型 |
||||
|
* |
||||
|
* @param bo ai 识别类型 |
||||
|
* @return 是否新增成功 |
||||
|
*/ |
||||
|
Boolean insertByBo(AiLabelBo bo); |
||||
|
|
||||
|
/** |
||||
|
* 修改ai 识别类型 |
||||
|
* |
||||
|
* @param bo ai 识别类型 |
||||
|
* @return 是否修改成功 |
||||
|
*/ |
||||
|
Boolean updateByBo(AiLabelBo bo); |
||||
|
|
||||
|
/** |
||||
|
* 校验并批量删除ai 识别类型信息 |
||||
|
* |
||||
|
* @param ids 待删除的主键集合 |
||||
|
* @param isValid 是否进行有效性校验 |
||||
|
* @return 是否删除成功 |
||||
|
*/ |
||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
||||
|
} |
@ -0,0 +1,69 @@ |
|||||
|
package org.dromara.system.service; |
||||
|
|
||||
|
import org.dromara.system.domain.AiLablePost; |
||||
|
import org.dromara.system.domain.vo.AiLablePostVo; |
||||
|
import org.dromara.system.domain.bo.AiLablePostBo; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
|
||||
|
import java.util.Collection; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 职能-标签关系Service接口 |
||||
|
* |
||||
|
* @author LionLi |
||||
|
* @date 2025-03-11 |
||||
|
*/ |
||||
|
public interface IAiLablePostService { |
||||
|
|
||||
|
/** |
||||
|
* 查询职能-标签关系 |
||||
|
* |
||||
|
* @param lableId 主键 |
||||
|
* @return 职能-标签关系 |
||||
|
*/ |
||||
|
AiLablePostVo queryById(Long lableId); |
||||
|
|
||||
|
/** |
||||
|
* 分页查询职能-标签关系列表 |
||||
|
* |
||||
|
* @param bo 查询条件 |
||||
|
* @param pageQuery 分页参数 |
||||
|
* @return 职能-标签关系分页列表 |
||||
|
*/ |
||||
|
TableDataInfo<AiLablePostVo> queryPageList(AiLablePostBo bo, PageQuery pageQuery); |
||||
|
|
||||
|
/** |
||||
|
* 查询符合条件的职能-标签关系列表 |
||||
|
* |
||||
|
* @param bo 查询条件 |
||||
|
* @return 职能-标签关系列表 |
||||
|
*/ |
||||
|
List<AiLablePostVo> queryList(AiLablePostBo bo); |
||||
|
|
||||
|
/** |
||||
|
* 新增职能-标签关系 |
||||
|
* |
||||
|
* @param bo 职能-标签关系 |
||||
|
* @return 是否新增成功 |
||||
|
*/ |
||||
|
Boolean insertByBo(AiLablePostBo bo); |
||||
|
|
||||
|
/** |
||||
|
* 修改职能-标签关系 |
||||
|
* |
||||
|
* @param bo 职能-标签关系 |
||||
|
* @return 是否修改成功 |
||||
|
*/ |
||||
|
Boolean updateByBo(AiLablePostBo bo); |
||||
|
|
||||
|
/** |
||||
|
* 校验并批量删除职能-标签关系信息 |
||||
|
* |
||||
|
* @param ids 待删除的主键集合 |
||||
|
* @param isValid 是否进行有效性校验 |
||||
|
* @return 是否删除成功 |
||||
|
*/ |
||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
||||
|
} |
@ -0,0 +1,132 @@ |
|||||
|
package org.dromara.system.service.impl; |
||||
|
|
||||
|
import org.dromara.common.core.utils.MapstructUtils; |
||||
|
import org.dromara.common.core.utils.StringUtils; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.dromara.system.domain.bo.AiLabelBo; |
||||
|
import org.dromara.system.domain.vo.AiLabelVo; |
||||
|
import org.dromara.system.domain.AiLabel; |
||||
|
import org.dromara.system.mapper.AiLabelMapper; |
||||
|
import org.dromara.system.service.IAiLabelService; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Collection; |
||||
|
|
||||
|
/** |
||||
|
* ai 识别类型Service业务层处理 |
||||
|
* |
||||
|
* @author LionLi |
||||
|
* @date 2025-03-11 |
||||
|
*/ |
||||
|
@RequiredArgsConstructor |
||||
|
@Service |
||||
|
public class AiLabelServiceImpl implements IAiLabelService { |
||||
|
|
||||
|
private final AiLabelMapper baseMapper; |
||||
|
|
||||
|
/** |
||||
|
* 查询ai 识别类型 |
||||
|
* |
||||
|
* @param lableId 主键 |
||||
|
* @return ai 识别类型 |
||||
|
*/ |
||||
|
@Override |
||||
|
public AiLabelVo queryById(Long lableId){ |
||||
|
return baseMapper.selectVoById(lableId); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 分页查询ai 识别类型列表 |
||||
|
* |
||||
|
* @param bo 查询条件 |
||||
|
* @param pageQuery 分页参数 |
||||
|
* @return ai 识别类型分页列表 |
||||
|
*/ |
||||
|
@Override |
||||
|
public TableDataInfo<AiLabelVo> queryPageList(AiLabelBo bo, PageQuery pageQuery) { |
||||
|
LambdaQueryWrapper<AiLabel> lqw = buildQueryWrapper(bo); |
||||
|
Page<AiLabelVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
||||
|
return TableDataInfo.build(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询符合条件的ai 识别类型列表 |
||||
|
* |
||||
|
* @param bo 查询条件 |
||||
|
* @return ai 识别类型列表 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<AiLabelVo> queryList(AiLabelBo bo) { |
||||
|
LambdaQueryWrapper<AiLabel> lqw = buildQueryWrapper(bo); |
||||
|
return baseMapper.selectVoList(lqw); |
||||
|
} |
||||
|
|
||||
|
private LambdaQueryWrapper<AiLabel> buildQueryWrapper(AiLabelBo bo) { |
||||
|
Map<String, Object> params = bo.getParams(); |
||||
|
LambdaQueryWrapper<AiLabel> lqw = Wrappers.lambdaQuery(); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getLabelEn()), AiLabel::getLabelEn, bo.getLabelEn()); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getLabelCn()), AiLabel::getLabelCn, bo.getLabelCn()); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getAiType()), AiLabel::getAiType, bo.getAiType()); |
||||
|
lqw.like(StringUtils.isNotBlank(bo.getAiName()), AiLabel::getAiName, bo.getAiName()); |
||||
|
return lqw; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增ai 识别类型 |
||||
|
* |
||||
|
* @param bo ai 识别类型 |
||||
|
* @return 是否新增成功 |
||||
|
*/ |
||||
|
@Override |
||||
|
public Boolean insertByBo(AiLabelBo bo) { |
||||
|
AiLabel add = MapstructUtils.convert(bo, AiLabel.class); |
||||
|
validEntityBeforeSave(add); |
||||
|
boolean flag = baseMapper.insert(add) > 0; |
||||
|
if (flag) { |
||||
|
bo.setLableId(add.getLableId()); |
||||
|
} |
||||
|
return flag; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改ai 识别类型 |
||||
|
* |
||||
|
* @param bo ai 识别类型 |
||||
|
* @return 是否修改成功 |
||||
|
*/ |
||||
|
@Override |
||||
|
public Boolean updateByBo(AiLabelBo bo) { |
||||
|
AiLabel update = MapstructUtils.convert(bo, AiLabel.class); |
||||
|
validEntityBeforeSave(update); |
||||
|
return baseMapper.updateById(update) > 0; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 保存前的数据校验 |
||||
|
*/ |
||||
|
private void validEntityBeforeSave(AiLabel entity){ |
||||
|
//TODO 做一些数据校验,如唯一约束
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 校验并批量删除ai 识别类型信息 |
||||
|
* |
||||
|
* @param ids 待删除的主键集合 |
||||
|
* @param isValid 是否进行有效性校验 |
||||
|
* @return 是否删除成功 |
||||
|
*/ |
||||
|
@Override |
||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
||||
|
if(isValid){ |
||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
} |
||||
|
return baseMapper.deleteByIds(ids) > 0; |
||||
|
} |
||||
|
} |
@ -0,0 +1,131 @@ |
|||||
|
package org.dromara.system.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import org.dromara.common.core.utils.MapstructUtils; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.dromara.system.mapper.AiLabelMapper; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.dromara.system.domain.bo.AiLablePostBo; |
||||
|
import org.dromara.system.domain.vo.AiLablePostVo; |
||||
|
import org.dromara.system.domain.AiLablePost; |
||||
|
import org.dromara.system.mapper.AiLablePostMapper; |
||||
|
import org.dromara.system.service.IAiLablePostService; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Collection; |
||||
|
|
||||
|
/** |
||||
|
* 职能-标签关系Service业务层处理 |
||||
|
* |
||||
|
* @author LionLi |
||||
|
* @date 2025-03-11 |
||||
|
*/ |
||||
|
@RequiredArgsConstructor |
||||
|
@Service |
||||
|
public class AiLablePostServiceImpl implements IAiLablePostService { |
||||
|
|
||||
|
private final AiLablePostMapper baseMapper; |
||||
|
private final AiLabelMapper aiLabelMapper; |
||||
|
|
||||
|
/** |
||||
|
* 查询职能-标签关系 |
||||
|
* |
||||
|
* @param lableId 主键 |
||||
|
* @return 职能-标签关系 |
||||
|
*/ |
||||
|
@Override |
||||
|
public AiLablePostVo queryById(Long lableId){ |
||||
|
return baseMapper.selectVoById(lableId); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 分页查询职能-标签关系列表 |
||||
|
* |
||||
|
* @param bo 查询条件 |
||||
|
* @param pageQuery 分页参数 |
||||
|
* @return 职能-标签关系分页列表 |
||||
|
*/ |
||||
|
@Override |
||||
|
public TableDataInfo<AiLablePostVo> queryPageList(AiLablePostBo bo, PageQuery pageQuery) { |
||||
|
QueryWrapper queryWrapper = new QueryWrapper(); |
||||
|
queryWrapper.eq("a.post_id", bo.getPostId()); |
||||
|
Page<AiLablePostVo> result = baseMapper.selectAiLablePostPage(pageQuery.build(), queryWrapper); |
||||
|
return TableDataInfo.build(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询符合条件的职能-标签关系列表 |
||||
|
* |
||||
|
* @param bo 查询条件 |
||||
|
* @return 职能-标签关系列表 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<AiLablePostVo> queryList(AiLablePostBo bo) { |
||||
|
LambdaQueryWrapper<AiLablePost> lqw = buildQueryWrapper(bo); |
||||
|
return baseMapper.selectVoList(lqw); |
||||
|
} |
||||
|
|
||||
|
private LambdaQueryWrapper<AiLablePost> buildQueryWrapper(AiLablePostBo bo) { |
||||
|
Map<String, Object> params = bo.getParams(); |
||||
|
LambdaQueryWrapper<AiLablePost> lqw = Wrappers.lambdaQuery(); |
||||
|
return lqw; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增职能-标签关系 |
||||
|
* |
||||
|
* @param bo 职能-标签关系 |
||||
|
* @return 是否新增成功 |
||||
|
*/ |
||||
|
@Override |
||||
|
public Boolean insertByBo(AiLablePostBo bo) { |
||||
|
AiLablePost add = MapstructUtils.convert(bo, AiLablePost.class); |
||||
|
validEntityBeforeSave(add); |
||||
|
boolean flag = baseMapper.insert(add) > 0; |
||||
|
if (flag) { |
||||
|
bo.setLableId(add.getLableId()); |
||||
|
} |
||||
|
return flag; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改职能-标签关系 |
||||
|
* |
||||
|
* @param bo 职能-标签关系 |
||||
|
* @return 是否修改成功 |
||||
|
*/ |
||||
|
@Override |
||||
|
public Boolean updateByBo(AiLablePostBo bo) { |
||||
|
AiLablePost update = MapstructUtils.convert(bo, AiLablePost.class); |
||||
|
validEntityBeforeSave(update); |
||||
|
return baseMapper.updateById(update) > 0; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 保存前的数据校验 |
||||
|
*/ |
||||
|
private void validEntityBeforeSave(AiLablePost entity){ |
||||
|
//TODO 做一些数据校验,如唯一约束
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 校验并批量删除职能-标签关系信息 |
||||
|
* |
||||
|
* @param ids 待删除的主键集合 |
||||
|
* @param isValid 是否进行有效性校验 |
||||
|
* @return 是否删除成功 |
||||
|
*/ |
||||
|
@Override |
||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
||||
|
if(isValid){ |
||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
} |
||||
|
return baseMapper.deleteByIds(ids) > 0; |
||||
|
} |
||||
|
} |
@ -0,0 +1,7 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper |
||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="org.dromara.system.mapper.AiLabelMapper"> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,10 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper |
||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="org.dromara.system.mapper.AiLablePostMapper"> |
||||
|
|
||||
|
<select id="selectAiLablePostPage" resultType="org.dromara.system.domain.vo.AiLablePostVo"> |
||||
|
SELECT *,a.label_cn as ,label_en FROM ai_lable_post p inner JOIN ai_lable a ON p.lable_id = a.lable_id ${ew.customSqlSegment} |
||||
|
</select> |
||||
|
</mapper> |
Loading…
Reference in new issue