fix
This commit is contained in:
parent
61bcac7d0f
commit
bf7f95d867
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<IndicatorLibrary> {
|
||||
|
||||
@ -29,5 +35,8 @@ public interface IndicatorLibraryMapper extends BaseMapper<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);
|
||||
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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;
|
||||
|
||||
}
|
||||
@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -29,5 +31,9 @@ public interface IndicatorLibraryService extends IService<IndicatorLibrary> {
|
||||
|
||||
int deleteIndicatorLibraryById(Long id);
|
||||
|
||||
PageUtils selectIndicatorLibrarysByReq(IndicatorLibraryReq req);
|
||||
|
||||
void deleteIndicatorLibrarysByIds(String ids);
|
||||
|
||||
|
||||
}
|
||||
@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* (设置)指标库 服务类
|
||||
@ -58,6 +65,22 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl<IndicatorLibraryMap
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,8 +23,6 @@
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectIndicatorLibraryById" resultType="IndicatorLibrary" >
|
||||
select * from lz_indicator_library where id=#{id} and is_delete = 0 limit 1
|
||||
</select>
|
||||
@ -93,5 +91,21 @@
|
||||
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 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
|
||||
</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>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user