<select id="findUserByUserQuveryVo" parameterType ="UserQueryVo" resultType="UserCustom">
select * from user
where username = #{userCustom.username} and sex = #{userCustom.sex}
</select>
<select id="findUserByUserQuveryVo" parameterType ="UserQueryVo" resultType="UserCustom">
select * from user
<where>
<if test="userCustom != null">
<if test="userCustom.username != null and userCustom.username != ''"><!-- 注意and不能大写 -->
and username = #{userCustom.username}
</if>
<if test="userCustom.sex != null and userCustom.sex != ''">
and sex = #{userCustom.sex}
</if>
</if>
</where>
</select>
<sql id="query_user_where">
<if test="sex != null and sex != ''">
and sex = #{sex}
</if>
<if test="id != null">
and id = #{id}
</if>
</sql>
<select id="findUserList" parameterType="User" resultType="User">
select * from user
<where>
<!-- 引用Sql片段 -->
<include refid="query_user_where"></include>
<!-- 在这里还要引用其它的sql片段 -->
<!--
where 可以自动去掉条件中的第一个and
-->
<!-- <if test="sex != null and sex != ''">
and sex = #{sex}
</if>
<if test="id != null">
and id = #{id}
</if> -->
</where>
</select>
<if test="ids != null">
<foreach collection="ids" item="user_id" open="AND (" close=")" separator="or" >
每次遍历需要拼接的串
id= #{user_id}
</foreach>
</if>
<if test="ids != null">
<foreach collection="ids" item="user_id" open="and id IN(" close=")" separator=",">
id= #{user_id}
</foreach>
</if>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有