From 18e3100ad6e0859728177322e0d268ef0a25c309 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 23 Aug 2023 10:30:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E9=80=81=E9=81=82=E6=98=8C=E5=8E=BF?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=20=E4=BB=A3=E7=A0=81debug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/GovProjectCollectionController.java | 14 +++---- .../gov/manage/GovProjectCollectionManage.java | 25 ++++++++++++ .../gov/mapper/GovProjectDictionaryMapper.java | 16 ++++++++ .../gov/model/entity/GovProjectDictionary.java | 46 ++++++++++++++++++++++ .../pmapi/gov/model/vo/GovProjectDictionaryVO.java | 41 +++++++++++++++++++ .../gov/service/IGovProjectDictionaryService.java | 16 ++++++++ .../impl/GovProjectDictionaryServiceImpl.java | 21 ++++++++++ 7 files changed, 171 insertions(+), 8 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovProjectDictionaryMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovProjectDictionary.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovProjectDictionaryVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovProjectDictionaryService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovProjectDictionaryServiceImpl.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java index 56e0dd3..cd2c897 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java @@ -1,8 +1,7 @@ package com.ningdatech.pmapi.gov.controller; - -import com.ningdatech.pmapi.gov.manage.BelongOrgManage; -import com.ningdatech.pmapi.gov.model.vo.GovBusinessStripVO; +import com.ningdatech.pmapi.gov.manage.GovProjectCollectionManage; +import com.ningdatech.pmapi.gov.model.vo.GovProjectDictionaryVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -12,7 +11,6 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; - import java.util.List; /** @@ -31,12 +29,12 @@ import java.util.List; @RequestMapping("/api/v1/gov-project-collection") public class GovProjectCollectionController { - private final BelongOrgManage belongOrgManage; + private final GovProjectCollectionManage collectionManage; @GetMapping("/dictionary") - @ApiOperation("获取条线列表") - public List getGovBusinessStripList(@RequestParam(value = "type", required = false) String type) { - return belongOrgManage.getGovBusinessStripList(type); + @ApiOperation("字典") + public List dictionary(@RequestParam(value = "type", required = false) String type) { + return collectionManage.dictionary(type); } @GetMapping("/business-strip/expert/analysis") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java index 8c8400c..8b6216d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java @@ -1,8 +1,19 @@ package com.ningdatech.pmapi.gov.manage; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.pmapi.gov.model.entity.GovProjectDictionary; +import com.ningdatech.pmapi.gov.model.vo.GovProjectDictionaryVO; +import com.ningdatech.pmapi.gov.service.IGovProjectDictionaryService; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + /** * @author zpf * @date 2023/8/21 下午2:27 @@ -12,4 +23,18 @@ import org.springframework.stereotype.Component; @RequiredArgsConstructor public class GovProjectCollectionManage { + private final IGovProjectDictionaryService dictionaryService; + + public List dictionary(String type) { + + List dictionaries = dictionaryService.list(Wrappers.lambdaQuery(GovProjectDictionary.class) + .eq(StringUtils.isNotBlank(type), GovProjectDictionary::getType, type)); + + if(CollUtil.isEmpty(dictionaries)){ + return Collections.emptyList(); + } + + return dictionaries.stream().map(d -> BeanUtil.copyProperties(d,GovProjectDictionaryVO.class)) + .collect(Collectors.toList()); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovProjectDictionaryMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovProjectDictionaryMapper.java new file mode 100644 index 0000000..0a7fd35 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/mapper/GovProjectDictionaryMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.gov.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.pmapi.gov.model.entity.GovProjectDictionary; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface GovProjectDictionaryMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovProjectDictionary.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovProjectDictionary.java new file mode 100644 index 0000000..eeeacde --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovProjectDictionary.java @@ -0,0 +1,46 @@ +package com.ningdatech.pmapi.gov.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 项目字典表 + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@TableName("gov_project_dictionary") +@ApiModel(value = "GovProjectDictionary对象", description = "项目字典表") +public class GovProjectDictionary implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + private String createBy; + private LocalDateTime createOn; + + @ApiModelProperty("类型") + private String type; + + @ApiModelProperty("值") + private String value; + + @ApiModelProperty("展示值") + private String label; + + @ApiModelProperty("备注") + private String remark; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovProjectDictionaryVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovProjectDictionaryVO.java new file mode 100644 index 0000000..d940080 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovProjectDictionaryVO.java @@ -0,0 +1,41 @@ +package com.ningdatech.pmapi.gov.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 项目字典表 + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@ApiModel(value = "GovProjectDictionaryVO", description = "项目字典表") +public class GovProjectDictionaryVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + private String createBy; + private LocalDateTime createOn; + + @ApiModelProperty("类型") + private String type; + + @ApiModelProperty("值") + private String value; + + @ApiModelProperty("展示值") + private String label; + + @ApiModelProperty("备注") + private String remark; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovProjectDictionaryService.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovProjectDictionaryService.java new file mode 100644 index 0000000..01852cf --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/IGovProjectDictionaryService.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.gov.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.pmapi.gov.model.entity.GovProjectDictionary; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +public interface IGovProjectDictionaryService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovProjectDictionaryServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovProjectDictionaryServiceImpl.java new file mode 100644 index 0000000..4e6b74d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/service/impl/GovProjectDictionaryServiceImpl.java @@ -0,0 +1,21 @@ +package com.ningdatech.pmapi.gov.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.pmapi.gov.mapper.GovProjectDictionaryMapper; +import com.ningdatech.pmapi.gov.model.entity.GovProjectDictionary; +import com.ningdatech.pmapi.gov.service.IGovProjectDictionaryService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-08-23 + */ +@Service +public class GovProjectDictionaryServiceImpl extends + ServiceImpl implements IGovProjectDictionaryService { + +}