<select id="getSumListByBench" resultType="com.weichai.modules.bench.entity.logbook.BenchLogBook"> select <include refid="benchLogBookColumns"/>,b.no AS "benchno",b.name AS "benchname" FROM bench_log_book a LEFT JOIN BI_WORKBENCH b on a.bench = b.id <include refid="benchLogBookJoins"/> where a.del_flag=0 <if test="benchList != null and benchList.size()>0 "> AND <foreach collection="benchList" open="(" close=")" separator="or" item="item"> a.bench = #{item} </foreach> </if> <if test="createBy != null and createBy.name != null and createBy.name != ''"> and u.name like '%'||#{createBy.name}||'%' </if> <if test="createDate != null and createDate != ''"> and a.create_date <![CDATA[>=]]> #{createDate} </if> <if test="updateDate != null and updateDate != ''"> and a.create_date <![CDATA[<=]]> #{updateDate} </if> </select>
sql的foreach示例
最新推荐文章于 2024-08-12 02:54:37 发布