public JsonData selectFileList(Integer page, Integer rows, String [] bizTypes) {
page = (page == null || page <= 0) ? 1 : page;
rows = (rows == null || rows <= 0) ? 1 : rows;
Integer rowNumFrom= (page - 1) * rows + 1;
Integer rowNumTo= page * rows;
Map<String,Object> paramMap= new HashMap<String,Object>();
paramMap.put("bizTypes",bizTypes);
Integer total = this.selectUploadFileCount(paramMap);
Integer maxPage = (total + rows - 1) / rows;
paramMap.put("rowNumFrom", rowNumFrom);
paramMap.put("rowNumTo", rowNumTo);
List<Uploads> list = this.selectUploadFileList(paramMap);
Map<String,Object> data= new HashMap<String,Object>();
data.put("page",page);
data.put("total",total);
data.put("maxPage",maxPage);
data.put("list",list);
return JsonData.success(null,data);
}
private Integer selectUploadFileCount(Map<String,Object> paramMap){
return uploadsMapper.selectUploadFileCount(paramMap);
}
private List<Uploads> selectUploadFileList(Map<String,Object> paramMap){
return uploadsMapper.selectUploadFileList(paramMap);
}
select
row_num,<include refid="Base_Column_List" />
from
(select rownum as row_num, t.*
from t_uploads t
where 1 = 1
and t.state = '1'
<if test=" bizTypes != null and bizTypes.length > 0 ">
<foreach item="item" collection="bizTypes" open=" and (" separator="or" close=")">
<if test=" item!=null and item !='' ">
t.biz_type = #{item}
</if>
</foreach>
</if>
and rownum <= #{rowNumTo, jdbcType = INTEGER})
where row_num >= #{rowNumFrom, jdbcType = INTEGER}