mybatis中提取公共的sql方法
属于一个封装的标签,可以用于下面有重复条件的,这个可以简化mybatis中的代码量,调用的时候使用来进行调用!!!
<sql id="common_where_if">
<if test="province != '全国' and province != null">
wo_province = #{province}
</if>
<if test="orderType != '全部' and orderType != null">
and wo_type = #{orderType}
</if>
<if test="email != ''">
and wo_responsibility = #{email}
</if>
</sql>
<select id = "getUserEmailByProvinceAndOrderType" resultType="String">
select DISTINCT(wo_responsibility) from t_view_workorder
<where>
<include refid="common_where_if"/>
</where>
</select>
这篇文章做一个小小的记录