Commit 55cb460e authored by chenzhao's avatar chenzhao

优化代码 调整分页

parent a26b587a
......@@ -35,22 +35,6 @@ public interface FailureDetailsMapper extends BaseMapper<FailureDetails> {
/**
* WEB端查询全部 分页
*
* @param current 当前页
* @param currentStatus 当前任务状态
* @param startTime 起始时间
* @param endTime 结束时间
* @param submissionPid 报送人
* @param submissionBranchId 报送部门
* @param sequenceNbr 故障单号
* @return
*/
List<FailureDetails> selectWebAll(Long current,Long size, Long currentStatus,
String startTime,String endTime, String submissionName,Integer submissionBranchId,
Long sequenceNbr);
/**
* 查询我发起的 分页
......
......@@ -31,41 +31,7 @@
order by submission_time DESC limit #{current},#{size}
</select>
<select id="selectWebAll" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
SELECT
sequence_nbr,
current_status,
failure_equipment_id,
failure_equipment,
fault_time,
fault_phenomenon,
submission_name,
submission_pid,
biz_code,
submission_time,
submission_branch,
submission_branch_id
FROM
cb_failure_details
<where>
<if test="currentStatus!= null ">
and current_status = #{currentStatus}
</if>
<if test="startTime!= null and endTime != null">
and submission_time between #{startTime} and #{endTime}
</if>
<if test="submissionName!= null ">
and submission_name = #{submissionName}
</if>
<if test="submissionBranchId!= null ">
and submission_branch_id= #{submissionBranchId}
</if>
<if test="sequenceNbr!= null ">
and sequence_nbr = #{sequenceNbr}
</if>
</where>
order by submission_time DESC limit #{current},#{size}
</select>
<select id="selectISubPage" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
......
......@@ -145,6 +145,7 @@ public class FailureDetailsController extends BaseController {
failureDetailsDtoList.add(failureDetailsDto);
});
failureDetailDTOsIPage.setRecords(failureDetailsDtoList);
failureDetailDTOsIPage.setTotal(failureDetailsIPage.getTotal());
return ResponseHelper.buildResponse(failureDetailDTOsIPage);
}
......@@ -259,7 +260,7 @@ public class FailureDetailsController extends BaseController {
String endTime,
Integer submissionBranchId,
Long sequenceNbr ) {
Page<FailureDetails> page = new Page<FailureDetails>();
Page<FailureDetailsDto> page = new Page<>();
if (current > 0) {
page.setCurrent((current - 1) * size);
} else {
......@@ -270,11 +271,11 @@ public class FailureDetailsController extends BaseController {
ReginParams userInfo = getSelectedOrgInfo();
IPage<FailureDetailsDto> failureDetailDTOsIPage = new Page<>();
IPage<FailureDetails> failureDetailsIPage = failureDetailsServiceImpl.queryForPageList(page, userInfo,
IPage<FailureDetailsDto> failureDetailsIPage = failureDetailsServiceImpl.queryForPageList(page, userInfo,
currentStatus, startTime, endTime, submissionName,submissionBranchId,sequenceNbr);
BeanUtils.copyProperties(failureDetailsIPage, FailureDetailsDto.class);
List<FailureDetails> records = failureDetailsIPage.getRecords();
List<FailureDetailsDto> records = failureDetailsIPage.getRecords();
List<FailureDetailsDto> failureDetailsDtoList = new ArrayList<>();
records.forEach(failureDetails -> {
FailureDetailsDto failureDetailsDto = new FailureDetailsDto();
......@@ -285,6 +286,7 @@ public class FailureDetailsController extends BaseController {
failureDetailsDtoList.add(failureDetailsDto);
});
failureDetailDTOsIPage.setRecords(failureDetailsDtoList);
failureDetailDTOsIPage.setTotal(failureDetailsIPage.getTotal());
return ResponseHelper.buildResponse(failureDetailDTOsIPage);
}
......
......@@ -104,16 +104,15 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
return this.queryForWaitManage(page, userInfo, currentStatus, startTime, endTime, userId);
}
public IPage<FailureDetails> queryForPageList(Page<FailureDetails> page, ReginParams userInfo, Long currentStatus,
/**
* web端列表查询
*/
public IPage<FailureDetailsDto> queryForPageList(Page<FailureDetailsDto> page, ReginParams userInfo, Long currentStatus,
String startTime, String endTime, String submissionName, Integer submissionBranchId,
Long sequenceNbr ) {
return queryForPage(page,"",false,currentStatus,startTime, endTime, submissionName,submissionBranchId,sequenceNbr);
List<FailureDetails> list =baseMapper.selectWebAll(page.getCurrent(), page.getSize(), currentStatus, startTime, endTime, submissionName,submissionBranchId,sequenceNbr);
IPage<FailureDetails> iPage = new Page<>();
iPage.setRecords(list);
return iPage;
}
/**
......
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