mybatis-模糊查詢like CONCAT

ZHOU_VIP發表於2018-10-18
<select id="queryAllOsmDevOplogByPara" resultType="com.zte.claa.infiboss.app.model.osm.OsmDevOplog">
	   SELECT   t.DEVEUI AS deveui, 
		    t.DEVTYPE AS devType, 
		    t.ORDNO AS ordNo, 
		    t.CLAANO AS claaNo, 
		    t.OPTIME AS opTime, 
		    t.REMARK AS remark, 
		    t.OPDESCP AS opDescp, 
		    t.OPERATOR AS operator,
		    t.USERID AS userid,
		    t.OPFLAG AS opFlag,
		    u.USERNAME AS username
	   FROM  t_osm_dev_oplog t LEFT JOIN t_cgs_sm_user u 
	   ON t.USERID = u.USERID 
	   WHERE 1 = 1 
	  <if test='para.deveui != null and para.deveui != "" '>
		 AND t.DEVEUI = #{para.deveui, jdbcType=VARCHAR} 
	  </if>
	  <if test='para.ordNo != null and para.ordNo != "" '>
		 AND t.ORDNO = #{para.ordNo, jdbcType=VARCHAR} 
	  </if>
	  <if test='para.opDescp != null and para.opDescp != "" '>
		 AND t.OPDESCP like CONCAT('%',#{para.opDescp, jdbcType=VARCHAR},'%')
	  </if>
	  ORDER BY t.OPTIME DESC  
</select>

 

相關文章