實現(xiàn)類:
public PageInfo<Map<String, Object>> selectFormData(HttpServletRequest request,Map<String, Object> paramMap) {
List<String> regionList = Arrays.asList("北京","西安","上海");
paramMap.put("regionList", regionList);
CommonUtil.getPageHelper(paramMap); // 分頁
List<Map<String, Object>> deptInfo = questionListMapper.selectFormData(paramMap);
PageInfo<Map<String, Object>> result = new PageInfo<>(deptInfo);
return result;
}
Mapper類:
List<Map<String, Object>> selectFormData(Map<String, Object> paramMap);
Mybatis層:文章來源:http://www.zghlxwxcb.cn/news/detail-510646.html
<select id="selectFormData" parameterType="map" resultType="map">
select * from bcg_question_list_form_data
where (processID IS NOT NULL)
and not(taskDefKey = #{taskDefKey} and xxApprovalResult = #{xxApprovalResult})
<include refid="selectValue"/>
<if test = "null != regionList and regionList.size > 0">
and region in
<foreach collection="regionList" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
order by statuSort,createTimeSecond desc
</select>
重點關(guān)注: 根據(jù):北京,西安,上海,過濾數(shù)據(jù):文章來源地址http://www.zghlxwxcb.cn/news/detail-510646.html
<if test = "null != regionList and regionList.size > 0">
and region in
<foreach collection="regionList" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
到了這里,關(guān)于<MyBatis>查詢sq,根據(jù)某個字段,入?yún)鱨ist循環(huán)判斷的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!