1、mybaits中使用小于号
1 2 |
<if test="startDateTime!=null"> and mm.ttime > to_date(#{startDateTime},'yyyy-mm-dd hh24:mi:ss')</if> <if test="endDateTime!=null"> and mm.ttime <= to_date(#{endDateTime},'yyyy-mm-dd hh24:mi:ss')</if> |
1 2 3 4 5 6 |
< < > > <> <> & & ' ' " " |
1 |
<![CDATA[ and mm.ttime > to_date(#{startDateTime},'yyyy-mm-dd hh24:mi:ss') ]]> |
2、mybatis 可以返回map类型对象
1 |
<select id="queryChannelEmpowersByPage" resultType="map" parameterType="com.pgw.dto.empower.EmpowerParamDTO"> |
3、mybaits 查询sql中in的写法
1 2 3 4 5 6 |
<if test="nodeCodes != null and nodeCodes.size>0"> and a.account in(SELECT account from t_empower where code in <foreach item="item" index="index" collection="nodeCodes" open="(" separator="," close="))"> #{item} </foreach> </if> |
4、mybatis 查询like 正规写法
1 2 3 |
<if test="targetName !=null and targetName != ''"> and a.target_name like CONCAT('%',#{targetName},'%') </if> |