Commit 94ba229f authored by cq990612's avatar cq990612

优化代码结构

parent 35b86997
......@@ -14,4 +14,8 @@ public interface WorkTypeMapper extends BaseMapper<WorkType> {
List<WorkType> getAll();
List<Integer> getIdByReviewer(Integer reviewer);
List<WorkType> getByIsDelete(Integer isDelete);
int updateIsDeleteById(Integer id, Integer isDelete);
}
<?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="cn.wisenergy.mapper.WorkTypeMapper">
<update id="updateIsDeleteById">
update work_type
<set>
<if test="null != isDelete">
is_delete = #{isDelete},
</if>
</set>
<where>
<if test="null != id">
id = #{id}
</if>
</where>
</update>
<select id="getAll" resultType="cn.wisenergy.model.app.WorkType">
SELECT id,name,reviewer
SELECT id,name,reviewer,is_delete
FROM work_type
</select>
......@@ -13,5 +27,15 @@
FROM work_type
WHERE reviewer = #{reviewer}
</select>
<select id="getByIsDelete" resultType="cn.wisenergy.model.app.WorkType">
SELECT id,name,reviewer,is_delete
FROM work_type
<where>
<if test="null != isDelete">
is_delete = #{isDelete}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -31,6 +31,9 @@ public class WorkType implements Serializable, Comparable{
@ApiModelProperty(name = "reviewer",value = "检查者:1:该项目负责人 2:系统自动 3:部门或中心负责人")
private Integer reviewer;
@ApiModelProperty(name = "isDelete",value = "0:正常 1:删除")
private Integer isDelete;
@Override
public int compareTo(Object o) {
......
......@@ -17,4 +17,6 @@ public interface WorkTypeService {
Boolean addAndModifyWorkType(WorkType workType);
Boolean deleteTypeById(Integer id);
List<WorkType> getByIsDelete(Integer isSort,Integer isDelete);
}
......@@ -648,7 +648,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
List<WorkProject> projects = workProjectService.getNameByIds(projectIds, 1);
ProjectInfoDto projectInfoDto;
List<WorkType> workTypes = workTypeService.getAll(null);
List<WorkType> workTypes = workTypeService.getByIsDelete(1, 0);
if (!CollectionUtils.isEmpty(workTypes)) {
for (WorkType value : workTypes) {
projectInfoDto = new ProjectInfoDto().setType(value.getId()).setTypeName(value.getName()).setDeptManagerName(deptManagerName);
......
......@@ -83,9 +83,21 @@ public class WorkTypeServiceImpl implements WorkTypeService {
if (null == id) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
int i = workTypeMapper.deleteById(id);
int i = workTypeMapper.updateIsDeleteById(id, 0);
return i>0;
}
@Override
public List<WorkType> getByIsDelete(Integer isSort,Integer isDelete) {
log.info("WorkTypeServiceImpl[]getByIsDelete[]");
List<WorkType> workTypes = workTypeMapper.getByIsDelete(isDelete);
if (CollectionUtils.isEmpty(workTypes)) {
return null;
}
if (null != isSort && 1 == isSort) {
Collections.sort(workTypes);
}
return workTypes;
}
}
......@@ -103,7 +103,6 @@ public class WorkTimeOrderController extends BaseController {
if (null == userId) {
throw new CustomException(RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
ProjectsDto projectDto = workTimeOrderService.getProjectDto(userId);
return getResult(projectDto);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment