Commit 76ac4874 authored by 吴俊凯's avatar 吴俊凯

预案执行记录分页查询

parent 494b5d5a
...@@ -33,12 +33,12 @@ public class ContingencyPlanController extends BaseController { ...@@ -33,12 +33,12 @@ public class ContingencyPlanController extends BaseController {
} }
@ApiOperation(value = "预案启动记录分页列表") @ApiOperation(value = "预案启动记录分页列表")
@RequestMapping(value = "/recordList", method = RequestMethod.POST) @RequestMapping(value = "/recordList", method = RequestMethod.GET)
public ResponseModel recordList( public ResponseModel recordList(
@ApiParam(value = "预案名称") @RequestParam(required = false) String planName, @RequestParam int current,
@RequestParam int pageNumber, @RequestParam int pageSize,
@RequestParam int pageSize) { @ApiParam(value = "预案名称") @RequestParam(required = false) String planName) {
Page page = contingencyPlanService.recordListByPage(planName,pageNumber,pageSize); Page page = contingencyPlanService.recordListByPage(current,pageSize,planName);
return CommonResponseUtil2.success(page); return CommonResponseUtil2.success(page);
} }
} }
...@@ -13,7 +13,6 @@ import com.yeejoin.amos.fas.core.enums.NumberEnum; ...@@ -13,7 +13,6 @@ import com.yeejoin.amos.fas.core.enums.NumberEnum;
import com.yeejoin.amos.fas.core.enums.ReserveEnum; import com.yeejoin.amos.fas.core.enums.ReserveEnum;
import com.yeejoin.amos.fas.dao.entity.*; import com.yeejoin.amos.fas.dao.entity.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
...@@ -34,10 +33,8 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService { ...@@ -34,10 +33,8 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
private IRiskSourceService riskSourceService; private IRiskSourceService riskSourceService;
@Autowired @Autowired
private IPlanOperationRecordDao planOperationRecordDao; private IPlanOperationRecordDao planOperationRecordDao;
@Qualifier("IEquipmentFireEquipmentDao")
@Autowired @Autowired
private IEquipmentFireEquipmentDao equipmentFireEquipmentDao; private IEquipmentFireEquipmentDao equipmentFireEquipmentDao;
@Qualifier("iEquipmentDao")
@Autowired @Autowired
private IEquipmentDao equipmentDao; private IEquipmentDao equipmentDao;
@Autowired @Autowired
...@@ -108,10 +105,10 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService { ...@@ -108,10 +105,10 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
} }
@Override @Override
public Page recordListByPage(String planName, int pageNumber, int pageSize) { public Page recordListByPage(int current, int pageSize,String planName) {
Map<String,Object> params = new HashMap<>(); Map<String,Object> params = new HashMap<>();
params.put("planName",planName); params.put("planName",planName);
params.put("pageNumber",pageNumber); params.put("offset",(current-1)*pageSize);
params.put("pageSize",pageSize); params.put("pageSize",pageSize);
List<HashMap<String,Object>> result = planOperationRecordMapper.PlanOperationRecordListByPage(params); List<HashMap<String,Object>> result = planOperationRecordMapper.PlanOperationRecordListByPage(params);
Integer count = planOperationRecordMapper.PlanOperationRecordListByCount(params); Integer count = planOperationRecordMapper.PlanOperationRecordListByCount(params);
...@@ -119,7 +116,7 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService { ...@@ -119,7 +116,7 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
page.setRecords(result); page.setRecords(result);
page.setTotal(count); page.setTotal(count);
page.setSize(pageSize); page.setSize(pageSize);
page.setPages(pageNumber); page.setCurrent(current);
return page; return page;
} }
......
...@@ -14,5 +14,5 @@ public interface ContingencyPlanService { ...@@ -14,5 +14,5 @@ public interface ContingencyPlanService {
ContingencyPlanParamVo equipmentScene(Long equipmentId); ContingencyPlanParamVo equipmentScene(Long equipmentId);
Page recordListByPage (String planName, int pageNumber, int pageSize); Page recordListByPage (int current, int pageSize,String planName);
} }
...@@ -17,18 +17,12 @@ ...@@ -17,18 +17,12 @@
<where> <where>
<if test="planName !=null and planName != ''"> ( detail.plan_name like concat(concat("%",#{planName}),"%"))</if> <if test="planName !=null and planName != ''"> ( detail.plan_name like concat(concat("%",#{planName}),"%"))</if>
</where> </where>
limit #{pageNumber} * #{pageSize}, limit #{offset},#{pageSize}
</select> </select>
<select id="PlanOperationRecordListByCount" parameterType="hashmap" resultType="java.lang.Integer"> <select id="PlanOperationRecordListByCount" parameterType="hashmap" resultType="java.lang.Integer">
SELECT SELECT
record.batch_No AS batchNo, COUNT(*)
detail.plan_name AS planName,
original.fire_Equipment_Name AS fireEquipmentName,
record.start_time AS startTime,
TIMESTAMPDIFF(second,record.start_time,record.end_time) as executionTime,
record.plan_pattern as planPattern,
'' AS executionType
FROM FROM
`c_plan_operation_record` record `c_plan_operation_record` record
LEFT JOIN c_plan_detail detail ON detail.id = record.plan_id LEFT JOIN c_plan_detail detail ON detail.id = record.plan_id
...@@ -36,6 +30,5 @@ ...@@ -36,6 +30,5 @@
<where> <where>
<if test="planName !=null and planName != ''"> ( detail.plan_name like concat(concat("%",#{planName}),"%"))</if> <if test="planName !=null and planName != ''"> ( detail.plan_name like concat(concat("%",#{planName}),"%"))</if>
</where> </where>
limit #{pageNumber} * #{pageSize},
</select> </select>
</mapper> </mapper>
\ No newline at end of file
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