From 61bcac7d0fb651ec0b3fc3fdb0cd1cd5ac118fc4 Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Tue, 12 Jan 2021 14:31:40 +0800 Subject: [PATCH 01/26] fix --- .../IndicatorLibraryController.java | 60 +++++ .../controller/IndicatorTypeController.java | 43 ++++ .../dao/IndicatorLibraryMapper.java | 33 +++ .../performance/dao/IndicatorTypeMapper.java | 43 ++++ .../performance/dto/IndicatorTypeDto.java | 22 ++ .../performance/entity/IndicatorLibrary.java | 217 ++++++++++++++++++ .../performance/entity/IndicatorType.java | 158 +++++++++++++ .../modules/performance/req/IndicatorReq.java | 20 ++ .../service/IndicatorLibraryService.java | 33 +++ .../service/IndicatorTypeService.java | 37 +++ .../impl/IndicatorLibraryServiceImpl.java | 63 +++++ .../impl/IndicatorTypeServiceImpl.java | 71 ++++++ .../performance/IndicatorLibraryMapper.xml | 97 ++++++++ .../performance/IndicatorTypeMapper.xml | 87 +++++++ src/test/java/com/lz/mysql/MysqlMain.java | 4 +- .../lz/mysql/MysqlUtilTable2Contoller.java | 2 +- 16 files changed, 987 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java create mode 100644 src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java create mode 100644 src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java create mode 100644 src/main/java/com/lz/modules/performance/dao/IndicatorTypeMapper.java create mode 100644 src/main/java/com/lz/modules/performance/dto/IndicatorTypeDto.java create mode 100644 src/main/java/com/lz/modules/performance/entity/IndicatorLibrary.java create mode 100644 src/main/java/com/lz/modules/performance/entity/IndicatorType.java create mode 100644 src/main/java/com/lz/modules/performance/req/IndicatorReq.java create mode 100644 src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java create mode 100644 src/main/java/com/lz/modules/performance/service/IndicatorTypeService.java create mode 100644 src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java create mode 100644 src/main/java/com/lz/modules/performance/service/impl/IndicatorTypeServiceImpl.java create mode 100644 src/main/resources/mapper/performance/IndicatorLibraryMapper.xml create mode 100644 src/main/resources/mapper/performance/IndicatorTypeMapper.xml diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java new file mode 100644 index 00000000..96f9c8b3 --- /dev/null +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java @@ -0,0 +1,60 @@ +package com.lz.modules.performance.controller; + + +import com.alibaba.fastjson.JSONObject; +import com.lz.common.utils.PageUtils; +import com.lz.common.utils.R; +import com.lz.common.utils.StringUtil; +import com.lz.modules.performance.entity.IndicatorLibrary; +import com.lz.modules.performance.service.IndicatorLibraryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; +import java.util.Map; + +@RestController +@RequestMapping("/indicatorLibrary") +public class IndicatorLibraryController { + + + @Autowired + private IndicatorLibraryService indicatorLibraryService; + + + @RequestMapping("/list") + public R list(@RequestBody String body) { + indicatorLibraryService.list(); + return R.ok().put("data",null); + } + + + @RequestMapping("/getById") + public R getById(@RequestBody IndicatorLibrary indicatorLibrary) { + indicatorLibrary = indicatorLibraryService.selectIndicatorLibraryById(indicatorLibrary.getId()); + return R.ok().put("indicatorLibrary",indicatorLibrary); + } + + + @RequestMapping("/update") + public R update(@RequestBody IndicatorLibrary indicatorLibrary) { + indicatorLibraryService.updateIndicatorLibraryById(indicatorLibrary); + return R.ok(); + } + + + @RequestMapping("/save") + public R save(@RequestBody IndicatorLibrary indicatorLibrary) { + indicatorLibraryService.insertIndicatorLibrary(indicatorLibrary); + return R.ok(); + } + + + @RequestMapping("/delete") + public R delete(@RequestBody Long id) { + indicatorLibraryService.deleteIndicatorLibraryById(id); + return R.ok(); + } +} diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java new file mode 100644 index 00000000..9cb1d485 --- /dev/null +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java @@ -0,0 +1,43 @@ +package com.lz.modules.performance.controller; + + +import cn.hutool.core.bean.BeanUtil; +import com.lz.common.utils.PageUtils; +import com.lz.common.utils.R; +import com.lz.modules.performance.dto.IndicatorTypeDto; +import com.lz.modules.performance.entity.IndicatorType; +import com.lz.modules.performance.req.IndicatorReq; +import com.lz.modules.performance.service.IndicatorTypeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/indicatorType") +public class IndicatorTypeController { + + + @Autowired + private IndicatorTypeService indicatorTypeService; + + + @RequestMapping("/list") + public R list(@RequestBody IndicatorReq req) { + PageUtils page = indicatorTypeService.selectIndicatorTypesByReq(req); + return R.ok().put("data", page); + } + + + + @RequestMapping("/saveOrUpdate") + public R save(@RequestBody IndicatorTypeDto dto) { + IndicatorType indicatorType = new IndicatorType(); + BeanUtil.copyProperties(dto,indicatorType); + boolean success = indicatorTypeService.saveOrUpdate(indicatorType); + if(!success){ + return R.error(); + } + return R.ok(); + } +} diff --git a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java new file mode 100644 index 00000000..a5da8dd3 --- /dev/null +++ b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java @@ -0,0 +1,33 @@ +package com.lz.modules.performance.dao; +/** +*

+* (设置)指标库 服务类 +*

+* +* @author quyixiao +* @since 2021-01-12 +*/ +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.lz.modules.performance.entity.IndicatorLibrary; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +@Mapper +public interface IndicatorLibraryMapper extends BaseMapper { + + + IndicatorLibrary selectIndicatorLibraryById(@Param("id") Long id); + + + Long insertIndicatorLibrary(IndicatorLibrary indicatorLibrary); + + + int updateIndicatorLibraryById(IndicatorLibrary indicatorLibrary); + + + int updateCoverIndicatorLibraryById(IndicatorLibrary indicatorLibrary); + + + int deleteIndicatorLibraryById(@Param("id") Long id); + + +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/dao/IndicatorTypeMapper.java b/src/main/java/com/lz/modules/performance/dao/IndicatorTypeMapper.java new file mode 100644 index 00000000..cec45492 --- /dev/null +++ b/src/main/java/com/lz/modules/performance/dao/IndicatorTypeMapper.java @@ -0,0 +1,43 @@ +package com.lz.modules.performance.dao; +/** +*

+* 指标分类 服务类 +*

+* +* @author quyixiao +* @since 2021-01-12 +*/ +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.lz.modules.equipment.entity.TCountReq; +import com.lz.modules.performance.dto.IndicatorTypeDto; +import com.lz.modules.performance.entity.IndicatorType; +import com.lz.modules.performance.req.IndicatorReq; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface IndicatorTypeMapper extends BaseMapper { + + + IndicatorType selectIndicatorTypeById(@Param("id") Long id); + + + Long insertIndicatorType(IndicatorType indicatorType); + + + int updateIndicatorTypeById(IndicatorType indicatorType); + + + int updateCoverIndicatorTypeById(IndicatorType indicatorType); + + + int deleteIndicatorTypeById(@Param("id") Long id); + + List selectIndicatorTypesByReq(@Param("page") IPage page, @Param("req")IndicatorReq req); + + + +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/dto/IndicatorTypeDto.java b/src/main/java/com/lz/modules/performance/dto/IndicatorTypeDto.java new file mode 100644 index 00000000..04af7299 --- /dev/null +++ b/src/main/java/com/lz/modules/performance/dto/IndicatorTypeDto.java @@ -0,0 +1,22 @@ +package com.lz.modules.performance.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author: djc + * @Desc: + * @Date: 2021/1/12 10:21 + */ +@Data +public class IndicatorTypeDto { + + @ApiModelProperty(value = "id", name = "id") + private Long id; + //指标名称 + @ApiModelProperty(value = "指标分类名称", name = "name") + private String name; + //排序 + @ApiModelProperty(value = "排序(非必传)", name = "orderBy") + private Integer orderBy; +} diff --git a/src/main/java/com/lz/modules/performance/entity/IndicatorLibrary.java b/src/main/java/com/lz/modules/performance/entity/IndicatorLibrary.java new file mode 100644 index 00000000..e99603ad --- /dev/null +++ b/src/main/java/com/lz/modules/performance/entity/IndicatorLibrary.java @@ -0,0 +1,217 @@ +package com.lz.modules.performance.entity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; +/** +*

+*

*(设置)指标库 +* @author quyixiao +* @since 2021-01-12 +*/ + +@Data +@TableName("lz_indicator_library") +@ApiModel(value = "(设置)指标库") +public class IndicatorLibrary implements java.io.Serializable { + // + @TableId(value = "id", type = IdType.AUTO) + private Long id; + // + @ApiModelProperty(value = "", name = "isDelete") + private Integer isDelete; + // + @ApiModelProperty(value = "", name = "gmtCreate") + private Date gmtCreate; + // + @ApiModelProperty(value = "", name = "gmtModified") + private Date gmtModified; + //指标名称 + @ApiModelProperty(value = "指标名称", name = "name") + private String name; + //指标类型 0:量化指标 1:行为价值观指标 2:团队管理 + @ApiModelProperty(value = "指标类型 0:量化指标 1:行为价值观指标 2:团队管理", name = "type") + private Integer type; + //指标分类 lz_indicator_type 表id + @ApiModelProperty(value = "指标分类 lz_indicator_type 表id", name = "indicatorType") + private Integer indicatorType; + //权重 + @ApiModelProperty(value = "权重", name = "weight") + private BigDecimal weight; + //考核标准,关键结果 + @ApiModelProperty(value = "考核标准,关键结果", name = "keyResult") + private String keyResult; + //排序 + @ApiModelProperty(value = "排序", name = "sort") + private Integer sort; + /** + * + * @return + */ + public Long getId() { + return id; + } + /** + * + * @param id + */ + public void setId(Long id) { + this.id = id; + } + + /** + * + * @return + */ + public Integer getIsDelete() { + return isDelete; + } + /** + * + * @param isDelete + */ + public void setIsDelete(Integer isDelete) { + this.isDelete = isDelete; + } + + /** + * + * @return + */ + public Date getGmtCreate() { + return gmtCreate; + } + /** + * + * @param gmtCreate + */ + public void setGmtCreate(Date gmtCreate) { + this.gmtCreate = gmtCreate; + } + + /** + * + * @return + */ + public Date getGmtModified() { + return gmtModified; + } + /** + * + * @param gmtModified + */ + public void setGmtModified(Date gmtModified) { + this.gmtModified = gmtModified; + } + + /** + * 指标名称 + * @return + */ + public String getName() { + return name; + } + /** + * 指标名称 + * @param name + */ + public void setName(String name) { + this.name = name; + } + + /** + * 指标类型 0:量化指标 1:行为价值观指标 2:团队管理 + * @return + */ + public Integer getType() { + return type; + } + /** + * 指标类型 0:量化指标 1:行为价值观指标 2:团队管理 + * @param type + */ + public void setType(Integer type) { + this.type = type; + } + + /** + * 指标分类 lz_indicator_type 表id + * @return + */ + public Integer getIndicatorType() { + return indicatorType; + } + /** + * 指标分类 lz_indicator_type 表id + * @param indicatorType + */ + public void setIndicatorType(Integer indicatorType) { + this.indicatorType = indicatorType; + } + + /** + * 权重 + * @return + */ + public BigDecimal getWeight() { + return weight; + } + /** + * 权重 + * @param weight + */ + public void setWeight(BigDecimal weight) { + this.weight = weight; + } + + /** + * 考核标准,关键结果 + * @return + */ + public String getKeyResult() { + return keyResult; + } + /** + * 考核标准,关键结果 + * @param keyResult + */ + public void setKeyResult(String keyResult) { + this.keyResult = keyResult; + } + + /** + * 排序 + * @return + */ + public Integer getSort() { + return sort; + } + /** + * 排序 + * @param sort + */ + public void setSort(Integer sort) { + this.sort = sort; + } + + @Override + public String toString() { + return "IndicatorLibrary{" + + ",id=" + id + + ",isDelete=" + isDelete + + ",gmtCreate=" + gmtCreate + + ",gmtModified=" + gmtModified + + ",name=" + name + + ",type=" + type + + ",indicatorType=" + indicatorType + + ",weight=" + weight + + ",keyResult=" + keyResult + + ",sort=" + sort + + "}"; + } +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/entity/IndicatorType.java b/src/main/java/com/lz/modules/performance/entity/IndicatorType.java new file mode 100644 index 00000000..f1956664 --- /dev/null +++ b/src/main/java/com/lz/modules/performance/entity/IndicatorType.java @@ -0,0 +1,158 @@ +package com.lz.modules.performance.entity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; +/** +*

+*

*指标分类 +* @author quyixiao +* @since 2021-01-12 +*/ + +@Data +@TableName("lz_indicator_type") +@ApiModel(value = "指标分类") +public class IndicatorType implements java.io.Serializable { + // + @TableId(value = "id", type = IdType.AUTO) + private Long id; + // + @ApiModelProperty(value = "", name = "isDelete") + private Integer isDelete; + // + @ApiModelProperty(value = "", name = "gmtCreate") + private Date gmtCreate; + // + @ApiModelProperty(value = "", name = "gmtModified") + private Date gmtModified; + //指标分类名称 + @ApiModelProperty(value = "指标分类名称", name = "name") + private String name; + //0: 指标分类 1:指标类型 + @ApiModelProperty(value = "0: 指标分类 1:指标类型", name = "type") + private Integer type; + //排序 + @ApiModelProperty(value = "排序", name = "sort") + private Integer sort; + /** + * + * @return + */ + public Long getId() { + return id; + } + /** + * + * @param id + */ + public void setId(Long id) { + this.id = id; + } + + /** + * + * @return + */ + public Integer getIsDelete() { + return isDelete; + } + /** + * + * @param isDelete + */ + public void setIsDelete(Integer isDelete) { + this.isDelete = isDelete; + } + + /** + * + * @return + */ + public Date getGmtCreate() { + return gmtCreate; + } + /** + * + * @param gmtCreate + */ + public void setGmtCreate(Date gmtCreate) { + this.gmtCreate = gmtCreate; + } + + /** + * + * @return + */ + public Date getGmtModified() { + return gmtModified; + } + /** + * + * @param gmtModified + */ + public void setGmtModified(Date gmtModified) { + this.gmtModified = gmtModified; + } + + /** + * 指标分类名称 + * @return + */ + public String getName() { + return name; + } + /** + * 指标分类名称 + * @param name + */ + public void setName(String name) { + this.name = name; + } + + /** + * 0: 指标分类 1:指标类型 + * @return + */ + public Integer getType() { + return type; + } + /** + * 0: 指标分类 1:指标类型 + * @param type + */ + public void setType(Integer type) { + this.type = type; + } + + /** + * 排序 + * @return + */ + public Integer getSort() { + return sort; + } + /** + * 排序 + * @param sort + */ + public void setSort(Integer sort) { + this.sort = sort; + } + + @Override + public String toString() { + return "IndicatorType{" + + ",id=" + id + + ",isDelete=" + isDelete + + ",gmtCreate=" + gmtCreate + + ",gmtModified=" + gmtModified + + ",name=" + name + + ",type=" + type + + ",sort=" + sort + + "}"; + } +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/req/IndicatorReq.java b/src/main/java/com/lz/modules/performance/req/IndicatorReq.java new file mode 100644 index 00000000..a53b6e3b --- /dev/null +++ b/src/main/java/com/lz/modules/performance/req/IndicatorReq.java @@ -0,0 +1,20 @@ +package com.lz.modules.performance.req; + +import com.lz.modules.equipment.entity.model.BasePage; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author: djc + * @Desc: + * @Date: 2021/1/12 11:39 + */ +@Data +public class IndicatorReq extends BasePage{ + //指标名称 + @ApiModelProperty(value = "指标分类名称", name = "name") + private String name; + //指标名称 + @ApiModelProperty(value = "类型 0: 指标分类 1:指标类型", name = "type") + private Integer type; +} diff --git a/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java new file mode 100644 index 00000000..582fa04e --- /dev/null +++ b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java @@ -0,0 +1,33 @@ +package com.lz.modules.performance.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.lz.modules.performance.entity.IndicatorLibrary; + +/** +*

+* (设置)指标库 服务类 +*

+* +* @author quyixiao +* @since 2021-01-12 +*/ +public interface IndicatorLibraryService extends IService { + + + + IndicatorLibrary selectIndicatorLibraryById(Long id); + + + Long insertIndicatorLibrary(IndicatorLibrary indicatorLibrary); + + + int updateIndicatorLibraryById(IndicatorLibrary indicatorLibrary); + + + int updateCoverIndicatorLibraryById(IndicatorLibrary indicatorLibrary); + + + int deleteIndicatorLibraryById(Long id); + + +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/service/IndicatorTypeService.java b/src/main/java/com/lz/modules/performance/service/IndicatorTypeService.java new file mode 100644 index 00000000..84705fb3 --- /dev/null +++ b/src/main/java/com/lz/modules/performance/service/IndicatorTypeService.java @@ -0,0 +1,37 @@ +package com.lz.modules.performance.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.lz.common.utils.PageUtils; +import com.lz.modules.performance.req.IndicatorReq; +import com.lz.modules.performance.entity.IndicatorType; + +/** +*

+* 指标分类 服务类 +*

+* +* @author quyixiao +* @since 2021-01-12 +*/ +public interface IndicatorTypeService extends IService { + + + + IndicatorType selectIndicatorTypeById(Long id); + + + Long insertIndicatorType(IndicatorType indicatorType); + + + int updateIndicatorTypeById(IndicatorType indicatorType); + + + int updateCoverIndicatorTypeById(IndicatorType indicatorType); + + + int deleteIndicatorTypeById(Long id); + + PageUtils selectIndicatorTypesByReq(IndicatorReq req); + + +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java new file mode 100644 index 00000000..c4edd633 --- /dev/null +++ b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java @@ -0,0 +1,63 @@ +package com.lz.modules.performance.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lz.modules.performance.dao.IndicatorLibraryMapper; +import com.lz.modules.performance.entity.IndicatorLibrary; +import com.lz.modules.performance.service.IndicatorLibraryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** +*

+* (设置)指标库 服务类 +*

+* +* @author quyixiao +* @since 2021-01-12 +*/ + +@Service +public class IndicatorLibraryServiceImpl extends ServiceImpl implements IndicatorLibraryService { + + + @Autowired + private IndicatorLibraryMapper indicatorLibraryMapper; + + + + @Override + public IndicatorLibrary selectIndicatorLibraryById(Long id){ + return indicatorLibraryMapper.selectIndicatorLibraryById(id); + } + + + + @Override + public Long insertIndicatorLibrary(IndicatorLibrary indicatorLibrary){ + return indicatorLibraryMapper.insertIndicatorLibrary(indicatorLibrary); + } + + + + @Override + public int updateIndicatorLibraryById(IndicatorLibrary indicatorLibrary){ + return indicatorLibraryMapper.updateIndicatorLibraryById(indicatorLibrary); + } + + + + @Override + public int updateCoverIndicatorLibraryById(IndicatorLibrary indicatorLibrary){ + return indicatorLibraryMapper.updateCoverIndicatorLibraryById(indicatorLibrary); + } + + + + @Override + public int deleteIndicatorLibraryById(Long id){ + return indicatorLibraryMapper.deleteIndicatorLibraryById(id); + } + + + +} diff --git a/src/main/java/com/lz/modules/performance/service/impl/IndicatorTypeServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/IndicatorTypeServiceImpl.java new file mode 100644 index 00000000..d1e7663e --- /dev/null +++ b/src/main/java/com/lz/modules/performance/service/impl/IndicatorTypeServiceImpl.java @@ -0,0 +1,71 @@ +package com.lz.modules.performance.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lz.common.utils.PageUtils; +import com.lz.modules.performance.dao.IndicatorTypeMapper; +import com.lz.modules.performance.req.IndicatorReq; +import com.lz.modules.performance.entity.IndicatorType; +import com.lz.modules.performance.service.IndicatorTypeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** +*

+* 指标分类 服务类 +*

+* +* @author quyixiao +* @since 2021-01-12 +*/ + +@Service +public class IndicatorTypeServiceImpl extends ServiceImpl implements IndicatorTypeService { + + + @Autowired + private IndicatorTypeMapper indicatorTypeMapper; + + + + @Override + public IndicatorType selectIndicatorTypeById(Long id){ + return indicatorTypeMapper.selectIndicatorTypeById(id); + } + + + + @Override + public Long insertIndicatorType(IndicatorType indicatorType){ + return indicatorTypeMapper.insertIndicatorType(indicatorType); + } + + + + @Override + public int updateIndicatorTypeById(IndicatorType indicatorType){ + return indicatorTypeMapper.updateIndicatorTypeById(indicatorType); + } + + + + @Override + public int updateCoverIndicatorTypeById(IndicatorType indicatorType){ + return indicatorTypeMapper.updateCoverIndicatorTypeById(indicatorType); + } + + + + @Override + public int deleteIndicatorTypeById(Long id){ + return indicatorTypeMapper.deleteIndicatorTypeById(id); + } + + @Override + public PageUtils selectIndicatorTypesByReq(IndicatorReq req) { + + PageUtils page = PageUtils.startPage(req.getCurrPage(), req.getPageSize()).doSelect( + page1 -> indicatorTypeMapper.selectIndicatorTypesByReq(page1,req) + ); + return page; + } +} diff --git a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml new file mode 100644 index 00000000..368d6e20 --- /dev/null +++ b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, name AS name, type AS type, indicator_type AS indicatorType, weight AS weight, key_result AS keyResult, sort AS sort + + + + + + + + + + insert into lz_indicator_library( + name, + type, + indicator_type, + weight, + key_result, + sort, + is_delete, + gmt_create, + gmt_modified + )values( + #{ name}, + #{ type}, + #{ indicatorType}, + #{ weight}, + #{ keyResult}, + #{ sort}, + 0, + now(), + now() + ) + + + + + update + lz_indicator_library + + is_delete = #{isDelete}, + gmt_create = #{gmtCreate}, + name = #{name}, + type = #{type}, + indicator_type = #{indicatorType}, + weight = #{weight}, + key_result = #{keyResult}, + sort = #{sort} + + ,gmt_modified = now() + where id = #{id} + + + + + update + lz_indicator_library + set + is_delete = #{isDelete}, + gmt_create = #{gmtCreate}, + name = #{name}, + type = #{type}, + indicator_type = #{indicatorType}, + weight = #{weight}, + key_result = #{keyResult}, + sort = #{sort} + ,gmt_modified = now() + where id = #{id} + + + + update lz_indicator_library set is_delete = 1 where id=#{id} limit 1 + + + + diff --git a/src/main/resources/mapper/performance/IndicatorTypeMapper.xml b/src/main/resources/mapper/performance/IndicatorTypeMapper.xml new file mode 100644 index 00000000..ec89a785 --- /dev/null +++ b/src/main/resources/mapper/performance/IndicatorTypeMapper.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, name AS name, type AS type, sort AS sort + + + + + + + + + + insert into lz_indicator_type( + name, + type, + sort, + is_delete, + gmt_create, + gmt_modified + )values( + #{ name}, + #{ type}, + #{ sort}, + 0, + now(), + now() + ) + + + + + update + lz_indicator_type + + is_delete = #{isDelete}, + gmt_create = #{gmtCreate}, + name = #{name}, + type = #{type}, + sort = #{sort} + + ,gmt_modified = now() + where id = #{id} + + + + + update + lz_indicator_type + set + is_delete = #{isDelete}, + gmt_create = #{gmtCreate}, + name = #{name}, + type = #{type}, + sort = #{sort} + ,gmt_modified = now() + where id = #{id} + + + + + update lz_indicator_type set is_delete = 1 where id=#{id} limit 1 + + + + + + diff --git a/src/test/java/com/lz/mysql/MysqlMain.java b/src/test/java/com/lz/mysql/MysqlMain.java index bd526a42..ef71049e 100644 --- a/src/test/java/com/lz/mysql/MysqlMain.java +++ b/src/test/java/com/lz/mysql/MysqlMain.java @@ -85,8 +85,8 @@ public class MysqlMain { List list = new ArrayList(); - list.add(new TablesBean("lz_flow_chart_role")); - list.add(new TablesBean("lz_flow_chart_role_group")); + list.add(new TablesBean("lz_indicator_library")); + list.add(new TablesBean("lz_indicator_type")); List list2 = new ArrayList(); diff --git a/src/test/java/com/lz/mysql/MysqlUtilTable2Contoller.java b/src/test/java/com/lz/mysql/MysqlUtilTable2Contoller.java index 32fb9d06..328c88b8 100644 --- a/src/test/java/com/lz/mysql/MysqlUtilTable2Contoller.java +++ b/src/test/java/com/lz/mysql/MysqlUtilTable2Contoller.java @@ -46,7 +46,7 @@ public class MysqlUtilTable2Contoller { content.append(" if(StringUtil.isNotBlank(body)){\n"); content.append(" params = JSONObject.parseObject(body,Map.class);\n"); content.append(" }\n"); - content.append(" PageUtils page = " + tableBean.getJavaName() + "service.queryPage(params);\n"); + content.append(" PageUtils page = " + tableBean.getJavaName() + "Service.queryPage(params);\n"); content.append(" return R.ok().put(\"page\", page);\n"); content.append(" }\n"); content.append("\n"); From bf7f95d867dc1c3d6ddb5312a8d310dd8bc5707a Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Tue, 12 Jan 2021 17:22:08 +0800 Subject: [PATCH 02/26] fix --- .../IndicatorLibraryController.java | 38 +++++++++---------- .../dao/IndicatorLibraryMapper.java | 9 +++++ .../performance/dto/IndicatorLibraryDto.java | 36 ++++++++++++++++++ .../performance/dto/IndicatorTypeDto.java | 2 +- .../performance/entity/IndicatorLibrary.java | 2 +- .../performance/req/IndicatorLibraryReq.java | 22 +++++++++++ .../service/IndicatorLibraryService.java | 6 +++ .../impl/IndicatorLibraryServiceImpl.java | 23 +++++++++++ .../performance/IndicatorLibraryMapper.xml | 18 ++++++++- 9 files changed, 133 insertions(+), 23 deletions(-) create mode 100644 src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java create mode 100644 src/main/java/com/lz/modules/performance/req/IndicatorLibraryReq.java diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java index 96f9c8b3..6f2fe625 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java @@ -1,16 +1,17 @@ package com.lz.modules.performance.controller; +import cn.hutool.core.bean.BeanUtil; import com.alibaba.fastjson.JSONObject; import com.lz.common.utils.PageUtils; import com.lz.common.utils.R; import com.lz.common.utils.StringUtil; +import com.lz.modules.performance.dto.IndicatorLibraryDto; import com.lz.modules.performance.entity.IndicatorLibrary; +import com.lz.modules.performance.req.IndicatorLibraryReq; import com.lz.modules.performance.service.IndicatorLibraryService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.HashMap; import java.util.Map; @@ -25,9 +26,9 @@ public class IndicatorLibraryController { @RequestMapping("/list") - public R list(@RequestBody String body) { - indicatorLibraryService.list(); - return R.ok().put("data",null); + public R list(@RequestBody IndicatorLibraryReq req) { + PageUtils page = indicatorLibraryService.selectIndicatorLibrarysByReq(req); + return R.ok().put("data",page); } @@ -38,23 +39,22 @@ public class IndicatorLibraryController { } - @RequestMapping("/update") - public R update(@RequestBody IndicatorLibrary indicatorLibrary) { - indicatorLibraryService.updateIndicatorLibraryById(indicatorLibrary); + + @RequestMapping("/saveOrUpdate") + public R save(@RequestBody IndicatorLibraryDto dto) { + IndicatorLibrary indicatorLibrary = new IndicatorLibrary(); + BeanUtil.copyProperties(dto,indicatorLibrary); + boolean success = indicatorLibraryService.saveOrUpdate(indicatorLibrary); + if(!success){ + return R.error(); + } return R.ok(); } - @RequestMapping("/save") - public R save(@RequestBody IndicatorLibrary indicatorLibrary) { - indicatorLibraryService.insertIndicatorLibrary(indicatorLibrary); - return R.ok(); - } - - - @RequestMapping("/delete") - public R delete(@RequestBody Long id) { - indicatorLibraryService.deleteIndicatorLibraryById(id); + @GetMapping("/delete") + public R delete(@RequestParam String ids) { + indicatorLibraryService.deleteIndicatorLibrarysByIds(ids); return R.ok(); } } diff --git a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java index a5da8dd3..bfd2d7d8 100644 --- a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java +++ b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java @@ -8,9 +8,15 @@ package com.lz.modules.performance.dao; * @since 2021-01-12 */ import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.lz.modules.performance.dto.IndicatorLibraryDto; import com.lz.modules.performance.entity.IndicatorLibrary; +import com.lz.modules.performance.req.IndicatorLibraryReq; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; + +import java.util.List; + @Mapper public interface IndicatorLibraryMapper extends BaseMapper { @@ -29,5 +35,8 @@ public interface IndicatorLibraryMapper extends BaseMapper { int deleteIndicatorLibraryById(@Param("id") Long id); + List selectIndicatorLibrarysByReq(@Param("page") IPage page, @Param("req")IndicatorLibraryReq req); + + void deleteIndicatorLibrarysByIds(@Param("ids") List ids); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java b/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java new file mode 100644 index 00000000..3755afa9 --- /dev/null +++ b/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java @@ -0,0 +1,36 @@ +package com.lz.modules.performance.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; + +import java.math.BigDecimal; + +/** + * @Author: djc + * @Desc: + * @Date: 2021/1/12 14:41 + */ +public class IndicatorLibraryDto { + // + @TableId(value = "id", type = IdType.AUTO) + private Long id; + //指标名称 + @ApiModelProperty(value = "指标名称", name = "name") + private String name; + //指标类型 lz_indicator_type 表id" + @ApiModelProperty(value = "指标类型 lz_indicator_type 表id", name = "type") + private Integer type; + //指标分类 lz_indicator_type 表id + @ApiModelProperty(value = "指标分类 lz_indicator_type 表id", name = "indicatorType") + private Integer indicatorType; + //权重 + @ApiModelProperty(value = "权重", name = "weight") + private BigDecimal weight; + //考核标准,关键结果 + @ApiModelProperty(value = "考核标准,关键结果", name = "keyResult") + private String keyResult; + //排序 + @ApiModelProperty(value = "排序", name = "sort") + private Integer sort; +} diff --git a/src/main/java/com/lz/modules/performance/dto/IndicatorTypeDto.java b/src/main/java/com/lz/modules/performance/dto/IndicatorTypeDto.java index 04af7299..a4dc3542 100644 --- a/src/main/java/com/lz/modules/performance/dto/IndicatorTypeDto.java +++ b/src/main/java/com/lz/modules/performance/dto/IndicatorTypeDto.java @@ -17,6 +17,6 @@ public class IndicatorTypeDto { @ApiModelProperty(value = "指标分类名称", name = "name") private String name; //排序 - @ApiModelProperty(value = "排序(非必传)", name = "orderBy") + @ApiModelProperty(value = "排序(非必须)", name = "orderBy") private Integer orderBy; } diff --git a/src/main/java/com/lz/modules/performance/entity/IndicatorLibrary.java b/src/main/java/com/lz/modules/performance/entity/IndicatorLibrary.java index e99603ad..d17267ff 100644 --- a/src/main/java/com/lz/modules/performance/entity/IndicatorLibrary.java +++ b/src/main/java/com/lz/modules/performance/entity/IndicatorLibrary.java @@ -35,7 +35,7 @@ public class IndicatorLibrary implements java.io.Serializable { @ApiModelProperty(value = "指标名称", name = "name") private String name; //指标类型 0:量化指标 1:行为价值观指标 2:团队管理 - @ApiModelProperty(value = "指标类型 0:量化指标 1:行为价值观指标 2:团队管理", name = "type") + @ApiModelProperty(value = "指标类型 lz_indicator_type 表id", name = "type") private Integer type; //指标分类 lz_indicator_type 表id @ApiModelProperty(value = "指标分类 lz_indicator_type 表id", name = "indicatorType") diff --git a/src/main/java/com/lz/modules/performance/req/IndicatorLibraryReq.java b/src/main/java/com/lz/modules/performance/req/IndicatorLibraryReq.java new file mode 100644 index 00000000..2169e519 --- /dev/null +++ b/src/main/java/com/lz/modules/performance/req/IndicatorLibraryReq.java @@ -0,0 +1,22 @@ +package com.lz.modules.performance.req; + +import com.fasterxml.jackson.databind.ser.Serializers; +import com.lz.modules.equipment.entity.model.BasePage; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author: djc + * @Desc: + * @Date: 2021/1/12 14:50 + */ +@Data +public class IndicatorLibraryReq extends BasePage{ + //指标名称 + @ApiModelProperty(value = "指标名称", name = "name") + private String name; + //指标分类 lz_indicator_type 表id + @ApiModelProperty(value = "指标分类 lz_indicator_type 表id", name = "indicatorType") + private Integer indicatorType; + +} diff --git a/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java index 582fa04e..0f49f82d 100644 --- a/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java +++ b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java @@ -1,7 +1,9 @@ package com.lz.modules.performance.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.lz.common.utils.PageUtils; import com.lz.modules.performance.entity.IndicatorLibrary; +import com.lz.modules.performance.req.IndicatorLibraryReq; /** *

@@ -29,5 +31,9 @@ public interface IndicatorLibraryService extends IService { int deleteIndicatorLibraryById(Long id); + PageUtils selectIndicatorLibrarysByReq(IndicatorLibraryReq req); + + void deleteIndicatorLibrarysByIds(String ids); + } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java index c4edd633..34f811bc 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java @@ -1,12 +1,19 @@ package com.lz.modules.performance.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lz.common.utils.PageUtils; +import com.lz.common.utils.StringUtil; import com.lz.modules.performance.dao.IndicatorLibraryMapper; import com.lz.modules.performance.entity.IndicatorLibrary; +import com.lz.modules.performance.req.IndicatorLibraryReq; import com.lz.modules.performance.service.IndicatorLibraryService; +import io.jsonwebtoken.lang.Collections; +import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** *

* (设置)指标库 服务类 @@ -58,6 +65,22 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl indicatorLibraryMapper.selectIndicatorLibrarysByReq(page1,req) + ); + return page; + } + @Override + public void deleteIndicatorLibrarysByIds(String ids) { + if(StringUtil.isBlank(ids)){ + return; + } + String[] split = ids.split(","); + List list = Collections.arrayToList(split); + indicatorLibraryMapper.deleteIndicatorLibrarysByIds(list); + } } diff --git a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml index 368d6e20..c340ead7 100644 --- a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml +++ b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml @@ -23,8 +23,6 @@ - - @@ -93,5 +91,21 @@ update lz_indicator_library set is_delete = 1 where id=#{id} limit 1 + + + + update lz_indicator_library set is_delete = 1 where is_delete = 0 AND + id in + ( + + #{id} + + ) + + + From 26ff04f9a8ad4072697da4bf034364be582f2b51 Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Tue, 12 Jan 2021 18:13:09 +0800 Subject: [PATCH 03/26] fix --- .../controller/IndicatorLibraryController.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java index 6f2fe625..5e74be16 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java @@ -10,6 +10,7 @@ import com.lz.modules.performance.dto.IndicatorLibraryDto; import com.lz.modules.performance.entity.IndicatorLibrary; import com.lz.modules.performance.req.IndicatorLibraryReq; import com.lz.modules.performance.service.IndicatorLibraryService; +import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -25,22 +26,24 @@ public class IndicatorLibraryController { private IndicatorLibraryService indicatorLibraryService; - @RequestMapping("/list") + @PostMapping("/list") public R list(@RequestBody IndicatorLibraryReq req) { PageUtils page = indicatorLibraryService.selectIndicatorLibrarysByReq(req); return R.ok().put("data",page); } - @RequestMapping("/getById") - public R getById(@RequestBody IndicatorLibrary indicatorLibrary) { - indicatorLibrary = indicatorLibraryService.selectIndicatorLibraryById(indicatorLibrary.getId()); - return R.ok().put("indicatorLibrary",indicatorLibrary); + @GetMapping("/getById") + public R getById(@Param("id")Long id) { + IndicatorLibrary indicatorLibrary = indicatorLibraryService.selectIndicatorLibraryById(id); + IndicatorLibraryDto dto = new IndicatorLibraryDto(); + BeanUtil.copyProperties(indicatorLibrary,dto); + return R.ok().put("data",dto); } - @RequestMapping("/saveOrUpdate") + @PostMapping("/saveOrUpdate") public R save(@RequestBody IndicatorLibraryDto dto) { IndicatorLibrary indicatorLibrary = new IndicatorLibrary(); BeanUtil.copyProperties(dto,indicatorLibrary); From 0d87dd9801029748c52debb491467f82ea69da09 Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Wed, 13 Jan 2021 16:14:43 +0800 Subject: [PATCH 04/26] fix --- .../IndicatorLibraryController.java | 37 +++++++++++++++++-- .../controller/IndicatorTypeController.java | 20 +++++++++- .../dao/IndicatorLibraryMapper.java | 2 + .../performance/dao/IndicatorTypeMapper.java | 1 + .../performance/dto/IndicatorLibraryDto.java | 4 ++ .../dto/IndicatorLibraryMoveDto.java | 21 +++++++++++ .../performance/dto/IndicatorTypeDto.java | 5 +++ .../performance/req/IndicatorLibraryReq.java | 2 + .../modules/performance/req/IndicatorReq.java | 2 + .../service/IndicatorLibraryService.java | 3 ++ .../service/IndicatorTypeService.java | 2 + .../impl/IndicatorLibraryServiceImpl.java | 15 ++++++++ .../impl/IndicatorTypeServiceImpl.java | 5 +++ .../performance/IndicatorLibraryMapper.xml | 18 ++++++++- .../performance/IndicatorTypeMapper.xml | 13 ++++++- 15 files changed, 142 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/lz/modules/performance/dto/IndicatorLibraryMoveDto.java diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java index 5e74be16..2cdb0dec 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java @@ -7,9 +7,14 @@ import com.lz.common.utils.PageUtils; import com.lz.common.utils.R; import com.lz.common.utils.StringUtil; import com.lz.modules.performance.dto.IndicatorLibraryDto; +import com.lz.modules.performance.dto.IndicatorLibraryMoveDto; import com.lz.modules.performance.entity.IndicatorLibrary; import com.lz.modules.performance.req.IndicatorLibraryReq; import com.lz.modules.performance.service.IndicatorLibraryService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -17,8 +22,10 @@ import org.springframework.web.bind.annotation.*; import java.util.HashMap; import java.util.Map; +@Slf4j @RestController @RequestMapping("/indicatorLibrary") +@Api(value = "指标相关接口", tags = { "指标相关接口" }) public class IndicatorLibraryController { @@ -27,6 +34,7 @@ public class IndicatorLibraryController { @PostMapping("/list") + @ApiOperation("获取指标列表") public R list(@RequestBody IndicatorLibraryReq req) { PageUtils page = indicatorLibraryService.selectIndicatorLibrarysByReq(req); return R.ok().put("data",page); @@ -34,7 +42,8 @@ public class IndicatorLibraryController { @GetMapping("/getById") - public R getById(@Param("id")Long id) { + @ApiOperation("获取指标") + public R getById(@RequestParam @ApiParam(value = "获取指标id",name = "id")Long id) { IndicatorLibrary indicatorLibrary = indicatorLibraryService.selectIndicatorLibraryById(id); IndicatorLibraryDto dto = new IndicatorLibraryDto(); BeanUtil.copyProperties(indicatorLibrary,dto); @@ -44,7 +53,8 @@ public class IndicatorLibraryController { @PostMapping("/saveOrUpdate") - public R save(@RequestBody IndicatorLibraryDto dto) { + @ApiOperation("保存/修改指标") + public R save(@RequestBody IndicatorLibraryDto dto) { IndicatorLibrary indicatorLibrary = new IndicatorLibrary(); BeanUtil.copyProperties(dto,indicatorLibrary); boolean success = indicatorLibraryService.saveOrUpdate(indicatorLibrary); @@ -56,8 +66,27 @@ public class IndicatorLibraryController { @GetMapping("/delete") - public R delete(@RequestParam String ids) { - indicatorLibraryService.deleteIndicatorLibrarysByIds(ids); + @ApiOperation("删除指标") + public R delete(@RequestParam @ApiParam(value = "指标删除id,逗号隔开",name = "ids") String ids) { + try { + indicatorLibraryService.deleteIndicatorLibrarysByIds(ids); + } catch (Exception e) { + log.error("删除指标异常",e); + return R.error(); + } return R.ok(); } + + + @PostMapping("/move") + @ApiOperation("移动指标") + public R move(@RequestBody IndicatorLibraryMoveDto dto) { + try { + indicatorLibraryService.updateIndicatorLibrarysMove(dto); + } catch (Exception e) { + log.error("移动指标异常",e); + return R.error(); + } + return R.ok(); + } } diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java index 9cb1d485..5c67bab6 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java @@ -4,17 +4,22 @@ package com.lz.modules.performance.controller; import cn.hutool.core.bean.BeanUtil; import com.lz.common.utils.PageUtils; import com.lz.common.utils.R; +import com.lz.common.utils.StringUtil; import com.lz.modules.performance.dto.IndicatorTypeDto; import com.lz.modules.performance.entity.IndicatorType; import com.lz.modules.performance.req.IndicatorReq; import com.lz.modules.performance.service.IndicatorTypeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/indicatorType") +@Api(value = "指标分类相关接口", tags = { "指标分类相关接口" }) public class IndicatorTypeController { @@ -22,7 +27,8 @@ public class IndicatorTypeController { private IndicatorTypeService indicatorTypeService; - @RequestMapping("/list") + @PostMapping("/list") + @ApiOperation("获取分类/类型列表") public R list(@RequestBody IndicatorReq req) { PageUtils page = indicatorTypeService.selectIndicatorTypesByReq(req); return R.ok().put("data", page); @@ -30,8 +36,18 @@ public class IndicatorTypeController { - @RequestMapping("/saveOrUpdate") + @ApiOperation("保存/修改分类") + @PostMapping("/saveOrUpdate") public R save(@RequestBody IndicatorTypeDto dto) { + if(dto.getId()==null){ + if(StringUtil.isBlank(dto.getName())){ + return R.error("分类名称不能为空"); + } + IndicatorType indicatorType = indicatorTypeService.selectIndicatorTypeByName(dto.getName()); + if(indicatorType!=null){ + return R.error("分类名称重复"); + } + } IndicatorType indicatorType = new IndicatorType(); BeanUtil.copyProperties(dto,indicatorType); boolean success = indicatorTypeService.saveOrUpdate(indicatorType); diff --git a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java index bfd2d7d8..a3729213 100644 --- a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java +++ b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java @@ -39,4 +39,6 @@ public interface IndicatorLibraryMapper extends BaseMapper { void deleteIndicatorLibrarysByIds(@Param("ids") List ids); + void updateIndicatorLibrarysMove(@Param("ids")List ids,@Param("indicatorType")Long indicatorType); + } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/dao/IndicatorTypeMapper.java b/src/main/java/com/lz/modules/performance/dao/IndicatorTypeMapper.java index cec45492..b4f7aec4 100644 --- a/src/main/java/com/lz/modules/performance/dao/IndicatorTypeMapper.java +++ b/src/main/java/com/lz/modules/performance/dao/IndicatorTypeMapper.java @@ -38,6 +38,7 @@ public interface IndicatorTypeMapper extends BaseMapper { List selectIndicatorTypesByReq(@Param("page") IPage page, @Param("req")IndicatorReq req); + IndicatorType selectIndicatorTypeByName(@Param("name") String name); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java b/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java index 3755afa9..6f7f0171 100644 --- a/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java +++ b/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java @@ -2,7 +2,9 @@ package com.lz.modules.performance.dto; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; import java.math.BigDecimal; @@ -11,6 +13,8 @@ import java.math.BigDecimal; * @Desc: * @Date: 2021/1/12 14:41 */ +@Data +@ApiModel("指标保存/修改实体") public class IndicatorLibraryDto { // @TableId(value = "id", type = IdType.AUTO) diff --git a/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryMoveDto.java b/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryMoveDto.java new file mode 100644 index 00000000..4b446658 --- /dev/null +++ b/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryMoveDto.java @@ -0,0 +1,21 @@ +package com.lz.modules.performance.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author: djc + * @Desc: + * @Date: 2021/1/13 11:38 + */ +@Data +@ApiModel("移动指标实体") +public class IndicatorLibraryMoveDto { + @ApiModelProperty(value = "移动的id,逗号隔开",name = "ids") + private String ids; + + @ApiModelProperty(value = "要移动的目标分类",name = "indicatorType") + private Long indicatorType; + +} diff --git a/src/main/java/com/lz/modules/performance/dto/IndicatorTypeDto.java b/src/main/java/com/lz/modules/performance/dto/IndicatorTypeDto.java index a4dc3542..3dbca138 100644 --- a/src/main/java/com/lz/modules/performance/dto/IndicatorTypeDto.java +++ b/src/main/java/com/lz/modules/performance/dto/IndicatorTypeDto.java @@ -1,5 +1,6 @@ package com.lz.modules.performance.dto; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -9,6 +10,7 @@ import lombok.Data; * @Date: 2021/1/12 10:21 */ @Data +@ApiModel("保存/修改分类实体") public class IndicatorTypeDto { @ApiModelProperty(value = "id", name = "id") @@ -16,6 +18,9 @@ public class IndicatorTypeDto { //指标名称 @ApiModelProperty(value = "指标分类名称", name = "name") private String name; + //指标名称 + @ApiModelProperty(value = "类型0: 指标分类 1:指标类型", name = "type") + private Integer type; //排序 @ApiModelProperty(value = "排序(非必须)", name = "orderBy") private Integer orderBy; diff --git a/src/main/java/com/lz/modules/performance/req/IndicatorLibraryReq.java b/src/main/java/com/lz/modules/performance/req/IndicatorLibraryReq.java index 2169e519..85d27fe3 100644 --- a/src/main/java/com/lz/modules/performance/req/IndicatorLibraryReq.java +++ b/src/main/java/com/lz/modules/performance/req/IndicatorLibraryReq.java @@ -2,6 +2,7 @@ package com.lz.modules.performance.req; import com.fasterxml.jackson.databind.ser.Serializers; import com.lz.modules.equipment.entity.model.BasePage; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -11,6 +12,7 @@ import lombok.Data; * @Date: 2021/1/12 14:50 */ @Data +@ApiModel("获取指标列表实体") public class IndicatorLibraryReq extends BasePage{ //指标名称 @ApiModelProperty(value = "指标名称", name = "name") diff --git a/src/main/java/com/lz/modules/performance/req/IndicatorReq.java b/src/main/java/com/lz/modules/performance/req/IndicatorReq.java index a53b6e3b..7cf8abf5 100644 --- a/src/main/java/com/lz/modules/performance/req/IndicatorReq.java +++ b/src/main/java/com/lz/modules/performance/req/IndicatorReq.java @@ -1,6 +1,7 @@ package com.lz.modules.performance.req; import com.lz.modules.equipment.entity.model.BasePage; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -10,6 +11,7 @@ import lombok.Data; * @Date: 2021/1/12 11:39 */ @Data +@ApiModel("获取分类/类型实体") public class IndicatorReq extends BasePage{ //指标名称 @ApiModelProperty(value = "指标分类名称", name = "name") diff --git a/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java index 0f49f82d..a4e61b5b 100644 --- a/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java +++ b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java @@ -2,6 +2,7 @@ package com.lz.modules.performance.service; import com.baomidou.mybatisplus.extension.service.IService; import com.lz.common.utils.PageUtils; +import com.lz.modules.performance.dto.IndicatorLibraryMoveDto; import com.lz.modules.performance.entity.IndicatorLibrary; import com.lz.modules.performance.req.IndicatorLibraryReq; @@ -35,5 +36,7 @@ public interface IndicatorLibraryService extends IService { void deleteIndicatorLibrarysByIds(String ids); + void updateIndicatorLibrarysMove(IndicatorLibraryMoveDto dto); + } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/service/IndicatorTypeService.java b/src/main/java/com/lz/modules/performance/service/IndicatorTypeService.java index 84705fb3..f652ec99 100644 --- a/src/main/java/com/lz/modules/performance/service/IndicatorTypeService.java +++ b/src/main/java/com/lz/modules/performance/service/IndicatorTypeService.java @@ -33,5 +33,7 @@ public interface IndicatorTypeService extends IService { PageUtils selectIndicatorTypesByReq(IndicatorReq req); + IndicatorType selectIndicatorTypeByName(String name); + } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java index 34f811bc..040009bf 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java @@ -1,9 +1,11 @@ package com.lz.modules.performance.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Lists; import com.lz.common.utils.PageUtils; import com.lz.common.utils.StringUtil; import com.lz.modules.performance.dao.IndicatorLibraryMapper; +import com.lz.modules.performance.dto.IndicatorLibraryMoveDto; import com.lz.modules.performance.entity.IndicatorLibrary; import com.lz.modules.performance.req.IndicatorLibraryReq; import com.lz.modules.performance.service.IndicatorLibraryService; @@ -12,6 +14,7 @@ import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Arrays; import java.util.List; /** @@ -83,4 +86,16 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl select id ,name,type,indicator_type, weight, key_result, sort from lz_indicator_library - where name LIKE CONCAT('%',#{req.name},'%') and indicator_type = #{req.indicatorType} and is_delete = 0 order by sort + where is_delete = 0 + + and name LIKE CONCAT('%',#{req.name},'%') + + + and indicator_type = #{req.indicatorType} + + order by sort @@ -105,6 +112,15 @@ ) + + update lz_indicator_library set indicator_type = #{indicatorType} where is_delete = 0 AND + id in + ( + + #{id} + + ) + diff --git a/src/main/resources/mapper/performance/IndicatorTypeMapper.xml b/src/main/resources/mapper/performance/IndicatorTypeMapper.xml index ec89a785..ec5fa83f 100644 --- a/src/main/resources/mapper/performance/IndicatorTypeMapper.xml +++ b/src/main/resources/mapper/performance/IndicatorTypeMapper.xml @@ -80,7 +80,18 @@ + + From 91b1555d95056dd2d79307b5298c06758df6e6f9 Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Thu, 14 Jan 2021 10:48:49 +0800 Subject: [PATCH 05/26] fix --- .../IndicatorLibraryController.java | 15 +++++++++++---- .../controller/IndicatorTypeController.java | 9 ++++----- .../dao/IndicatorLibraryMapper.java | 2 ++ .../dto/StatisticalIndicatorTypeDto.java | 19 +++++++++++++++++++ .../service/IndicatorLibraryService.java | 5 +++++ .../impl/IndicatorLibraryServiceImpl.java | 10 ++++++++++ .../performance/IndicatorLibraryMapper.xml | 7 +++++++ 7 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/lz/modules/performance/dto/StatisticalIndicatorTypeDto.java diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java index 2cdb0dec..68ce5428 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java @@ -55,13 +55,13 @@ public class IndicatorLibraryController { @PostMapping("/saveOrUpdate") @ApiOperation("保存/修改指标") public R save(@RequestBody IndicatorLibraryDto dto) { + IndicatorLibrary indicatorLibrary = new IndicatorLibrary(); BeanUtil.copyProperties(dto,indicatorLibrary); boolean success = indicatorLibraryService.saveOrUpdate(indicatorLibrary); - if(!success){ - return R.error(); - } - return R.ok(); + + return success ? R.ok():R.error(); + } @@ -89,4 +89,11 @@ public class IndicatorLibraryController { } return R.ok(); } + + @PostMapping("/statistical") + @ApiOperation("统计指标") + public R statistical() { + //indicatorLibraryService + return R.ok(); + } } diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java index 5c67bab6..dfcd1d06 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java @@ -50,10 +50,9 @@ public class IndicatorTypeController { } IndicatorType indicatorType = new IndicatorType(); BeanUtil.copyProperties(dto,indicatorType); - boolean success = indicatorTypeService.saveOrUpdate(indicatorType); - if(!success){ - return R.error(); - } - return R.ok(); + boolean success = indicatorTypeService.saveOrUpdate(indicatorType); + + return success ? R.ok():R.error(); + } } diff --git a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java index a3729213..dc3b43e0 100644 --- a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java +++ b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java @@ -10,6 +10,7 @@ package com.lz.modules.performance.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.lz.modules.performance.dto.IndicatorLibraryDto; +import com.lz.modules.performance.dto.StatisticalIndicatorTypeDto; import com.lz.modules.performance.entity.IndicatorLibrary; import com.lz.modules.performance.req.IndicatorLibraryReq; import org.apache.ibatis.annotations.Mapper; @@ -41,4 +42,5 @@ public interface IndicatorLibraryMapper extends BaseMapper { void updateIndicatorLibrarysMove(@Param("ids")List ids,@Param("indicatorType")Long indicatorType); + List statisticalByIndicatorType(); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/dto/StatisticalIndicatorTypeDto.java b/src/main/java/com/lz/modules/performance/dto/StatisticalIndicatorTypeDto.java new file mode 100644 index 00000000..b78ff59e --- /dev/null +++ b/src/main/java/com/lz/modules/performance/dto/StatisticalIndicatorTypeDto.java @@ -0,0 +1,19 @@ +package com.lz.modules.performance.dto; + +import com.lz.modules.performance.entity.IndicatorType; +import lombok.Data; + +/** + * @Author: djc + * @Desc: + * @Date: 2021/1/13 17:20 + */ +@Data +public class StatisticalIndicatorTypeDto { + + private String name; + + private Integer indicatorType; + + private int count; +} diff --git a/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java index a4e61b5b..524552c9 100644 --- a/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java +++ b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java @@ -3,9 +3,12 @@ package com.lz.modules.performance.service; import com.baomidou.mybatisplus.extension.service.IService; import com.lz.common.utils.PageUtils; import com.lz.modules.performance.dto.IndicatorLibraryMoveDto; +import com.lz.modules.performance.dto.StatisticalIndicatorTypeDto; import com.lz.modules.performance.entity.IndicatorLibrary; import com.lz.modules.performance.req.IndicatorLibraryReq; +import java.util.List; + /** *

* (设置)指标库 服务类 @@ -38,5 +41,7 @@ public interface IndicatorLibraryService extends IService { void updateIndicatorLibrarysMove(IndicatorLibraryMoveDto dto); + List statisticalByIndicatorType(); + } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java index 040009bf..a139aa05 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java @@ -6,6 +6,7 @@ import com.lz.common.utils.PageUtils; import com.lz.common.utils.StringUtil; import com.lz.modules.performance.dao.IndicatorLibraryMapper; import com.lz.modules.performance.dto.IndicatorLibraryMoveDto; +import com.lz.modules.performance.dto.StatisticalIndicatorTypeDto; import com.lz.modules.performance.entity.IndicatorLibrary; import com.lz.modules.performance.req.IndicatorLibraryReq; import com.lz.modules.performance.service.IndicatorLibraryService; @@ -98,4 +99,13 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl statisticalByIndicatorType() { + List dtos = indicatorLibraryMapper.statisticalByIndicatorType(); + for(StatisticalIndicatorTypeDto dto:dtos){ + + } + return null; + } } diff --git a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml index b2e424d4..dc72521b 100644 --- a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml +++ b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml @@ -123,5 +123,12 @@ + + + From 37b6a34b7ab15466a6819b7b77634ccd6b67ce59 Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Thu, 14 Jan 2021 16:02:29 +0800 Subject: [PATCH 06/26] fix --- .../IndicatorLibraryController.java | 24 ++++++++++++++++--- .../impl/IndicatorLibraryServiceImpl.java | 14 ++++++++--- .../performance/IndicatorLibraryMapper.xml | 5 ++-- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java index 68ce5428..fa5d6aba 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java @@ -8,6 +8,7 @@ import com.lz.common.utils.R; import com.lz.common.utils.StringUtil; import com.lz.modules.performance.dto.IndicatorLibraryDto; import com.lz.modules.performance.dto.IndicatorLibraryMoveDto; +import com.lz.modules.performance.dto.StatisticalIndicatorTypeDto; import com.lz.modules.performance.entity.IndicatorLibrary; import com.lz.modules.performance.req.IndicatorLibraryReq; import com.lz.modules.performance.service.IndicatorLibraryService; @@ -15,12 +16,29 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; +import org.aopalliance.aop.Advice; import org.apache.ibatis.annotations.Param; +import org.springframework.aop.Advisor; +import org.springframework.aop.AfterReturningAdvice; +import org.springframework.aop.framework.adapter.AdvisorAdapter; +import org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor; +import org.springframework.aop.framework.adapter.UnknownAdviceTypeException; +import org.springframework.aop.support.DefaultPointcutAdvisor; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.*; +import javax.annotation.PostConstruct; +import java.io.Serializable; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; @Slf4j @RestController @@ -55,7 +73,6 @@ public class IndicatorLibraryController { @PostMapping("/saveOrUpdate") @ApiOperation("保存/修改指标") public R save(@RequestBody IndicatorLibraryDto dto) { - IndicatorLibrary indicatorLibrary = new IndicatorLibrary(); BeanUtil.copyProperties(dto,indicatorLibrary); boolean success = indicatorLibraryService.saveOrUpdate(indicatorLibrary); @@ -93,7 +110,8 @@ public class IndicatorLibraryController { @PostMapping("/statistical") @ApiOperation("统计指标") public R statistical() { - //indicatorLibraryService - return R.ok(); + List dtos = indicatorLibraryService.statisticalByIndicatorType(); + return R.ok().put("data",dtos); } } + diff --git a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java index a139aa05..4a510c1b 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java @@ -17,6 +17,8 @@ import org.springframework.stereotype.Service; import java.util.Arrays; import java.util.List; +import java.util.Optional; +import java.util.function.ToDoubleFunction; /** *

@@ -103,9 +105,15 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl statisticalByIndicatorType() { List dtos = indicatorLibraryMapper.statisticalByIndicatorType(); - for(StatisticalIndicatorTypeDto dto:dtos){ - + StatisticalIndicatorTypeDto dto = new StatisticalIndicatorTypeDto(); + dto.setName("全部分类"); + dto.setIndicatorType(null); + if(CollectionUtils.isNotEmpty(dtos)){ + double sum = dtos.stream().mapToDouble(value -> value.getCount()).sum(); + dto.setCount(Double.valueOf(sum).intValue()); } - return null; + //加入首位 + dtos.add(0,dto); + return dtos; } } diff --git a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml index dc72521b..0eae2f7a 100644 --- a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml +++ b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml @@ -125,8 +125,9 @@ From 3b261f2d6d46a67ea71115c63436fcceadbd516b Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Thu, 14 Jan 2021 16:43:18 +0800 Subject: [PATCH 07/26] fix --- .../performance/controller/IndicatorLibraryController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java index fa5d6aba..3ff4e233 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java @@ -3,6 +3,7 @@ package com.lz.modules.performance.controller; import cn.hutool.core.bean.BeanUtil; import com.alibaba.fastjson.JSONObject; +import com.google.common.collect.Maps; import com.lz.common.utils.PageUtils; import com.lz.common.utils.R; import com.lz.common.utils.StringUtil; @@ -38,6 +39,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Function; import java.util.stream.Collectors; @Slf4j @@ -113,5 +115,4 @@ public class IndicatorLibraryController { List dtos = indicatorLibraryService.statisticalByIndicatorType(); return R.ok().put("data",dtos); } -} - +} \ No newline at end of file From 9b91874ff2e7128e65c6f4ba851638dd3548b7f4 Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Tue, 19 Jan 2021 15:12:59 +0800 Subject: [PATCH 08/26] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8C=87=E6=A0=87?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/IndicatorTypeController.java | 27 ++++++++++++++++--- .../dao/IndicatorLibraryMapper.java | 2 ++ .../service/IndicatorLibraryService.java | 2 ++ .../impl/IndicatorLibraryServiceImpl.java | 5 ++++ .../performance/IndicatorLibraryMapper.xml | 5 ++++ 5 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java index dfcd1d06..6a3c863c 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java @@ -8,15 +8,16 @@ import com.lz.common.utils.StringUtil; import com.lz.modules.performance.dto.IndicatorTypeDto; import com.lz.modules.performance.entity.IndicatorType; import com.lz.modules.performance.req.IndicatorReq; +import com.lz.modules.performance.service.IndicatorLibraryService; import com.lz.modules.performance.service.IndicatorTypeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; +@Slf4j @RestController @RequestMapping("/indicatorType") @Api(value = "指标分类相关接口", tags = { "指标分类相关接口" }) @@ -25,6 +26,8 @@ public class IndicatorTypeController { @Autowired private IndicatorTypeService indicatorTypeService; + @Autowired + private IndicatorLibraryService indicatorLibraryService; @PostMapping("/list") @@ -55,4 +58,20 @@ public class IndicatorTypeController { return success ? R.ok():R.error(); } + + + @GetMapping("/delete") + @ApiOperation("删除指标分类") + public R delete(@RequestParam @ApiParam(value = "删除指标分类id",name = "id") Long id) { + try { + indicatorTypeService.deleteIndicatorTypeById(id); + indicatorLibraryService.deleteIndicatorLibrarysIndicatorType(id.intValue()); + + } catch (Exception e) { + log.error("删除指标异常",e); + return R.error(); + } + return R.ok(); + } + } diff --git a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java index dc3b43e0..13e30455 100644 --- a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java +++ b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java @@ -43,4 +43,6 @@ public interface IndicatorLibraryMapper extends BaseMapper { void updateIndicatorLibrarysMove(@Param("ids")List ids,@Param("indicatorType")Long indicatorType); List statisticalByIndicatorType(); + + int deleteIndicatorLibrarysByIndicatorType(@Param("indicatorType") Integer indicatorType); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java index 524552c9..97acce4b 100644 --- a/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java +++ b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java @@ -43,5 +43,7 @@ public interface IndicatorLibraryService extends IService { List statisticalByIndicatorType(); + int deleteIndicatorLibrarysIndicatorType(Integer indicatorType); + } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java index 4a510c1b..59f53118 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java @@ -116,4 +116,9 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl + + update lz_indicator_library set is_delete = 1 where indicator_type=#{indicatorType} + + + From b81cc494012e23b75a158467d26bef678d509c41 Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Tue, 19 Jan 2021 16:18:37 +0800 Subject: [PATCH 09/26] fix --- .../controller/IndicatorLibraryController.java | 6 +++--- .../modules/performance/dao/IndicatorLibraryMapper.java | 2 +- .../performance/service/IndicatorLibraryService.java | 2 +- .../service/impl/IndicatorLibraryServiceImpl.java | 4 ++-- .../mapper/performance/IndicatorLibraryMapper.xml | 9 ++++++--- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java index 3ff4e233..fbfcbd81 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java @@ -109,10 +109,10 @@ public class IndicatorLibraryController { return R.ok(); } - @PostMapping("/statistical") + @GetMapping("/statistical") @ApiOperation("统计指标") - public R statistical() { - List dtos = indicatorLibraryService.statisticalByIndicatorType(); + public R statistical(@RequestParam("indicatorType") @ApiParam(value = "指标分类id",name = "indicatorType") Long indicatorType) { + List dtos = indicatorLibraryService.statisticalByIndicatorType(indicatorType); return R.ok().put("data",dtos); } } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java index 13e30455..c446191c 100644 --- a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java +++ b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java @@ -42,7 +42,7 @@ public interface IndicatorLibraryMapper extends BaseMapper { void updateIndicatorLibrarysMove(@Param("ids")List ids,@Param("indicatorType")Long indicatorType); - List statisticalByIndicatorType(); + List statisticalByIndicatorType(Long indicatorType); int deleteIndicatorLibrarysByIndicatorType(@Param("indicatorType") Integer indicatorType); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java index 97acce4b..2898bc29 100644 --- a/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java +++ b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java @@ -41,7 +41,7 @@ public interface IndicatorLibraryService extends IService { void updateIndicatorLibrarysMove(IndicatorLibraryMoveDto dto); - List statisticalByIndicatorType(); + List statisticalByIndicatorType(Long indicatorType); int deleteIndicatorLibrarysIndicatorType(Integer indicatorType); diff --git a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java index 59f53118..83ab7e14 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java @@ -103,8 +103,8 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl statisticalByIndicatorType() { - List dtos = indicatorLibraryMapper.statisticalByIndicatorType(); + public List statisticalByIndicatorType(Long indicatorType) { + List dtos = indicatorLibraryMapper.statisticalByIndicatorType(indicatorType); StatisticalIndicatorTypeDto dto = new StatisticalIndicatorTypeDto(); dto.setName("全部分类"); dto.setIndicatorType(null); diff --git a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml index 0d68742b..f539794c 100644 --- a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml +++ b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml @@ -125,9 +125,12 @@ From ad2bdac0b5ce9c29a953ea970d5ed156bb390e76 Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Tue, 19 Jan 2021 17:42:58 +0800 Subject: [PATCH 10/26] fix --- .../controller/IndicatorLibraryController.java | 2 +- .../modules/performance/dao/IndicatorLibraryMapper.java | 4 ++++ .../service/impl/IndicatorLibraryServiceImpl.java | 8 ++++++++ .../mapper/performance/IndicatorLibraryMapper.xml | 5 +++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java index fbfcbd81..25ce047e 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java @@ -111,7 +111,7 @@ public class IndicatorLibraryController { @GetMapping("/statistical") @ApiOperation("统计指标") - public R statistical(@RequestParam("indicatorType") @ApiParam(value = "指标分类id",name = "indicatorType") Long indicatorType) { + public R statistical(@RequestParam(name = "indicatorType",required = false) @ApiParam(value = "指标分类id",name = "indicatorType") Long indicatorType) { List dtos = indicatorLibraryService.statisticalByIndicatorType(indicatorType); return R.ok().put("data",dtos); } diff --git a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java index c446191c..7dde2eab 100644 --- a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java +++ b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java @@ -45,4 +45,8 @@ public interface IndicatorLibraryMapper extends BaseMapper { List statisticalByIndicatorType(Long indicatorType); int deleteIndicatorLibrarysByIndicatorType(@Param("indicatorType") Integer indicatorType); + + int countIndicatorLibrarysByIndicatorType(@Param("indicatorType") Integer indicatorType); + + } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java index 83ab7e14..0326f2ac 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java @@ -114,6 +114,14 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl0){ + dtos.add(0,dto); + } return dtos; } diff --git a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml index f539794c..ec609282 100644 --- a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml +++ b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml @@ -139,5 +139,10 @@ + + + From 0e43d5b9dc9531b252d310d8bdb0fc621991a5c5 Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Wed, 20 Jan 2021 11:07:32 +0800 Subject: [PATCH 11/26] fix --- .../impl/IndicatorLibraryServiceImpl.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java index 0326f2ac..23851cae 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java @@ -106,6 +106,15 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl statisticalByIndicatorType(Long indicatorType) { List dtos = indicatorLibraryMapper.statisticalByIndicatorType(indicatorType); StatisticalIndicatorTypeDto dto = new StatisticalIndicatorTypeDto(); + dto.setName("未分类指标"); + dto.setIndicatorType(0); + int count = indicatorLibraryMapper.countIndicatorLibrarysByIndicatorType(0); + dto.setCount(count); + if(count>0){ + dtos.add(dto); + } + + dto = new StatisticalIndicatorTypeDto(); dto.setName("全部分类"); dto.setIndicatorType(null); if(CollectionUtils.isNotEmpty(dtos)){ @@ -114,14 +123,7 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl0){ - dtos.add(0,dto); - } + return dtos; } From 1ed80a054e6754bb2a3f77e859ad6d39aaf3f09a Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Wed, 20 Jan 2021 11:26:39 +0800 Subject: [PATCH 12/26] fix --- .../controller/IndicatorLibraryController.java | 6 +++--- .../performance/dto/StatisticalIndicatorTypeDto.java | 9 +++++++++ .../service/impl/IndicatorLibraryServiceImpl.java | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java index 25ce047e..889709d7 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java @@ -7,15 +7,14 @@ import com.google.common.collect.Maps; import com.lz.common.utils.PageUtils; import com.lz.common.utils.R; import com.lz.common.utils.StringUtil; +import com.lz.modules.flow.entity.FlowStart; import com.lz.modules.performance.dto.IndicatorLibraryDto; import com.lz.modules.performance.dto.IndicatorLibraryMoveDto; import com.lz.modules.performance.dto.StatisticalIndicatorTypeDto; import com.lz.modules.performance.entity.IndicatorLibrary; import com.lz.modules.performance.req.IndicatorLibraryReq; import com.lz.modules.performance.service.IndicatorLibraryService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import org.aopalliance.aop.Advice; import org.apache.ibatis.annotations.Param; @@ -111,6 +110,7 @@ public class IndicatorLibraryController { @GetMapping("/statistical") @ApiOperation("统计指标") + @ApiResponses({@ApiResponse(code = 200, message = "成功", response = StatisticalIndicatorTypeDto.class)}) public R statistical(@RequestParam(name = "indicatorType",required = false) @ApiParam(value = "指标分类id",name = "indicatorType") Long indicatorType) { List dtos = indicatorLibraryService.statisticalByIndicatorType(indicatorType); return R.ok().put("data",dtos); diff --git a/src/main/java/com/lz/modules/performance/dto/StatisticalIndicatorTypeDto.java b/src/main/java/com/lz/modules/performance/dto/StatisticalIndicatorTypeDto.java index b78ff59e..a70c1603 100644 --- a/src/main/java/com/lz/modules/performance/dto/StatisticalIndicatorTypeDto.java +++ b/src/main/java/com/lz/modules/performance/dto/StatisticalIndicatorTypeDto.java @@ -1,6 +1,8 @@ package com.lz.modules.performance.dto; import com.lz.modules.performance.entity.IndicatorType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -9,11 +11,18 @@ import lombok.Data; * @Date: 2021/1/13 17:20 */ @Data +@ApiModel("统计响应实体") public class StatisticalIndicatorTypeDto { + @ApiModelProperty(value = "名称",name = "name") private String name; + @ApiModelProperty(value = "类型",name = "indicatorType") private Integer indicatorType; + @ApiModelProperty(value = "个数",name = "count") private int count; + + @ApiModelProperty(value = "是否可以删除 0:可以 1:不可以",name = "delete") + private int delete; } diff --git a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java index 23851cae..c6baa6fd 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java @@ -108,6 +108,7 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl0){ @@ -117,6 +118,7 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl value.getCount()).sum(); dto.setCount(Double.valueOf(sum).intValue()); From c74d643f2fcbda3fd0d4b56fc25108c0a9e2bf25 Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Wed, 20 Jan 2021 16:38:16 +0800 Subject: [PATCH 13/26] fix --- .../mapper/performance/IndicatorLibraryMapper.xml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml index ec609282..99b4d26d 100644 --- a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml +++ b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml @@ -125,12 +125,14 @@ From f2f2669ece254b99f3fdea29a51a33e4267d9d33 Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Wed, 20 Jan 2021 17:29:13 +0800 Subject: [PATCH 14/26] fix --- .../IndicatorLibraryController.java | 32 +++---------------- .../controller/IndicatorTypeController.java | 8 ++--- .../dao/IndicatorLibraryMapper.java | 4 +-- .../performance/req/IndicatorLibraryReq.java | 4 +++ .../performance/res/IndicatorTypeRes.java | 27 ++++++++++++++++ .../StatisticalIndicatorTypeRes.java} | 6 ++-- .../service/IndicatorLibraryService.java | 4 +-- .../impl/IndicatorLibraryServiceImpl.java | 14 +++----- .../performance/IndicatorLibraryMapper.xml | 18 +++++++---- 9 files changed, 63 insertions(+), 54 deletions(-) create mode 100644 src/main/java/com/lz/modules/performance/res/IndicatorTypeRes.java rename src/main/java/com/lz/modules/performance/{dto/StatisticalIndicatorTypeDto.java => res/StatisticalIndicatorTypeRes.java} (79%) diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java index 889709d7..a836f73a 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java @@ -2,44 +2,20 @@ package com.lz.modules.performance.controller; import cn.hutool.core.bean.BeanUtil; -import com.alibaba.fastjson.JSONObject; -import com.google.common.collect.Maps; import com.lz.common.utils.PageUtils; import com.lz.common.utils.R; -import com.lz.common.utils.StringUtil; -import com.lz.modules.flow.entity.FlowStart; import com.lz.modules.performance.dto.IndicatorLibraryDto; import com.lz.modules.performance.dto.IndicatorLibraryMoveDto; -import com.lz.modules.performance.dto.StatisticalIndicatorTypeDto; +import com.lz.modules.performance.res.StatisticalIndicatorTypeRes; import com.lz.modules.performance.entity.IndicatorLibrary; import com.lz.modules.performance.req.IndicatorLibraryReq; import com.lz.modules.performance.service.IndicatorLibraryService; import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; -import org.aopalliance.aop.Advice; -import org.apache.ibatis.annotations.Param; -import org.springframework.aop.Advisor; -import org.springframework.aop.AfterReturningAdvice; -import org.springframework.aop.framework.adapter.AdvisorAdapter; -import org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor; -import org.springframework.aop.framework.adapter.UnknownAdviceTypeException; -import org.springframework.aop.support.DefaultPointcutAdvisor; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.*; -import javax.annotation.PostConstruct; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; @Slf4j @RestController @@ -110,9 +86,9 @@ public class IndicatorLibraryController { @GetMapping("/statistical") @ApiOperation("统计指标") - @ApiResponses({@ApiResponse(code = 200, message = "成功", response = StatisticalIndicatorTypeDto.class)}) - public R statistical(@RequestParam(name = "indicatorType",required = false) @ApiParam(value = "指标分类id",name = "indicatorType") Long indicatorType) { - List dtos = indicatorLibraryService.statisticalByIndicatorType(indicatorType); + @ApiResponses({@ApiResponse(code = 200, message = "成功", response = StatisticalIndicatorTypeRes.class)}) + public R statistical(@RequestParam(name = "type",required = false) @ApiParam(value = "指标分类id",name = "type") Long type) { + List dtos = indicatorLibraryService.statisticalByType(type); return R.ok().put("data",dtos); } } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java index 6a3c863c..5aff7bf6 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java @@ -8,11 +8,10 @@ import com.lz.common.utils.StringUtil; import com.lz.modules.performance.dto.IndicatorTypeDto; import com.lz.modules.performance.entity.IndicatorType; import com.lz.modules.performance.req.IndicatorReq; +import com.lz.modules.performance.res.IndicatorTypeRes; import com.lz.modules.performance.service.IndicatorLibraryService; import com.lz.modules.performance.service.IndicatorTypeService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -32,7 +31,8 @@ public class IndicatorTypeController { @PostMapping("/list") @ApiOperation("获取分类/类型列表") - public R list(@RequestBody IndicatorReq req) { + @ApiResponses({@ApiResponse(code = 200, message = "成功", response = IndicatorTypeRes.class)}) + public R list(@RequestBody IndicatorReq req) { PageUtils page = indicatorTypeService.selectIndicatorTypesByReq(req); return R.ok().put("data", page); } diff --git a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java index 7dde2eab..48f62c85 100644 --- a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java +++ b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java @@ -10,7 +10,7 @@ package com.lz.modules.performance.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.lz.modules.performance.dto.IndicatorLibraryDto; -import com.lz.modules.performance.dto.StatisticalIndicatorTypeDto; +import com.lz.modules.performance.res.StatisticalIndicatorTypeRes; import com.lz.modules.performance.entity.IndicatorLibrary; import com.lz.modules.performance.req.IndicatorLibraryReq; import org.apache.ibatis.annotations.Mapper; @@ -42,7 +42,7 @@ public interface IndicatorLibraryMapper extends BaseMapper { void updateIndicatorLibrarysMove(@Param("ids")List ids,@Param("indicatorType")Long indicatorType); - List statisticalByIndicatorType(Long indicatorType); + List statisticalByType(Long type); int deleteIndicatorLibrarysByIndicatorType(@Param("indicatorType") Integer indicatorType); diff --git a/src/main/java/com/lz/modules/performance/req/IndicatorLibraryReq.java b/src/main/java/com/lz/modules/performance/req/IndicatorLibraryReq.java index 85d27fe3..02453f03 100644 --- a/src/main/java/com/lz/modules/performance/req/IndicatorLibraryReq.java +++ b/src/main/java/com/lz/modules/performance/req/IndicatorLibraryReq.java @@ -21,4 +21,8 @@ public class IndicatorLibraryReq extends BasePage{ @ApiModelProperty(value = "指标分类 lz_indicator_type 表id", name = "indicatorType") private Integer indicatorType; + //指标分类 lz_indicator_type 表id + @ApiModelProperty(value = "指标类型 lz_indicator_type 表id", name = "type") + private Integer type; + } diff --git a/src/main/java/com/lz/modules/performance/res/IndicatorTypeRes.java b/src/main/java/com/lz/modules/performance/res/IndicatorTypeRes.java new file mode 100644 index 00000000..068e7454 --- /dev/null +++ b/src/main/java/com/lz/modules/performance/res/IndicatorTypeRes.java @@ -0,0 +1,27 @@ +package com.lz.modules.performance.res; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author: djc + * @Desc: + * @Date: 2021/1/12 10:21 + */ +@Data +@ApiModel("分类响应实体") +public class IndicatorTypeRes { + + @ApiModelProperty(value = "id 分类或类型标识", name = "id") + private Long id; + //指标名称 + @ApiModelProperty(value = "指标分类名称", name = "name") + private String name; + //指标名称 + @ApiModelProperty(value = "类型0: 指标分类 1:指标类型", name = "type") + private Integer type; + //排序 + @ApiModelProperty(value = "排序(非必须)", name = "orderBy") + private Integer orderBy; +} diff --git a/src/main/java/com/lz/modules/performance/dto/StatisticalIndicatorTypeDto.java b/src/main/java/com/lz/modules/performance/res/StatisticalIndicatorTypeRes.java similarity index 79% rename from src/main/java/com/lz/modules/performance/dto/StatisticalIndicatorTypeDto.java rename to src/main/java/com/lz/modules/performance/res/StatisticalIndicatorTypeRes.java index a70c1603..f2d2c6d7 100644 --- a/src/main/java/com/lz/modules/performance/dto/StatisticalIndicatorTypeDto.java +++ b/src/main/java/com/lz/modules/performance/res/StatisticalIndicatorTypeRes.java @@ -1,4 +1,4 @@ -package com.lz.modules.performance.dto; +package com.lz.modules.performance.res; import com.lz.modules.performance.entity.IndicatorType; import io.swagger.annotations.ApiModel; @@ -12,12 +12,12 @@ import lombok.Data; */ @Data @ApiModel("统计响应实体") -public class StatisticalIndicatorTypeDto { +public class StatisticalIndicatorTypeRes { @ApiModelProperty(value = "名称",name = "name") private String name; - @ApiModelProperty(value = "类型",name = "indicatorType") + @ApiModelProperty(value = "分类",name = "indicatorType") private Integer indicatorType; @ApiModelProperty(value = "个数",name = "count") diff --git a/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java index 2898bc29..2a8f09ee 100644 --- a/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java +++ b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java @@ -3,7 +3,7 @@ package com.lz.modules.performance.service; import com.baomidou.mybatisplus.extension.service.IService; import com.lz.common.utils.PageUtils; import com.lz.modules.performance.dto.IndicatorLibraryMoveDto; -import com.lz.modules.performance.dto.StatisticalIndicatorTypeDto; +import com.lz.modules.performance.res.StatisticalIndicatorTypeRes; import com.lz.modules.performance.entity.IndicatorLibrary; import com.lz.modules.performance.req.IndicatorLibraryReq; @@ -41,7 +41,7 @@ public interface IndicatorLibraryService extends IService { void updateIndicatorLibrarysMove(IndicatorLibraryMoveDto dto); - List statisticalByIndicatorType(Long indicatorType); + List statisticalByType(Long indicatorType); int deleteIndicatorLibrarysIndicatorType(Integer indicatorType); diff --git a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java index c6baa6fd..0ea56e02 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java @@ -1,12 +1,11 @@ package com.lz.modules.performance.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.google.common.collect.Lists; import com.lz.common.utils.PageUtils; import com.lz.common.utils.StringUtil; import com.lz.modules.performance.dao.IndicatorLibraryMapper; import com.lz.modules.performance.dto.IndicatorLibraryMoveDto; -import com.lz.modules.performance.dto.StatisticalIndicatorTypeDto; +import com.lz.modules.performance.res.StatisticalIndicatorTypeRes; import com.lz.modules.performance.entity.IndicatorLibrary; import com.lz.modules.performance.req.IndicatorLibraryReq; import com.lz.modules.performance.service.IndicatorLibraryService; @@ -15,10 +14,7 @@ import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Arrays; import java.util.List; -import java.util.Optional; -import java.util.function.ToDoubleFunction; /** *

@@ -103,9 +99,9 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl statisticalByIndicatorType(Long indicatorType) { - List dtos = indicatorLibraryMapper.statisticalByIndicatorType(indicatorType); - StatisticalIndicatorTypeDto dto = new StatisticalIndicatorTypeDto(); + public List statisticalByType(Long type) { + List dtos = indicatorLibraryMapper.statisticalByType(type); + StatisticalIndicatorTypeRes dto = new StatisticalIndicatorTypeRes(); dto.setName("未分类指标"); dto.setIndicatorType(0); dto.setDelete(1); @@ -115,7 +111,7 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl and indicator_type = #{req.indicatorType} + + and type = #{req.type} + order by sort @@ -123,15 +126,18 @@ - SELECT t.id indicatorType,t.name,IFNULL(l.count,0) count from lz_indicator_type t - LEFT JOIN (SELECT name,indicator_type,count(indicator_type) count from lz_indicator_library where is_delete = 0 - - and l.indicator_type=#{indicatorType} + LEFT JOIN + (SELECT name,indicator_type,count(indicator_type) count from lz_indicator_library where is_delete=0 + + and type = #{type} GROUP BY indicator_type) l - on t.is_delete = 0 and t.id = l.indicator_type + on t.id = l.indicator_type + where t.is_delete = 0 + From bfb2ad9721a22baf096e5700aba6a47a377487fc Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Wed, 20 Jan 2021 18:28:16 +0800 Subject: [PATCH 15/26] fix --- .../performance/controller/IndicatorLibraryController.java | 2 ++ .../com/lz/modules/performance/dto/IndicatorLibraryDto.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java index a836f73a..3ee213b9 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java @@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.math.BigDecimal; import java.util.List; @Slf4j @@ -52,6 +53,7 @@ public class IndicatorLibraryController { public R save(@RequestBody IndicatorLibraryDto dto) { IndicatorLibrary indicatorLibrary = new IndicatorLibrary(); BeanUtil.copyProperties(dto,indicatorLibrary); + indicatorLibrary.setWeight(new BigDecimal(dto.getWeight())); boolean success = indicatorLibraryService.saveOrUpdate(indicatorLibrary); return success ? R.ok():R.error(); diff --git a/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java b/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java index 6f7f0171..994f2d38 100644 --- a/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java +++ b/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java @@ -30,7 +30,7 @@ public class IndicatorLibraryDto { private Integer indicatorType; //权重 @ApiModelProperty(value = "权重", name = "weight") - private BigDecimal weight; + private String weight; //考核标准,关键结果 @ApiModelProperty(value = "考核标准,关键结果", name = "keyResult") private String keyResult; From 74ff84578c85327eeed4d31dfe0f07f90a55c380 Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Thu, 21 Jan 2021 10:55:20 +0800 Subject: [PATCH 16/26] fix --- .../resources/mapper/performance/IndicatorLibraryMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml index 2be23dc9..278390bf 100644 --- a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml +++ b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml @@ -136,7 +136,7 @@ GROUP BY indicator_type) l on t.id = l.indicator_type - where t.is_delete = 0 + where t.is_delete = 0 and t.type=0 From 3e394411ff064300004e97e04886047868d4588f Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Thu, 21 Jan 2021 11:23:00 +0800 Subject: [PATCH 17/26] fix --- .../performance/controller/IndicatorLibraryController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java index 3ee213b9..70d0d9d4 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java @@ -31,7 +31,8 @@ public class IndicatorLibraryController { @PostMapping("/list") @ApiOperation("获取指标列表") - public R list(@RequestBody IndicatorLibraryReq req) { + @ApiResponses({@ApiResponse(code = 200, message = "成功", response = IndicatorLibraryDto.class)}) + public R list(@RequestBody IndicatorLibraryReq req) { PageUtils page = indicatorLibraryService.selectIndicatorLibrarysByReq(req); return R.ok().put("data",page); } From b57fcd6943c04874bb62e57b0637737d72d6111c Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Thu, 21 Jan 2021 12:02:33 +0800 Subject: [PATCH 18/26] fix --- .../performance/dto/IndicatorLibraryDto.java | 5 +++++ .../performance/IndicatorLibraryMapper.xml | 16 ++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java b/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java index 994f2d38..00abaa9d 100644 --- a/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java +++ b/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java @@ -37,4 +37,9 @@ public class IndicatorLibraryDto { //排序 @ApiModelProperty(value = "排序", name = "sort") private Integer sort; + + @ApiModelProperty(value = "类型名称", name = "typeName") + private String typeName; + + } diff --git a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml index 278390bf..0c603ea1 100644 --- a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml +++ b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml @@ -92,18 +92,22 @@ From 54efb3c559ab18305e01b2afeefa23da44437960 Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Thu, 21 Jan 2021 14:42:58 +0800 Subject: [PATCH 19/26] fix --- .../performance/controller/IndicatorLibraryController.java | 5 ++++- .../resources/mapper/performance/IndicatorLibraryMapper.xml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java index 70d0d9d4..8de81bd3 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java @@ -4,6 +4,7 @@ package com.lz.modules.performance.controller; import cn.hutool.core.bean.BeanUtil; import com.lz.common.utils.PageUtils; import com.lz.common.utils.R; +import com.lz.common.utils.StringUtil; import com.lz.modules.performance.dto.IndicatorLibraryDto; import com.lz.modules.performance.dto.IndicatorLibraryMoveDto; import com.lz.modules.performance.res.StatisticalIndicatorTypeRes; @@ -54,7 +55,9 @@ public class IndicatorLibraryController { public R save(@RequestBody IndicatorLibraryDto dto) { IndicatorLibrary indicatorLibrary = new IndicatorLibrary(); BeanUtil.copyProperties(dto,indicatorLibrary); - indicatorLibrary.setWeight(new BigDecimal(dto.getWeight())); + if(StringUtil.isNotBlank(dto.getWeight())){ + indicatorLibrary.setWeight(new BigDecimal(dto.getWeight())); + } boolean success = indicatorLibraryService.saveOrUpdate(indicatorLibrary); return success ? R.ok():R.error(); diff --git a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml index 0c603ea1..e6d770ae 100644 --- a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml +++ b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml @@ -153,6 +153,7 @@ From b738b42a73e3005d1f88843cea330688c6fe49e7 Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Thu, 21 Jan 2021 18:34:32 +0800 Subject: [PATCH 20/26] fix --- .../com/lz/modules/performance/dto/IndicatorLibraryDto.java | 4 ++-- .../com/lz/modules/performance/entity/IndicatorLibrary.java | 2 +- .../com/lz/modules/performance/req/IndicatorLibraryReq.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java b/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java index 00abaa9d..785093a5 100644 --- a/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java +++ b/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java @@ -22,8 +22,8 @@ public class IndicatorLibraryDto { //指标名称 @ApiModelProperty(value = "指标名称", name = "name") private String name; - //指标类型 lz_indicator_type 表id" - @ApiModelProperty(value = "指标类型 lz_indicator_type 表id", name = "type") + //指标类型 lz_result_dimension 表id" + @ApiModelProperty(value = "指标类型 lz_result_dimension 表id", name = "type") private Integer type; //指标分类 lz_indicator_type 表id @ApiModelProperty(value = "指标分类 lz_indicator_type 表id", name = "indicatorType") diff --git a/src/main/java/com/lz/modules/performance/entity/IndicatorLibrary.java b/src/main/java/com/lz/modules/performance/entity/IndicatorLibrary.java index d17267ff..5cac3268 100644 --- a/src/main/java/com/lz/modules/performance/entity/IndicatorLibrary.java +++ b/src/main/java/com/lz/modules/performance/entity/IndicatorLibrary.java @@ -35,7 +35,7 @@ public class IndicatorLibrary implements java.io.Serializable { @ApiModelProperty(value = "指标名称", name = "name") private String name; //指标类型 0:量化指标 1:行为价值观指标 2:团队管理 - @ApiModelProperty(value = "指标类型 lz_indicator_type 表id", name = "type") + @ApiModelProperty(value = "指标类型 lz_result_dimension 表id", name = "type") private Integer type; //指标分类 lz_indicator_type 表id @ApiModelProperty(value = "指标分类 lz_indicator_type 表id", name = "indicatorType") diff --git a/src/main/java/com/lz/modules/performance/req/IndicatorLibraryReq.java b/src/main/java/com/lz/modules/performance/req/IndicatorLibraryReq.java index 02453f03..c362a698 100644 --- a/src/main/java/com/lz/modules/performance/req/IndicatorLibraryReq.java +++ b/src/main/java/com/lz/modules/performance/req/IndicatorLibraryReq.java @@ -21,8 +21,8 @@ public class IndicatorLibraryReq extends BasePage{ @ApiModelProperty(value = "指标分类 lz_indicator_type 表id", name = "indicatorType") private Integer indicatorType; - //指标分类 lz_indicator_type 表id - @ApiModelProperty(value = "指标类型 lz_indicator_type 表id", name = "type") + //指标分类 lz_result_dimension 表id + @ApiModelProperty(value = "指标类型 lz_result_dimension 表id", name = "type") private Integer type; } From 0f440dd17377fa625e81c0ed448e16b800c0c31b Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Fri, 22 Jan 2021 09:36:12 +0800 Subject: [PATCH 21/26] fix --- .../resources/mapper/performance/IndicatorLibraryMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml index e6d770ae..6ff3b177 100644 --- a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml +++ b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml @@ -95,7 +95,7 @@ select l.id id,l.name name,l.type type,weight, key_result,l.sort,t.name typeName from lz_indicator_library l - LEFT JOIN lz_indicator_type t + LEFT JOIN lz_result_dimension t on l.type = t.id where l.is_delete = 0 and t.is_delete = 0 From 39f68e6376cc756d9cfd7b0add9f2a32ab20bdd3 Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Fri, 22 Jan 2021 11:05:19 +0800 Subject: [PATCH 22/26] fix --- .../performance/controller/IndicatorLibraryController.java | 2 +- .../com/lz/modules/performance/dto/IndicatorLibraryDto.java | 2 +- .../resources/mapper/performance/IndicatorLibraryMapper.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java index 8de81bd3..3460b06d 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java @@ -93,7 +93,7 @@ public class IndicatorLibraryController { @GetMapping("/statistical") @ApiOperation("统计指标") @ApiResponses({@ApiResponse(code = 200, message = "成功", response = StatisticalIndicatorTypeRes.class)}) - public R statistical(@RequestParam(name = "type",required = false) @ApiParam(value = "指标分类id",name = "type") Long type) { + public R statistical(@RequestParam(name = "type",required = false) @ApiParam(value = "指标维度id",name = "type") Long type) { List dtos = indicatorLibraryService.statisticalByType(type); return R.ok().put("data",dtos); } diff --git a/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java b/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java index 785093a5..aebc6135 100644 --- a/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java +++ b/src/main/java/com/lz/modules/performance/dto/IndicatorLibraryDto.java @@ -23,7 +23,7 @@ public class IndicatorLibraryDto { @ApiModelProperty(value = "指标名称", name = "name") private String name; //指标类型 lz_result_dimension 表id" - @ApiModelProperty(value = "指标类型 lz_result_dimension 表id", name = "type") + @ApiModelProperty(value = "指标维度 lz_result_dimension 表id", name = "type") private Integer type; //指标分类 lz_indicator_type 表id @ApiModelProperty(value = "指标分类 lz_indicator_type 表id", name = "indicatorType") diff --git a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml index 6ff3b177..472b1e5d 100644 --- a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml +++ b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml @@ -153,7 +153,7 @@ From 74096d648ce9e692260cd2fae11979ec49a652bc Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Fri, 22 Jan 2021 15:09:41 +0800 Subject: [PATCH 23/26] fix --- .../resources/mapper/performance/IndicatorLibraryMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml index 472b1e5d..9d2185e4 100644 --- a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml +++ b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml @@ -93,7 +93,7 @@ select COUNT(1) from lz_indicator_library where indicator_type=#{indicatorType} and is_delete = 0 - and type in (SELECT id from lz_result_dimension where is_delete = 0) + + and type = #{type} + + + and type in (SELECT id from lz_result_dimension where is_delete = 0) + From 45e074f89addc568473d8833ca803ba212548089 Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Mon, 25 Jan 2021 11:07:31 +0800 Subject: [PATCH 25/26] fix --- .../equipment/service/impl/EquipmentInfoServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/lz/modules/equipment/service/impl/EquipmentInfoServiceImpl.java b/src/main/java/com/lz/modules/equipment/service/impl/EquipmentInfoServiceImpl.java index 6ea03e6c..e2da0222 100644 --- a/src/main/java/com/lz/modules/equipment/service/impl/EquipmentInfoServiceImpl.java +++ b/src/main/java/com/lz/modules/equipment/service/impl/EquipmentInfoServiceImpl.java @@ -209,7 +209,7 @@ public class EquipmentInfoServiceImpl extends ServiceImpl Date: Tue, 26 Jan 2021 18:00:07 +0800 Subject: [PATCH 26/26] fix --- .../performance/controller/IndicatorLibraryController.java | 4 ++-- .../lz/modules/performance/dao/IndicatorLibraryMapper.java | 4 ++-- .../performance/service/IndicatorLibraryService.java | 2 +- .../service/impl/IndicatorLibraryServiceImpl.java | 6 +++--- .../resources/mapper/performance/IndicatorLibraryMapper.xml | 6 ++++++ 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java index 3460b06d..b85c1228 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorLibraryController.java @@ -93,8 +93,8 @@ public class IndicatorLibraryController { @GetMapping("/statistical") @ApiOperation("统计指标") @ApiResponses({@ApiResponse(code = 200, message = "成功", response = StatisticalIndicatorTypeRes.class)}) - public R statistical(@RequestParam(name = "type",required = false) @ApiParam(value = "指标维度id",name = "type") Long type) { - List dtos = indicatorLibraryService.statisticalByType(type); + public R statistical(@RequestParam(name = "type",required = false) @ApiParam(value = "指标维度id",name = "type") Long type,@RequestParam(name = "name",required = false) @ApiParam(value = "指标名称",name = "name") String name) { + List dtos = indicatorLibraryService.statisticalByType(type,name); return R.ok().put("data",dtos); } } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java index bd648613..fc449c37 100644 --- a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java +++ b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java @@ -42,11 +42,11 @@ public interface IndicatorLibraryMapper extends BaseMapper { void updateIndicatorLibrarysMove(@Param("ids")List ids,@Param("indicatorType")Long indicatorType); - List statisticalByType(@Param("type") Long type); + List statisticalByType(@Param("type") Long type,@Param("name") String name); int deleteIndicatorLibrarysByIndicatorType(@Param("indicatorType") Integer indicatorType); - int countIndicatorLibrarysByIndicatorType(@Param("indicatorType") Integer indicatorType,@Param("type") Long type); + int countIndicatorLibrarysByIndicatorType(@Param("indicatorType") Integer indicatorType,@Param("type") Long type,@Param("name") String name); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java index 2a8f09ee..5b1a4a8f 100644 --- a/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java +++ b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java @@ -41,7 +41,7 @@ public interface IndicatorLibraryService extends IService { void updateIndicatorLibrarysMove(IndicatorLibraryMoveDto dto); - List statisticalByType(Long indicatorType); + List statisticalByType(Long indicatorType,String name); int deleteIndicatorLibrarysIndicatorType(Integer indicatorType); diff --git a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java index 02eb4eda..6ea8db5b 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java @@ -99,13 +99,13 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl statisticalByType(Long type) { - List dtos = indicatorLibraryMapper.statisticalByType(type); + public List statisticalByType(Long type,String name) { + List dtos = indicatorLibraryMapper.statisticalByType(type,name); StatisticalIndicatorTypeRes dto = new StatisticalIndicatorTypeRes(); dto.setName("未分类指标"); dto.setIndicatorType(0); dto.setDelete(1); - int count = indicatorLibraryMapper.countIndicatorLibrarysByIndicatorType(0,type); + int count = indicatorLibraryMapper.countIndicatorLibrarysByIndicatorType(0,type,name); dto.setCount(count); if(count>0){ dtos.add(dto); diff --git a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml index c81a8472..3a4870ab 100644 --- a/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml +++ b/src/main/resources/mapper/performance/IndicatorLibraryMapper.xml @@ -138,6 +138,9 @@ and type = #{type} + + and name like concat('%',#{name},'%') + GROUP BY indicator_type) l on t.id = l.indicator_type where t.is_delete = 0 and t.type=0 @@ -159,6 +162,9 @@ and type in (SELECT id from lz_result_dimension where is_delete = 0) + + and name like concat('%',#{name},'%') +