码迷,mamicode.com
首页 > 编程语言 > 详细

SpringMvc的xml里关于<if>里传递多个参数(包含List、Integer、String)

时间:2020-02-18 14:48:31      阅读:95      评论:0      收藏:0      [点我收藏+]

标签:ram   close   div   ctc   cat   com   span   多个   entity   

dao层:

List<ProjectCompanyOrg> findProCompanyListByOrgIds(@Param("orgIdList") List<Integer> orgIdList, @Param("orgName") String orgName, @Param("projectId") Integer projectId);
 

xml层:

<select id="findProCompanyOrgListByOrgIds" resultType="com.highgoal.group.project.domain.entity.ProjectCompanyOrg">
    select a.id as aid,a.org_id , b.*
    from project_company_org_unti a
    join project_company_org b on a.project_company_org_id = b.project_company_org_id
    <where>
      a.del = 0 and b.del = 0
      <if test="orgIdList.size()!=0">
        and a.org_id in
        <foreach collection="orgIdList" index="index" item="item" open="(" separator="," close=")">
          #{item}
        </foreach>
      </if>
      <if test="orgName != null and orgName != ‘‘">
        and b.org_name like concat(%,concat(#{orgName},%))
      </if>
      <if test="projectId != null">
        and b.project_id = #{projectId,jdbcType=INTEGER}
      </if>
    </where>
  </select>

 

SpringMvc的xml里关于<if>里传递多个参数(包含List、Integer、String)

标签:ram   close   div   ctc   cat   com   span   多个   entity   

原文地址:https://www.cnblogs.com/supiaopiao/p/12326011.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!