|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONArray; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.Wrapper; | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestParam(required = false)String orderByField, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByType, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | EntityWrapper<TaskWrkLog> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | convert(param, wrapper); | 
|---|
|  |  |  | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} | 
|---|
|  |  |  | wrapper.orderDesc(Collections.singleton("CREATE_TIME")); | 
|---|
|  |  |  | return R.ok(taskWrkLogService.selectPage(new Page<>(curr, limit), wrapper)); | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | Integer wrkNo = null; | 
|---|
|  |  |  | Integer taskNo = null; | 
|---|
|  |  |  | Integer status = null; | 
|---|
|  |  |  | Date modiTimeStart = null, modiTimeEnd = null; | 
|---|
|  |  |  | for (Map.Entry<String, Object> entry : param.entrySet()) { | 
|---|
|  |  |  | String val = String.valueOf(entry.getValue()); | 
|---|
|  |  |  | if (Cools.isEmpty(val)) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (val.contains(RANGE_TIME_LINK)) { | 
|---|
|  |  |  | String[] dates = val.split(RANGE_TIME_LINK); | 
|---|
|  |  |  | modiTimeStart = DateUtils.convert(dates[0]); | 
|---|
|  |  |  | modiTimeEnd = DateUtils.convert(dates[1]); | 
|---|
|  |  |  | } else if (entry.getKey().equals("wrk_no")) { | 
|---|
|  |  |  | wrkNo = Integer.parseInt(val); | 
|---|
|  |  |  | } else if (entry.getKey().equals("task_no")) { | 
|---|
|  |  |  | taskNo = Integer.parseInt(val); | 
|---|
|  |  |  | } else if (entry.getKey().equals("status")) { | 
|---|
|  |  |  | status = Integer.parseInt(val); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<TaskWrkLog> taskWrkList = taskWrkLogService.selectTaskWrkLogList(wrkNo,taskNo,status,modiTimeStart,modiTimeEnd, curr, limit); | 
|---|
|  |  |  | Page<TaskWrkLog> page1 = new Page<TaskWrkLog>(curr, limit).setRecords(taskWrkList); | 
|---|
|  |  |  | page1.setTotal(taskWrkLogService.selectTaskWrkLogListTotal(wrkNo,taskNo,status,modiTimeStart,modiTimeEnd)); | 
|---|
|  |  |  | return R.ok(page1); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | return R.error("查询失败,请检查参数:"+e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.entity.TaskWrkLog; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.BaseMapper; | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Mapper; | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Param; | 
|---|
|  |  |  | import org.springframework.stereotype.Repository; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Mapper | 
|---|
|  |  |  | @Repository | 
|---|
|  |  |  | public interface TaskWrkLogMapper extends BaseMapper<TaskWrkLog> { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<TaskWrkLog> selectTaskWrkLogList(@Param("wrkNo") Integer wrkNo, | 
|---|
|  |  |  | @Param("taskNo") Integer taskNo, | 
|---|
|  |  |  | @Param("status") Integer status, | 
|---|
|  |  |  | @Param("modiTimeStart") Date modiTimeStart, | 
|---|
|  |  |  | @Param("modiTimeEnd") Date modiTimeEnd, | 
|---|
|  |  |  | @Param("pageNumber") Integer curr, | 
|---|
|  |  |  | @Param("pageSize") Integer limit); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Long selectTaskWrkLogListTotal(@Param("wrkNo") Integer wrkNo, | 
|---|
|  |  |  | @Param("taskNo") Integer taskNo, | 
|---|
|  |  |  | @Param("status") Integer status, | 
|---|
|  |  |  | @Param("modiTimeStart") Date modiTimeStart, | 
|---|
|  |  |  | @Param("modiTimeEnd") Date modiTimeEnd); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.entity.TaskWrkLog; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.service.IService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public interface TaskWrkLogService extends IService<TaskWrkLog> { | 
|---|
|  |  |  | List<TaskWrkLog> selectTaskWrkLogList(Integer wrkNo, Integer taskNo, Integer status, Date modiTimeStart, Date modiTimeEnd, Integer curr, Integer limit); | 
|---|
|  |  |  | Long selectTaskWrkLogListTotal(Integer wrkNo,Integer taskNo,Integer status,Date modiTimeStart,Date modiTimeEnd); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.service.impl.ServiceImpl; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Service("taskWrkLogService") | 
|---|
|  |  |  | public class TaskWrkLogServiceImpl extends ServiceImpl<TaskWrkLogMapper, TaskWrkLog> implements TaskWrkLogService { | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<TaskWrkLog> selectTaskWrkLogList(Integer wrkNo, Integer taskNo, Integer status, Date modiTimeStart, Date modiTimeEnd, Integer curr, Integer limit) { | 
|---|
|  |  |  | return this.baseMapper.selectTaskWrkLogList(wrkNo,taskNo, status,modiTimeStart,modiTimeEnd,curr,limit); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Long selectTaskWrkLogListTotal(Integer wrkNo,Integer taskNo,Integer status,Date modiTimeStart,Date modiTimeEnd) { | 
|---|
|  |  |  | return this.baseMapper.selectTaskWrkLogListTotal(wrkNo,taskNo, status,modiTimeStart,modiTimeEnd); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <sql id="batchSeq"> | 
|---|
|  |  |  | <if test="wrkNo != null"> | 
|---|
|  |  |  | and WRK_NO = #{wrkNo} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="taskNo != null"> | 
|---|
|  |  |  | and TASK_NO = #{taskNo} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="status != null"> | 
|---|
|  |  |  | and STATUS = #{status} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="modiTimeStart != null "> | 
|---|
|  |  |  | <if test="modiTimeEnd != null "> | 
|---|
|  |  |  | and MODI_TIME between #{modiTimeStart} and #{modiTimeEnd} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectTaskWrkLogList" resultMap="BaseResultMap"> | 
|---|
|  |  |  | SELECT * FROM "SOURCE"."wcs_task_wrk_log" | 
|---|
|  |  |  | WHERE 1=1 | 
|---|
|  |  |  | <include refid="batchSeq"></include> | 
|---|
|  |  |  | ORDER BY CREATE_TIME DESC | 
|---|
|  |  |  | LIMIT #{pageSize} OFFSET ((#{pageNumber} - 1) * #{pageSize}); | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectTaskWrkLogListTotal" resultType="Long"> | 
|---|
|  |  |  | SELECT count(1) FROM "SOURCE"."wcs_task_wrk_log" | 
|---|
|  |  |  | WHERE 1=1 | 
|---|
|  |  |  | <include refid="batchSeq"></include> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </mapper> | 
|---|
|  |  |  | 
|---|
|  |  |  | <el-form-item label=""> | 
|---|
|  |  |  | <el-input v-model="tableSearchParam.wrk_no" placeholder="工作号"></el-input> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label=""> | 
|---|
|  |  |  | <el-select v-model="tableSearchParam.status" placeholder="任务状态"> | 
|---|
|  |  |  | <el-option label="接收" value="1"></el-option> | 
|---|
|  |  |  | <el-option label="派发" value="2"></el-option> | 
|---|
|  |  |  | <el-option label="完结" value="3"></el-option> | 
|---|
|  |  |  | <el-option label="取消" value="4"></el-option> | 
|---|
|  |  |  | </el-select> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item> | 
|---|
|  |  |  | <el-button type="primary" @click="getTableData">查询</el-button> | 
|---|
|  |  |  | <el-button type="primary" @click="resetParam">重置</el-button> | 
|---|