实现类:
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层:文章来源:https://www.toymoban.com/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>
重点关注: 根据:北京,西安,上海,过滤数据:文章来源地址https://www.toymoban.com/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>
到了这里,关于<MyBatis>查询sq,根据某个字段,入参传list循环判断的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!