Bonus-ProtectionSetting-Manage/bonus-modules/bonus-protection/target/classes/mapper/device/DeviceBindMapper.xml

91 lines
4.5 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.canteen.core.device.mapper.DeviceBindMapper">
<resultMap type="com.bonus.canteen.core.device.domain.DeviceBind" id="DeviceBindResult">
<result property="id" column="id" />
<result property="deviceId" column="device_id" />
<result property="areaId" column="area_id" />
<result property="canteenId" column="canteen_id" />
<result property="stallId" column="stall_id" />
<result property="ifUsePrint" column="if_use_print" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDeviceBindVo">
select id, device_id, area_id, canteen_id, stall_id, if_use_print, create_by, create_time, update_by, update_time from device_bind
</sql>
<select id="selectDeviceBindList" parameterType="com.bonus.canteen.core.device.domain.DeviceBind" resultMap="DeviceBindResult">
<include refid="selectDeviceBindVo"/>
<where>
<if test="deviceId != null "> and device_id = #{deviceId}</if>
<if test="areaId != null "> and area_id = #{areaId}</if>
<if test="canteenId != null "> and canteen_id = #{canteenId}</if>
<if test="stallId != null "> and stall_id = #{stallId}</if>
<if test="ifUsePrint != null "> and if_use_print = #{ifUsePrint}</if>
</where>
</select>
<select id="selectDeviceBindById" parameterType="Long" resultMap="DeviceBindResult">
<include refid="selectDeviceBindVo"/>
where id = #{id}
</select>
<insert id="insertDeviceBind" parameterType="com.bonus.canteen.core.device.domain.DeviceBind" useGeneratedKeys="true" keyProperty="id">
insert into device_bind
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deviceId != null">device_id,</if>
<if test="areaId != null">area_id,</if>
<if test="canteenId != null">canteen_id,</if>
<if test="stallId != null">stall_id,</if>
<if test="ifUsePrint != null">if_use_print,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceId != null">#{deviceId},</if>
<if test="areaId != null">#{areaId},</if>
<if test="canteenId != null">#{canteenId},</if>
<if test="stallId != null">#{stallId},</if>
<if test="ifUsePrint != null">#{ifUsePrint},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateDeviceBind" parameterType="com.bonus.canteen.core.device.domain.DeviceBind">
update device_bind
<trim prefix="SET" suffixOverrides=",">
<if test="deviceId != null">device_id = #{deviceId},</if>
<if test="areaId != null">area_id = #{areaId},</if>
<if test="canteenId != null">canteen_id = #{canteenId},</if>
<if test="stallId != null">stall_id = #{stallId},</if>
<if test="ifUsePrint != null">if_use_print = #{ifUsePrint},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDeviceBindById" parameterType="Long">
delete from device_bind where id = #{id}
</delete>
<delete id="deleteDeviceBindByIds" parameterType="String">
delete from device_bind where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>