//分页数据组装
Container<Map<String,Object>> container = new Container<Map<String,Object>>();
List<Map<String,Object>> auditModelList = cmApplicationRepo.findAuditList(params);
for(Map<String,Object> audit:auditModelList){
//设置是否关注过
Long auditId = Long.parseLong(audit.get("auditId").toString());
Long auditPersonId = Long.parseLong(params.get("auditPersonId").toString());
Map<String, Object> followMap = new HashMap<String,Object>();
followMap.put("sourceType", DictConstants.FOLLOW_SOURCE_TYPE.FOLLOW_APPLICATION);
followMap.put("sourceId", auditId);
followMap.put("userId", auditPersonId);
List<BizFollowModel> followList = bizFollowService.find(followMap);
if(followList!= null && followList.size()>0){
audit.put("isFollow", "true");
}else{
audit.put("isFollow", "false");
}
}
container.setList(auditModelList);
container.setTotalNum(cmApplicationRepo.countAuditListNumber(params));
return container;
}
@Override
public List<Map<String,Object>> findAuditList(Map<String, Object> map) {
return findList("getAuditList", map);
}
xml
<!-- 查询申请列表-->
<select resultType="java.util.Map" parameterType="map">
select
a.ID AS id,
a.STATE AS stateCode, b.DICT_VALUE AS stateValue,
a.ITEM AS itemCode, c.DICT_VALUE AS itemValue,
a.TYPE AS typeCode, d.DICT_VALUE AS typeValue,
a.APP_PERSON_ID AS appPersonId,
a.CREATE_TIME AS createTime
from cm_application a
LEFT JOIN cm_dict_type b on a.STATE = b.DICT_CODE AND b.TYPE = \'Application_State\'
LEFT JOIN cm_dict_type c on a.ITEM = c.DICT_CODE
LEFT JOIN cm_dict_type d on a.TYPE = d.DICT_CODE
where 1=1
<if test="item != null" >
and a.ITEM = #{item,jdbcType=VARCHAR}
</if>
<if test="type != null" >
and a.TYPE IN
<foreach item="typeArray" index="index" collection="type" open="(" separator="," close=")">
#{typeArray}
</foreach>
</if>
<if test="appPersonId != null" >
and a.APP_PERSON_ID = #{appPersonId,jdbcType=BIGINT}
</if>
<if test="state != null" >
and a.STATE IN
<foreach item="stateArray" index="index" collection="state" open="(" separator="," close=")">
#{stateArray}
</foreach>
</if>
<!-- 分页查询时,要选择createTime在starCreateTime和endCreatetTime之间的记录 -->
<if test="startCreateTime != null" >
and a.CREATE_TIME >= #{startCreateTime,jdbcType=TIMESTAMP}
</if>
<if test="endCreateTime != null" >
and a.CREATE_TIME <= #{endCreateTime,jdbcType=TIMESTAMP}
</if>
order by a.ID
<include refid="Paging" />
</select>