版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhengTornado/article/details/82414764
dao接口中定义了3个参数,一个是对象类型,其余2个是基本类型
public List<MaintainAndDevice> queryMaintainDevice(@Param("mad")MaintainAndDevice mad,
@Param("page")Integer page,@Param("limit")Integer limit);
多个参数:使用注解的方式实现
实体对象:实体对象跟普通类型参数传递方法一样,只是在用的时候,以 对象名.(点)对象属性名 的方式调用就可以了。
<select id="queryMaintainDevice" resultType="com.zxhzn.firecontrol.fireMaintain.entity.MaintainAndDevice">
select
f.wid,f.fdid,f.wdate,f.reason,f.state,f.opuser,
d.region,d.devices_number,d.devices_type,d.devices_person_name
from sys_fire_maintain f
left join sys_devices d
on f.fdid=d.devices_id
<where>
<if test="mad.state != null and mad.state !='' ">
and f.state = #{mad.state,jdbcType=VARCHAR}
</if>
<if test="mad.devicesPersonName != null and mad.devicesPersonName != '' ">
and d.devices_person_name = #{mad.devicesPersonName,jdbcType=VARCHAR}
</if>
<if test="mad.startTime != null and mad.startTime !=''">
and f.wdate > str_to_date(#{mad.startTime}, '%Y-%m-%d %H')
</if>
<if test="mad.endTime != null and mad.endTime !=''">
and f.wdate <= str_to_date(#{mad.endTime}, '%Y-%m-%d %H')
</if>
</where>
limit #{page},#{limit}
</select>