Browse Source

fix: 解决我的巡检任务中机构条件查询失效的问题

zhongwei
liwen 4 months ago
parent
commit
eff6959589
  1. 10
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java
  2. 31
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml

10
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java

@ -143,21 +143,17 @@ public class TaskController extends BladeController {
*/ */
@GetMapping("/list") @GetMapping("/list")
@ApiOperation(value = "分页显示任务列表", notes = "传入task") @ApiOperation(value = "分页显示任务列表", notes = "传入task")
@Operate(label = "查询巡检任务分页列表-2",type = BusinessType.QUERY,ignore = false) @Operate(label = "查询巡检任务分页列表-2",type = BusinessType.QUERY)
public R<BladePage<TaskVo>> list(TaskListQuery task, Query query) { public R<BladePage<TaskVo>> list(TaskListQuery task, Query query) {
//CacheUtil.put("test#2","inspect","test","12");
// LambdaQueryWrapper<TaskEntity> queryWrapper = Condition.getQueryWrapper(new TaskEntity(),task);
// queryWrapper.orderByDesc(TaskEntity::getUpdateTime);
// IPage<TaskEntity> pages = taskService.page(Condition.getPage(query), queryWrapper);
IPage<TaskVo> pages = Condition.getPage(query); IPage<TaskVo> pages = Condition.getPage(query);
if(!AuthUtil.isAdministrator()){ if (!AuthUtil.isAdministrator()) {
task.setCurUserId(AuthUtil.getUserId()); task.setCurUserId(AuthUtil.getUserId());
task.setTenantId(AuthUtil.getTenantId()); task.setTenantId(AuthUtil.getTenantId());
} }
if (task.getCurUserId() == -1) { if (task.getCurUserId() == -1) {
task.setCurUserId(null); task.setCurUserId(null);
} }
List<TaskVo> list = taskService.getListPage(pages,task); List<TaskVo> list = taskService.getListPage(pages, task);
pages.setRecords(list); pages.setRecords(list);
BladePage<TaskVo> bladePage = BladePage.of(pages); BladePage<TaskVo> bladePage = BladePage.of(pages);
return R.data(bladePage); return R.data(bladePage);

31
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml

@ -132,14 +132,18 @@
</select> </select>
<select id="getListPage" parameterType="com.hnac.hzinfo.inspect.task.vo.TaskListQuery" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo"> <select id="getListPage" parameterType="com.hnac.hzinfo.inspect.task.vo.TaskListQuery" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo">
SELECT t.*,u.USER_ID from HZ_ST_EX_TASK t SELECT
LEFT JOIN HZ_ST_EX_TASK_USER u on t.ID=u.TASK_ID t.*, u.USER_ID
where t.IS_DELETED=0 and u.IS_DELETED=0 from
HZ_ST_EX_TASK t
left join HZ_ST_EX_TASK_USER u on t.ID = u.TASK_ID
where
t.IS_DELETED = 0 and u.IS_DELETED = 0
<if test="task.dutyId != null "> <if test="task.dutyId != null ">
and t.DUTY_ID=#{task.dutyId} and t.DUTY_ID = #{task.dutyId}
</if> </if>
<if test="task.curUserId != null and task.curUserId != ''"> <if test="task.curUserId != null and task.curUserId != ''">
and u.USER_ID=#{task.curUserId} and u.USER_ID = #{task.curUserId}
</if> </if>
<if test="task.planName != null and task.planName != ''"> <if test="task.planName != null and task.planName != ''">
and t.PLAN_NAME like concat('%', #{task.planName}, '%') and t.PLAN_NAME like concat('%', #{task.planName}, '%')
@ -157,31 +161,32 @@
and t.PLAN_END_TIME &gt;= #{task.startTime} and t.PLAN_END_TIME &gt;= #{task.startTime}
</if> </if>
<if test="task.cycle != null and task.cycle != ''"> <if test="task.cycle != null and task.cycle != ''">
and t.CYCLE=#{task.cycle} and t.CYCLE = #{task.cycle}
</if> </if>
<if test="task.status != null"> <if test="task.status != null">
and t.STATUS=#{task.status} and t.STATUS = #{task.status}
</if> </if>
<if test="task.keepOnRecord != null"> <if test="task.keepOnRecord != null">
and t.KEEP_ON_RECORD=#{task.keepOnRecord} and t.KEEP_ON_RECORD = #{task.keepOnRecord}
</if> </if>
<if test="task.tenantId != null and task.tenantId != ''"> <if test="task.tenantId != null and task.tenantId != ''">
and t.TENANT_ID = #{task.tenantId} and t.TENANT_ID = #{task.tenantId}
</if> </if>
<if test="task.autoVideo != null"> <if test="task.autoVideo != null">
and t.AUTO_VIDEO=#{task.autoVideo} and t.AUTO_VIDEO = #{task.autoVideo}
</if> </if>
<if test="task.taskIds != null and task.taskIds != ''"> <if test="task.taskIds != null and task.taskIds != ''">
and FIND_IN_SET(t.ID,#{task.taskIds}) and FIND_IN_SET(t.ID, #{task.taskIds})
</if> </if>
<if test="task.areaId != null"> <if test="task.createDept != null">
and t.CREATE_DEPT = #{task.areaId} and t.CREATE_DEPT = #{task.createDept}
</if> </if>
<if test="task.yearMonth != null"> <if test="task.yearMonth != null">
and date_format(t.PLAN_START_TIME,'%Y-%m')= #{task.yearMonth} and date_format(t.PLAN_START_TIME,'%Y-%m') = #{task.yearMonth}
</if> </if>
order by t.UPDATE_TIME desc order by t.UPDATE_TIME desc
</select> </select>
<select id="getAllPageList" parameterType="com.hnac.hzinfo.inspect.task.vo.TaskListQuery" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo"> <select id="getAllPageList" parameterType="com.hnac.hzinfo.inspect.task.vo.TaskListQuery" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo">
SELECT SELECT
t.*, b.USER_ID as userIds, t.*, b.USER_ID as userIds,

Loading…
Cancel
Save