Commit 5c981e10 authored by 高建强's avatar 高建强

item:监督检查项新增分页方法

parent d925197c
......@@ -231,6 +231,28 @@ public class InputItemController extends AbstractBaseController {
}
/**
* 分页查询检查项
*
* @param queryRequests
* @param pageable
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "分页查询检查项", notes = "分页查询检查项")
@RequestMapping(value = "/queryPage", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse queryPage(
@ApiParam(value = "组合查询条件", required = false, defaultValue = "[]") @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = false, defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
HashMap<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("orgCode", loginOrgCode);
InputItemPageParam criterias = InputItemParamUtil.fillInputItemPageParam(queryRequests, pageable, paramMap);
Page<InputItemVo> page = inputItemService.queryPage(criterias);
return CommonResponseUtil.success(page);
}
/**
* 条件查询检查项
*
* @param queryRequests
......
......@@ -40,4 +40,8 @@ public interface InputItemMapper {
List<Long> getIds();
List<InputItem> findByIdIn(@Param("list") List<Long> inputItemIds);
long queryPageCount(InputItemPageParam param);
List<InputItemVo> queryPage(InputItemPageParam param);
}
......@@ -277,4 +277,12 @@ public class InputItemServiceImpl implements IInputItemService {
inputItemMapper.updatePointById(param);
}
@Override
public Page<InputItemVo> queryPage(InputItemPageParam param) {
long total = inputItemMapper.queryPageCount(param);
List<InputItemVo> content = inputItemMapper.queryPage(param);
Page<InputItemVo> result = new PageImpl<InputItemVo>(content, param, total);
return result;
}
}
......@@ -51,28 +51,29 @@ public class RoutePointItemServiceImpl implements IRoutePointItemService {
if (CollectionUtils.isNotEmpty(inputItemIds) && routeId != null && planId != null) {
if (status) {
planDao.updatePlanStatus(PlanStatusEnum.EXAMINE_DEVELOPED.getValue(), planId);
}
// routePointItemDao.deleteByPlanId(planId);
List<InputItem> inputItemList = inputItemMapper.findByIdIn(inputItemIds);
List<RoutePoint> routePointList = routePointDao.findByRouteId(routeId);
if (CollectionUtils.isNotEmpty(inputItemList) && CollectionUtils.isNotEmpty(routePointList)) {
List<RoutePointItem> list = new ArrayList<>();
routePointList.stream().forEach(route -> {
Long routePointId = route.getId();
inputItemList.stream().forEach(item -> {
RoutePointItem routePointItem = new RoutePointItem();
routePointItem.setPlanId(planId);
routePointItem.setInputItemId(item.getId());
routePointItem.setBasisJson(item.getBasisJson());
routePointItem.setOrderNo(item.getOrderNo());
routePointItem.setRoutePointId(routePointId);
routePointItem.setCreatorId(userId);
routePointItem.setCreateDate(new Date());
list.add(routePointItem);
} else {
List<InputItem> inputItemList = inputItemMapper.findByIdIn(inputItemIds);
List<RoutePoint> routePointList = routePointDao.findByRouteId(routeId);
if (CollectionUtils.isNotEmpty(inputItemList) && CollectionUtils.isNotEmpty(routePointList)) {
List<RoutePointItem> list = new ArrayList<>();
routePointList.stream().forEach(route -> {
Long routePointId = route.getId();
inputItemList.stream().forEach(item -> {
RoutePointItem routePointItem = new RoutePointItem();
routePointItem.setPlanId(planId);
routePointItem.setInputItemId(item.getId());
routePointItem.setBasisJson(item.getBasisJson());
routePointItem.setOrderNo(item.getOrderNo());
routePointItem.setRoutePointId(routePointId);
routePointItem.setCreatorId(userId);
routePointItem.setCreateDate(new Date());
list.add(routePointItem);
});
});
});
return routePointItemDao.saveAll(list);
return routePointItemDao.saveAll(list);
}
}
// routePointItemDao.deleteByPlanId(planId);
}
return Lists.newArrayList();
}
......
......@@ -118,4 +118,6 @@ public interface IInputItemService {
List getItemParent(String id);
void updatePointById(Map<String, Object> param);
Page<InputItemVo> queryPage(InputItemPageParam criterias);
}
......@@ -333,4 +333,47 @@
</if>
</where>
</select>
<!--统计 -->
<select id="queryPageCount" resultType="long">
SELECT
count(1) AS total_num
FROM
p_input_item a
WHERE
a.is_delete = '0'
AND a.input_type != '1'
<if test="name!=null and name!=''"> and a.name like concat(concat("%",#{name}),"%")</if>
<if test="itemNo!=null"> and a.item_no like concat(concat("%",#{itemNo}),"%")</if>
<if test="itemType!=null"> and a.item_Type = #{itemType} </if>
<if test="checkTypeId!=null and checkTypeId!=''"> and a.check_type_id = #{checkTypeId} </if>
<if test="itemStart!=null"> and a.item_start = #{itemStart} </if>
<!--<if test="orgCode!=null"> and a.org_Code = #{orgCode}</if>-->
<if test="itemClassify != null"> and a.item_classify = #{itemClassify}</if>
<if test="itemTypeClassifyIds != null"> and FIND_IN_SET(#{itemTypeClassifyIds}, a.item_type_classify_ids)</if>
<if test="planId != null">and a.id NOT IN ( SELECT p.input_item_id FROM p_route_point_item p WHERE p.plan_id = #{planId} )</if>
</select>
<!--查询 -->
<select id="queryPage" resultType="com.yeejoin.amos.supervision.business.vo.InputItemVo">
SELECT
a.*
FROM
p_input_item a
WHERE
a.is_delete = '0'
AND a.input_type != '1'
<if test="name!=null and name!=''"> and a.name like concat(concat("%",#{name}),"%")</if>
<if test="itemNo!=null"> and a.item_no like concat(concat("%",#{itemNo}),"%")</if>
<if test="itemType!=null"> and a.item_Type = #{itemType} </if>
<if test="checkTypeId!=null and checkTypeId!=''"> and a.check_type_id = #{checkTypeId} </if>
<if test="itemStart!=null"> and a.item_start = #{itemStart} </if>
<!--<if test="orgCode!=null"> and a.org_Code = #{orgCode}</if>-->
<if test="itemClassify != null"> and a.item_classify = #{itemClassify}</if>
<if test="itemTypeClassifyIds != null"> and FIND_IN_SET(#{itemTypeClassifyIds}, a.item_type_classify_ids)</if>
<if test="planId != null">and a.id NOT IN ( SELECT p.input_item_id FROM p_route_point_item p WHERE p.plan_id = #{planId} )</if>
order by a.id desc
<choose>
<when test="pageSize==-1"></when>
<when test="pageSize!=-1">limit #{offset},#{pageSize}</when>
</choose>
</select>
</mapper>
\ No newline at end of file
......@@ -52,9 +52,8 @@
LEFT JOIN p_input_item i ON i.id = pi.input_item_id
<where>
<if test="name!=null"> and i.name like concat(concat("%",#{name}),"%")</if>
<if test="itemTypeClassifyIds != null and itemTypeClassifyIds != ''"> and i.item_type_classify_ids = #{itemTypeClassifyIds}</if>
<if test="planId!=null"> and pi.plan_id = #{planId} </if>
<if test="orgCode!=null"> and i.org_Code = #{orgCode}</if>
<!-- <if test="orgCode!=null"> and i.org_Code = #{orgCode}</if>-->
</where>
</select>
<!--查询 -->
......@@ -73,9 +72,8 @@
LEFT JOIN p_input_item i ON i.id = pi.input_item_id
<where>
<if test="name!=null"> and i.name like concat(concat("%",#{name}),"%")</if>
<if test="itemTypeClassifyIds != null and itemTypeClassifyIds != ''"> and i.item_type_classify_ids = #{itemTypeClassifyIds}</if>
<if test="planId!=null"> and pi.plan_id = #{planId} </if>
<if test="orgCode!=null"> and i.org_Code = #{orgCode}</if>
<!-- <if test="orgCode!=null"> and i.org_Code = #{orgCode}</if>-->
</where>
<choose>
<when test="pageSize==-1"></when>
......
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