Commit 3d90bab5 authored by 周昊's avatar 周昊

1、修改任务审批列表

parent f9cf5d4e
...@@ -414,8 +414,7 @@ public class RiskPlanAppController extends BaseController { ...@@ -414,8 +414,7 @@ public class RiskPlanAppController extends BaseController {
*/ */
@GetMapping("/approve/list") @GetMapping("/approve/list")
public R<List<RiskPlanAppListDto>> getRiskPlanAppListDtoListByApproveUser() { public R<List<RiskPlanAppListDto>> getRiskPlanAppListDtoListByApproveUser() {
List<RiskPlanStatusType> statusList = Arrays.asList(RiskPlanStatusType.WAIT_LEADER_APPROVE); return R.ok(riskPlanService.getRiskPlanAppListDtoListByApproveUser(getUserId()));
return R.ok(riskPlanService.getRiskPlanAppListDtoList(statusList, null, getUserId(),null));
} }
......
...@@ -2,8 +2,10 @@ package com.censoft.censoftrongtong.mapper; ...@@ -2,8 +2,10 @@ package com.censoft.censoftrongtong.mapper;
import com.censoft.censoftrongtong.domain.RiskPlan; import com.censoft.censoftrongtong.domain.RiskPlan;
import com.censoft.censoftrongtong.domain.dto.*; import com.censoft.censoftrongtong.domain.dto.*;
import com.censoft.censoftrongtong.enums.RiskPlanStatusType;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
...@@ -73,4 +75,6 @@ public interface RiskPlanMapper ...@@ -73,4 +75,6 @@ public interface RiskPlanMapper
,@Param("buildingId") Long buildingId); ,@Param("buildingId") Long buildingId);
List<RiskPlanAppApproveListDto> getApproveListDtoByPlanId(@Param("planId") Long planId); List<RiskPlanAppApproveListDto> getApproveListDtoByPlanId(@Param("planId") Long planId);
List<RiskPlanAppListDto> getRiskPlanAppListDtoListByApproveUser(@Param("userId") Long userId);
} }
...@@ -77,4 +77,6 @@ public interface IRiskPlanService ...@@ -77,4 +77,6 @@ public interface IRiskPlanService
int approveAppApproveDto(RiskPlanAppApproveDto appApproveDto); int approveAppApproveDto(RiskPlanAppApproveDto appApproveDto);
int revokeByPlanId(Long planId, Long userId); int revokeByPlanId(Long planId, Long userId);
List<RiskPlanAppListDto> getRiskPlanAppListDtoListByApproveUser(Long userId);
} }
...@@ -268,6 +268,18 @@ public class RiskPlanServiceImpl implements IRiskPlanService { ...@@ -268,6 +268,18 @@ public class RiskPlanServiceImpl implements IRiskPlanService {
return 1; return 1;
} }
@Override
public List<RiskPlanAppListDto> getRiskPlanAppListDtoListByApproveUser(Long userId) {
//查询并把状态值转化为状态名称
return riskPlanMapper.getRiskPlanAppListDtoListByApproveUser(userId)
.stream()
.map(dto -> {
String status = RiskPlanStatusType.getTitleByStatus(dto.getStatus()).getTitle();
dto.setStatus(status);
return dto;
}).collect(Collectors.toList());
}
private String getNo() { private String getNo() {
Random random = new Random(); Random random = new Random();
int randomNumber = random.nextInt(1000); // 生成0到999之间的随机数 int randomNumber = random.nextInt(1000); // 生成0到999之间的随机数
......
...@@ -175,6 +175,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -175,6 +175,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY ORDER BY
rpt.start_time ASC rpt.start_time ASC
</select> </select>
<select id="getRiskPlanAppListDtoListByApproveUser"
resultType="com.censoft.censoftrongtong.domain.dto.RiskPlanAppListDto">
SELECT
rp.id,
rp.`name`,
rp.start_time AS startTime,
rp.`status`,
su.nick_name AS leaderUserName
FROM
risk_plan rp
LEFT JOIN sys_user su ON su.user_id = rp.leader_user_id
<where>
<if test="userId != null">
and ((rp.approval_user_id = #{userId} and rp.`status` = 'WAIT_LEADER_APPROVE')
or
(rp.create_user_id = #{userId} and rp.`status` = 'WAIT_APPROVE'))
</if>
</where>
ORDER BY
rp.start_time DESC
</select>
<insert id="insertRiskPlan" parameterType="com.censoft.censoftrongtong.domain.RiskPlan" useGeneratedKeys="true" keyProperty="id"> <insert id="insertRiskPlan" parameterType="com.censoft.censoftrongtong.domain.RiskPlan" useGeneratedKeys="true" keyProperty="id">
insert into risk_plan insert into risk_plan
......
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