mybatis-plus的配置文件编写
作者:互联网
mybatis-plus的配置文件编写
这是刚入行没有偷懒工具的我面临的第一个问题,手撸xml
等值操作
<if test=' SelectDto.projectType != null and SelectDto.projectType !="" '>
and t.project_type = #{SelectDto.projectType}
</if>
模糊搜索
<if test=' SelectDto.name != null and SelectDto.name !="" '>
and t.`name` like CONCAT('%',#{SelectDto.name},'%')
</if>
in循环遍历
<if test='SelectDto.status !=null and SelectDto.status.size() > 0'>
and t.status in
<foreach item="item" collection="SelectDto.status" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
大于小于
<if test='SelectDto.payoffTime!=null and SelectDto.payoffTime!="" '>
AND t.hire_start_date <= #{SelectDto.payoffTime}
AND t.hire_end_date >= #{SelectDto.payoffTime}
</if>
结果集映射
对象套list对象
<resultMap id="SelectOneResultMap" type="com.cnpc.center.management.condition.dto.SelectOneDto">
<id column="id" property="id"/>
<result column="name" property="Name"/>
<collection property="bidAttlist" ofType="com.cnpc.center.user.entity.BidAtt">
<result column="att_id" property="attId"/>
<result column="file_name" property="fileName"/>
</collection>
</resultMap>
温馨提示
mapper方法一定要写**@Param("")** 绑定,不然xml是接受不到的哦
标签:xml,配置文件,刚入行,date,plus,SelectDto,mybatis 来源: https://blog.csdn.net/qq_41489117/article/details/111597755