From 9fd489d5a579bf042a4a648a0323dd9d69c65c62 Mon Sep 17 00:00:00 2001 From: PQZ Date: Sun, 4 Aug 2024 20:35:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/BusiLabelController.java | 14 +++++ .../yudao/module/label/entity/BusiLabel.java | 53 ++++++++++++++++ .../module/label/mapper/BusiLabelMapper.java | 15 +++++ .../label/service/BusiLabelService.java | 38 +++++++++++ .../service/impl/BusiLabelServiceImpl.java | 63 +++++++++++++++++++ .../module/label/vo/BusiLabelPageReqVO.java | 18 ++++++ .../module/label/vo/BusiLabelRespVO.java | 16 +++++ .../module/label/vo/BusiLabelSaveReqVO.java | 14 +++++ .../mapper/label/BusiLabelMapper.xml | 5 ++ 9 files changed, 236 insertions(+) create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/label/controller/admin/BusiLabelController.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/label/entity/BusiLabel.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/label/mapper/BusiLabelMapper.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/label/service/BusiLabelService.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/label/service/impl/BusiLabelServiceImpl.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/label/vo/BusiLabelPageReqVO.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/label/vo/BusiLabelRespVO.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/label/vo/BusiLabelSaveReqVO.java create mode 100644 dl-module-base/src/main/resources/mapper/label/BusiLabelMapper.xml diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/controller/admin/BusiLabelController.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/controller/admin/BusiLabelController.java new file mode 100644 index 00000000..630d9123 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/controller/admin/BusiLabelController.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.label.controller.admin; + +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Tag(name = "管理后台 - 标签库") +@RestController +@RequestMapping("/base/busiLabel") +@Validated +public class BusiLabelController { + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/entity/BusiLabel.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/entity/BusiLabel.java new file mode 100644 index 00000000..091e6f60 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/entity/BusiLabel.java @@ -0,0 +1,53 @@ +package cn.iocoder.yudao.module.label.entity; + +import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * 业务标签 DO + * + * @author 后台管理员 + */ +@TableName("base_busi_label") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BusiLabel extends TenantBaseDO { + + /** + * 主键标识 + */ + @TableId(type = IdType.ASSIGN_UUID) + private String id; + /** + * 主表名称 + */ + private String mainTable; + /** + * 主表id + */ + private String mainId; + /** + * 标签库标签id + */ + private String labelId; + /** + * 标签名称 + */ + private String labelName; + /** + * 标签内容 + */ + private String labelContent; + /** + * 系统标识 + */ + private String systemCode; + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/mapper/BusiLabelMapper.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/mapper/BusiLabelMapper.java new file mode 100644 index 00000000..a16bfaba --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/mapper/BusiLabelMapper.java @@ -0,0 +1,15 @@ +package cn.iocoder.yudao.module.label.mapper; + +import cn.iocoder.yudao.module.label.entity.BusiLabel; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 客户管理扩展Mapper + * + * @author pqz + */ +@Mapper +public interface BusiLabelMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/service/BusiLabelService.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/service/BusiLabelService.java new file mode 100644 index 00000000..a9587946 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/service/BusiLabelService.java @@ -0,0 +1,38 @@ +package cn.iocoder.yudao.module.label.service; + +import cn.iocoder.yudao.module.label.entity.BusiLabel; +import cn.iocoder.yudao.module.label.vo.BusiLabelSaveReqVO; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + * 标签库 Service 接口 + * + * @author 后台管理员 + */ +public interface BusiLabelService extends IService { + + /** + * 通过mainId查询业务标签 + * + * @param mainId mainId + * @return java.util.List + * @author PQZ + * @date 18:22 2024/8/4 + **/ + List listByMainId(String mainId); + + /** + * 保存标签 + * + * @param mainId 主表id + * @param mainTable 主表名称 + * @param labelList 标签集合 + * @return void + * @author PQZ + * @date 18:39 2024/8/4 + **/ + void saveBusiLable(String mainId, String mainTable, List labelList); + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/service/impl/BusiLabelServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/service/impl/BusiLabelServiceImpl.java new file mode 100644 index 00000000..db4ae1f3 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/service/impl/BusiLabelServiceImpl.java @@ -0,0 +1,63 @@ +package cn.iocoder.yudao.module.label.service.impl; + +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.module.label.entity.BusiLabel; +import cn.iocoder.yudao.module.label.mapper.BusiLabelMapper; +import cn.iocoder.yudao.module.label.service.BusiLabelService; +import cn.iocoder.yudao.module.label.vo.BusiLabelSaveReqVO; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import java.util.List; + +/** + * 标签库 Service 实现类 + * + * @author 后台管理员 + */ +@Service +@Validated +public class BusiLabelServiceImpl extends ServiceImpl implements BusiLabelService { + + /** + * 通过mainId查询业务标签 + * + * @param mainId mainId + * @return java.util.List + * @author PQZ + * @date 18:22 2024/8/4 + **/ + @Override + public List listByMainId(String mainId) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(BaseDO::getDeleted,0).eq(BusiLabel::getMainId,mainId); + return list(lambdaQueryWrapper); + } + + /** + * 保存标签 + * + * @param mainId 主表id + * @param mainTable 主表名称 + * @param labelList 标签集合 + * @return void + * @author PQZ + * @date 18:39 2024/8/4 + **/ + @Override + public void saveBusiLable(String mainId, String mainTable, List labelList) { + /*1、删除已有标签信息*/ + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(BaseDO::getDeleted,0).eq(BusiLabel::getMainId,mainId); + this.remove(lambdaQueryWrapper); + /*2、保存标签信息*/ + labelList.forEach(item -> { + item.setId(null); + item.setMainId(mainId); + item.setMainTable(mainTable); + }); + this.saveBatch(labelList); + } +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/vo/BusiLabelPageReqVO.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/vo/BusiLabelPageReqVO.java new file mode 100644 index 00000000..2d996671 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/vo/BusiLabelPageReqVO.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.label.vo; + +import cn.iocoder.yudao.module.label.entity.BusiLabel; +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 业务标签分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class BusiLabelPageReqVO extends BusiLabel { +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/vo/BusiLabelRespVO.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/vo/BusiLabelRespVO.java new file mode 100644 index 00000000..c60df8b0 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/vo/BusiLabelRespVO.java @@ -0,0 +1,16 @@ +package cn.iocoder.yudao.module.label.vo; + +import cn.iocoder.yudao.module.label.entity.BusiLabel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 业务标签 Response VO") +@Data +@ExcelIgnoreUnannotated +public class BusiLabelRespVO extends BusiLabel { + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/vo/BusiLabelSaveReqVO.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/vo/BusiLabelSaveReqVO.java new file mode 100644 index 00000000..4328d3d3 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/label/vo/BusiLabelSaveReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.label.vo; + +import cn.iocoder.yudao.module.label.entity.BusiLabel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 业务标签新增/修改 Request VO") +@Data +public class BusiLabelSaveReqVO { + + +} \ No newline at end of file diff --git a/dl-module-base/src/main/resources/mapper/label/BusiLabelMapper.xml b/dl-module-base/src/main/resources/mapper/label/BusiLabelMapper.xml new file mode 100644 index 00000000..d9c7aeed --- /dev/null +++ b/dl-module-base/src/main/resources/mapper/label/BusiLabelMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file