提交休眠

This commit is contained in:
quyixiao 2021-01-28 14:55:46 +08:00
commit 0155ffeefd
21 changed files with 1415 additions and 1 deletions

View File

@ -0,0 +1,100 @@
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;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.List;
@Slf4j
@RestController
@RequestMapping("/indicatorLibrary")
@Api(value = "指标相关接口", tags = { "指标相关接口" })
public class IndicatorLibraryController {
@Autowired
private IndicatorLibraryService indicatorLibraryService;
@PostMapping("/list")
@ApiOperation("获取指标列表")
@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);
}
@GetMapping("/getById")
@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);
return R.ok().put("data",dto);
}
@PostMapping("/saveOrUpdate")
@ApiOperation("保存/修改指标")
public R save(@RequestBody IndicatorLibraryDto dto) {
IndicatorLibrary indicatorLibrary = new IndicatorLibrary();
BeanUtil.copyProperties(dto,indicatorLibrary);
if(StringUtil.isNotBlank(dto.getWeight())){
indicatorLibrary.setWeight(new BigDecimal(dto.getWeight()));
}
boolean success = indicatorLibraryService.saveOrUpdate(indicatorLibrary);
return success ? R.ok():R.error();
}
@GetMapping("/delete")
@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();
}
@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,@RequestParam(name = "name",required = false) @ApiParam(value = "指标名称",name = "name") String name) {
List<StatisticalIndicatorTypeRes> dtos = indicatorLibraryService.statisticalByType(type,name);
return R.ok().put("data",dtos);
}
}

View File

@ -0,0 +1,77 @@
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.res.IndicatorTypeRes;
import com.lz.modules.performance.service.IndicatorLibraryService;
import com.lz.modules.performance.service.IndicatorTypeService;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@RequestMapping("/indicatorType")
@Api(value = "指标分类相关接口", tags = { "指标分类相关接口" })
public class IndicatorTypeController {
@Autowired
private IndicatorTypeService indicatorTypeService;
@Autowired
private IndicatorLibraryService indicatorLibraryService;
@PostMapping("/list")
@ApiOperation("获取分类/类型列表")
@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);
}
@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);
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();
}
}

View File

@ -0,0 +1,52 @@
package com.lz.modules.performance.dao;
/**
* <p>
* (设置)指标库 服务类
* </p>
*
* @author quyixiao
* @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.res.StatisticalIndicatorTypeRes;
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<IndicatorLibrary> {
IndicatorLibrary selectIndicatorLibraryById(@Param("id") Long id);
Long insertIndicatorLibrary(IndicatorLibrary indicatorLibrary);
int updateIndicatorLibraryById(IndicatorLibrary indicatorLibrary);
int updateCoverIndicatorLibraryById(IndicatorLibrary indicatorLibrary);
int deleteIndicatorLibraryById(@Param("id") Long id);
List<IndicatorLibraryDto> selectIndicatorLibrarysByReq(@Param("page") IPage page, @Param("req")IndicatorLibraryReq req);
void deleteIndicatorLibrarysByIds(@Param("ids") List<Long> ids);
void updateIndicatorLibrarysMove(@Param("ids")List<Long> ids,@Param("indicatorType")Long indicatorType);
List<StatisticalIndicatorTypeRes> 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,@Param("name") String name);
}

View File

@ -0,0 +1,44 @@
package com.lz.modules.performance.dao;
/**
* <p>
* 指标分类 服务类
* </p>
*
* @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> {
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<IndicatorTypeDto> selectIndicatorTypesByReq(@Param("page") IPage page, @Param("req")IndicatorReq req);
IndicatorType selectIndicatorTypeByName(@Param("name") String name);
}

View File

@ -0,0 +1,45 @@
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;
/**
* @Author: djc
* @Desc:
* @Date: 2021/1/12 14:41
*/
@Data
@ApiModel("指标保存/修改实体")
public class IndicatorLibraryDto {
//
@TableId(value = "id", type = IdType.AUTO)
private Long id;
//指标名称
@ApiModelProperty(value = "指标名称", name = "name")
private String name;
//指标类型 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")
private Integer indicatorType;
//权重
@ApiModelProperty(value = "权重", name = "weight")
private String weight;
//考核标准关键结果
@ApiModelProperty(value = "考核标准,关键结果", name = "keyResult")
private String keyResult;
//排序
@ApiModelProperty(value = "排序", name = "sort")
private Integer sort;
@ApiModelProperty(value = "类型名称", name = "typeName")
private String typeName;
}

View File

@ -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;
}

View File

@ -0,0 +1,27 @@
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/12 10:21
*/
@Data
@ApiModel("保存/修改分类实体")
public class IndicatorTypeDto {
@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;
}

View File

@ -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;
/**
* <p>
* </p>*(设置)指标库
* @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 = "指标类型 lz_result_dimension 表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;
/**
*
* @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 +
"}";
}
}

View File

@ -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;
/**
* <p>
* </p>*指标分类
* @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 +
"}";
}
}

View File

@ -0,0 +1,28 @@
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;
/**
* @Author: djc
* @Desc:
* @Date: 2021/1/12 14:50
*/
@Data
@ApiModel("获取指标列表实体")
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;
//指标分类 lz_result_dimension 表id
@ApiModelProperty(value = "指标类型 lz_result_dimension 表id", name = "type")
private Integer type;
}

View File

@ -0,0 +1,22 @@
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;
/**
* @Author: djc
* @Desc:
* @Date: 2021/1/12 11:39
*/
@Data
@ApiModel("获取分类/类型实体")
public class IndicatorReq extends BasePage{
//指标名称
@ApiModelProperty(value = "指标分类名称", name = "name")
private String name;
//指标名称
@ApiModelProperty(value = "类型 0: 指标分类 1指标类型", name = "type")
private Integer type;
}

View File

@ -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;
}

View File

@ -0,0 +1,28 @@
package com.lz.modules.performance.res;
import com.lz.modules.performance.entity.IndicatorType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author: djc
* @Desc:
* @Date: 2021/1/13 17:20
*/
@Data
@ApiModel("统计响应实体")
public class StatisticalIndicatorTypeRes {
@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;
}

View File

@ -0,0 +1,49 @@
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.res.StatisticalIndicatorTypeRes;
import com.lz.modules.performance.entity.IndicatorLibrary;
import com.lz.modules.performance.req.IndicatorLibraryReq;
import java.util.List;
/**
* <p>
* (设置)指标库 服务类
* </p>
*
* @author quyixiao
* @since 2021-01-12
*/
public interface IndicatorLibraryService extends IService<IndicatorLibrary> {
IndicatorLibrary selectIndicatorLibraryById(Long id);
Long insertIndicatorLibrary(IndicatorLibrary indicatorLibrary);
int updateIndicatorLibraryById(IndicatorLibrary indicatorLibrary);
int updateCoverIndicatorLibraryById(IndicatorLibrary indicatorLibrary);
int deleteIndicatorLibraryById(Long id);
PageUtils selectIndicatorLibrarysByReq(IndicatorLibraryReq req);
void deleteIndicatorLibrarysByIds(String ids);
void updateIndicatorLibrarysMove(IndicatorLibraryMoveDto dto);
List<StatisticalIndicatorTypeRes> statisticalByType(Long indicatorType,String name);
int deleteIndicatorLibrarysIndicatorType(Integer indicatorType);
}

View File

@ -0,0 +1,39 @@
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;
/**
* <p>
* 指标分类 服务类
* </p>
*
* @author quyixiao
* @since 2021-01-12
*/
public interface IndicatorTypeService extends IService<IndicatorType> {
IndicatorType selectIndicatorTypeById(Long id);
Long insertIndicatorType(IndicatorType indicatorType);
int updateIndicatorTypeById(IndicatorType indicatorType);
int updateCoverIndicatorTypeById(IndicatorType indicatorType);
int deleteIndicatorTypeById(Long id);
PageUtils selectIndicatorTypesByReq(IndicatorReq req);
IndicatorType selectIndicatorTypeByName(String name);
}

View File

@ -0,0 +1,132 @@
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.dto.IndicatorLibraryMoveDto;
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.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;
/**
* <p>
* (设置)指标库 服务类
* </p>
*
* @author quyixiao
* @since 2021-01-12
*/
@Service
public class IndicatorLibraryServiceImpl extends ServiceImpl<IndicatorLibraryMapper, IndicatorLibrary> 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);
}
@Override
public PageUtils selectIndicatorLibrarysByReq(IndicatorLibraryReq req) {
PageUtils page = PageUtils.startPage(req.getCurrPage(), req.getPageSize()).doSelect(
page1 -> 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);
}
@Override
public void updateIndicatorLibrarysMove(IndicatorLibraryMoveDto dto) {
String ids = dto.getIds();
if(StringUtil.isBlank(ids)){
return;
}
String[] split = ids.split(",");
List list = Collections.arrayToList(split);
indicatorLibraryMapper.updateIndicatorLibrarysMove(list,dto.getIndicatorType());
}
@Override
public List<StatisticalIndicatorTypeRes> statisticalByType(Long type,String name) {
List<StatisticalIndicatorTypeRes> dtos = indicatorLibraryMapper.statisticalByType(type,name);
StatisticalIndicatorTypeRes dto = new StatisticalIndicatorTypeRes();
dto.setName("未分类指标");
dto.setIndicatorType(0);
dto.setDelete(1);
int count = indicatorLibraryMapper.countIndicatorLibrarysByIndicatorType(0,type,name);
dto.setCount(count);
if(count>0){
dtos.add(dto);
}
dto = new StatisticalIndicatorTypeRes();
dto.setName("全部分类");
dto.setIndicatorType(null);
dto.setDelete(1);
if(CollectionUtils.isNotEmpty(dtos)){
double sum = dtos.stream().mapToDouble(value -> value.getCount()).sum();
dto.setCount(Double.valueOf(sum).intValue());
}
//加入首位
dtos.add(0,dto);
return dtos;
}
@Override
public int deleteIndicatorLibrarysIndicatorType(Integer indicatorType) {
return indicatorLibraryMapper.deleteIndicatorLibrarysByIndicatorType(indicatorType);
}
}

View File

@ -0,0 +1,76 @@
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;
/**
* <p>
* 指标分类 服务类
* </p>
*
* @author quyixiao
* @since 2021-01-12
*/
@Service
public class IndicatorTypeServiceImpl extends ServiceImpl<IndicatorTypeMapper, IndicatorType> 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;
}
@Override
public IndicatorType selectIndicatorTypeByName(String name) {
return indicatorTypeMapper.selectIndicatorTypeByName(name);
}
}

View File

@ -0,0 +1,172 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.lz.modules.performance.dao.IndicatorLibraryMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lz.modules.performance.entity.IndicatorLibrary">
<id column="id" property="id"/>
<result column="is_delete" property="isDelete"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="name" property="name"/>
<result column="type" property="type"/>
<result column="indicator_type" property="indicatorType"/>
<result column="weight" property="weight"/>
<result column="key_result" property="keyResult"/>
<result column="sort" property="sort"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
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
</sql>
<select id="selectIndicatorLibraryById" resultType="IndicatorLibrary" >
select * from lz_indicator_library where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertIndicatorLibrary" parameterType="IndicatorLibrary" useGeneratedKeys="true" keyProperty="id" >
insert into lz_indicator_library(
<if test="name != null">name, </if>
<if test="type != null">type, </if>
<if test="indicatorType != null">indicator_type, </if>
<if test="weight != null">weight, </if>
<if test="keyResult != null">key_result, </if>
<if test="sort != null">sort, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="name != null">#{ name}, </if>
<if test="type != null">#{ type}, </if>
<if test="indicatorType != null">#{ indicatorType}, </if>
<if test="weight != null">#{ weight}, </if>
<if test="keyResult != null">#{ keyResult}, </if>
<if test="sort != null">#{ sort}, </if>
0,
now(),
now()
)
</insert>
<update id="updateIndicatorLibraryById" parameterType="IndicatorLibrary" >
update
lz_indicator_library
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="name != null">name = #{name},</if>
<if test="type != null">type = #{type},</if>
<if test="indicatorType != null">indicator_type = #{indicatorType},</if>
<if test="weight != null">weight = #{weight},</if>
<if test="keyResult != null">key_result = #{keyResult},</if>
<if test="sort != null">sort = #{sort}</if>
</trim>
,gmt_modified = now()
where id = #{id}
</update>
<update id="updateCoverIndicatorLibraryById" parameterType="IndicatorLibrary" >
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>
<update id="deleteIndicatorLibraryById" parameterType="java.lang.Long">
update lz_indicator_library set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectIndicatorLibrarysByReq" resultType="com.lz.modules.performance.dto.IndicatorLibraryDto">
select l.id id,l.name name,l.type type,l.indicator_type,weight, key_result,l.sort,t.name typeName
from lz_indicator_library l
LEFT JOIN lz_result_dimension t
on l.type = t.id
where l.is_delete = 0 and t.is_delete = 0
<if test="req.name!=null and req.name!=''">
and l.name LIKE CONCAT('%',#{req.name},'%')
</if>
<if test="req.indicatorType!=null">
and l.indicator_type = #{req.indicatorType}
</if>
<if test="req.type!=null and req.type!=0">
and l.type = #{req.type}
</if>
order by l.sort
</select>
<update id="deleteIndicatorLibrarysByIds">
update lz_indicator_library set is_delete = 1 where is_delete = 0 AND
id in
(
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
<update id="updateIndicatorLibrarysMove">
update lz_indicator_library set indicator_type = #{indicatorType} where is_delete = 0 AND
id in
(
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
<select id="statisticalByType"
resultType="com.lz.modules.performance.res.StatisticalIndicatorTypeRes">
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
<if test="type!=null and type!=0">
and type = #{type}
</if>
<if test="name !=null and name !=''">
and name like concat('%',#{name},'%')
</if>
GROUP BY indicator_type) l
on t.id = l.indicator_type
where t.is_delete = 0 and t.type=0
</select>
<update id="deleteIndicatorLibrarysByIndicatorType" parameterType="java.lang.Integer">
update lz_indicator_library set is_delete = 1 where indicator_type=#{indicatorType}
</update>
<select id="countIndicatorLibrarysByIndicatorType" resultType="java.lang.Integer">
select COUNT(1) from lz_indicator_library where indicator_type=#{indicatorType} and is_delete = 0
<if test="type!=null and type!=0">
and type = #{type}
</if>
<if test="type==null or type==0">
and type in (SELECT id from lz_result_dimension where is_delete = 0)
</if>
<if test="name !=null and name !=''">
and name like concat('%',#{name},'%')
</if>
</select>
</mapper>

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.lz.modules.performance.dao.IndicatorTypeMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lz.modules.performance.entity.IndicatorType">
<id column="id" property="id"/>
<result column="is_delete" property="isDelete"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="name" property="name"/>
<result column="type" property="type"/>
<result column="sort" property="sort"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, name AS name, type AS type, sort AS sort
</sql>
<select id="selectIndicatorTypeById" resultType="IndicatorType" >
select * from lz_indicator_type where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertIndicatorType" parameterType="IndicatorType" useGeneratedKeys="true" keyProperty="id" >
insert into lz_indicator_type(
<if test="name != null">name, </if>
<if test="type != null">type, </if>
<if test="sort != null">sort, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="name != null">#{ name}, </if>
<if test="type != null">#{ type}, </if>
<if test="sort != null">#{ sort}, </if>
0,
now(),
now()
)
</insert>
<update id="updateIndicatorTypeById" parameterType="IndicatorType" >
update
lz_indicator_type
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="name != null">name = #{name},</if>
<if test="type != null">type = #{type},</if>
<if test="sort != null">sort = #{sort}</if>
</trim>
,gmt_modified = now()
where id = #{id}
</update>
<update id="updateCoverIndicatorTypeById" parameterType="IndicatorType" >
update
lz_indicator_type
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
name = #{name},
type = #{type},
sort = #{sort}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteIndicatorTypeById" parameterType="java.lang.Long">
update lz_indicator_type set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectIndicatorTypesByReq" resultType="com.lz.modules.performance.dto.IndicatorTypeDto">
select id,name,type,sort from lz_indicator_type where is_delete = 0
<if test="req.type !=null">
and type = #{req.type}
</if>
<if test="req.name !=null and req.name !=''">
and name LIKE CONCAT('%',#{req.name},'%')
</if>
order by sort
</select>
<select id="selectIndicatorTypeByName" resultType="com.lz.modules.performance.entity.IndicatorType">
select * from lz_indicator_type where name = #{name} and is_delete = 0 limit 1
</select>
</mapper>

View File

@ -85,6 +85,8 @@ public class MysqlMain {
List<TablesBean> list = new ArrayList<TablesBean>();
list.add(new TablesBean("lz_indicator_library"));
list.add(new TablesBean("lz_indicator_type"));
list.add(new TablesBean("lz_task_resp"));

View File

@ -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");