1:定义好的sql片段
<sql id="sqlid">
res_type_id,res_type
</sql>
2:下发过引入
<select id="selectbyId" resultType="com.property.vo.PubResTypeVO">
select
<include refid="sqlid"/>
from pub_res_type
</select>
resultType:对应的实体
parameterType="参数类型"
resultMap=:实体类与数据库对应的字段,
<if test="projectRequestDTO.before != null and projectRequestDTO.before != ‘‘">
and tp.annual >= #{projectRequestDTO.before}
</if>
标签 只是判断null 和空的 话用 双引号
<if test=‘yjCode == "B"and orgCode != "LFKJYGWH" ‘>
AND t.org_code NOT IN(‘LFKJYGWH‘)
</if>
如果需要判断 具体的值需要最外围‘‘具体值双引号
<foreach collection="tbMarketAccess.accessTypeCodeList" item="item" open="(" separator="or" close=")">
access_type_code like CONCAT(‘%‘, #{item},‘%‘)
</foreach>
模糊查询 conCat
item:变量
open="("
close=")
原文:https://www.cnblogs.com/shuai1230/p/14180398.html