Bonus-Cloud-JYY-Smart-Canteen/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenWasteDealMapper.xml

121 lines
6.9 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.kitchen.mapper.KitchenWasteDealMapper">
<resultMap type="com.bonus.canteen.core.kitchen.domain.KitchenWasteDeal" id="KitchenWasteDealResult">
<result property="wasteId" column="waste_id" />
<result property="weight" column="weight" />
<result property="garbageName" column="garbage_name" />
<result property="actionDate" column="action_date" />
<result property="deviceId" column="device_id" />
<result property="mealtimeType" column="mealtime_type" />
<result property="canteenId" column="canteen_id" />
<result property="areaId" column="area_id" />
<result property="dealType" column="deal_type" />
<result property="saleAmount" column="sale_amount" />
<result property="scenePicture" column="scene_picture" />
<result property="staffId" column="staff_id" />
<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="selectKitchenWasteDealVo">
select waste_id, weight, garbage_name, action_date, device_id, mealtime_type, canteen_id, area_id, deal_type, sale_amount, scene_picture, staff_id, create_by, create_time, update_by, update_time from kitchen_waste_deal
</sql>
<select id="selectKitchenWasteDealList" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenWasteDeal" resultMap="KitchenWasteDealResult">
<include refid="selectKitchenWasteDealVo"/>
<where>
<if test="weight != null "> and weight = #{weight}</if>
<if test="garbageName != null and garbageName != ''"> and garbage_name like concat('%', #{garbageName}, '%')</if>
<if test="actionDate != null "> and action_date = #{actionDate}</if>
<if test="deviceId != null "> and device_id = #{deviceId}</if>
<if test="mealtimeType != null "> and mealtime_type = #{mealtimeType}</if>
<if test="canteenId != null "> and canteen_id = #{canteenId}</if>
<if test="areaId != null "> and area_id = #{areaId}</if>
<if test="dealType != null "> and deal_type = #{dealType}</if>
<if test="saleAmount != null "> and sale_amount = #{saleAmount}</if>
<if test="scenePicture != null and scenePicture != ''"> and scene_picture = #{scenePicture}</if>
<if test="staffId != null "> and staff_id = #{staffId}</if>
</where>
</select>
<select id="selectKitchenWasteDealByWasteId" parameterType="Long" resultMap="KitchenWasteDealResult">
<include refid="selectKitchenWasteDealVo"/>
where waste_id = #{wasteId}
</select>
<insert id="insertKitchenWasteDeal" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenWasteDeal" useGeneratedKeys="true" keyProperty="wasteId">
insert into kitchen_waste_deal
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="weight != null">weight,</if>
<if test="garbageName != null and garbageName != ''">garbage_name,</if>
<if test="actionDate != null">action_date,</if>
<if test="deviceId != null">device_id,</if>
<if test="mealtimeType != null">mealtime_type,</if>
<if test="canteenId != null">canteen_id,</if>
<if test="areaId != null">area_id,</if>
<if test="dealType != null">deal_type,</if>
<if test="saleAmount != null">sale_amount,</if>
<if test="scenePicture != null">scene_picture,</if>
<if test="staffId != null">staff_id,</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="weight != null">#{weight},</if>
<if test="garbageName != null and garbageName != ''">#{garbageName},</if>
<if test="actionDate != null">#{actionDate},</if>
<if test="deviceId != null">#{deviceId},</if>
<if test="mealtimeType != null">#{mealtimeType},</if>
<if test="canteenId != null">#{canteenId},</if>
<if test="areaId != null">#{areaId},</if>
<if test="dealType != null">#{dealType},</if>
<if test="saleAmount != null">#{saleAmount},</if>
<if test="scenePicture != null">#{scenePicture},</if>
<if test="staffId != null">#{staffId},</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="updateKitchenWasteDeal" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenWasteDeal">
update kitchen_waste_deal
<trim prefix="SET" suffixOverrides=",">
<if test="weight != null">weight = #{weight},</if>
<if test="garbageName != null and garbageName != ''">garbage_name = #{garbageName},</if>
<if test="actionDate != null">action_date = #{actionDate},</if>
<if test="deviceId != null">device_id = #{deviceId},</if>
<if test="mealtimeType != null">mealtime_type = #{mealtimeType},</if>
<if test="canteenId != null">canteen_id = #{canteenId},</if>
<if test="areaId != null">area_id = #{areaId},</if>
<if test="dealType != null">deal_type = #{dealType},</if>
<if test="saleAmount != null">sale_amount = #{saleAmount},</if>
<if test="scenePicture != null">scene_picture = #{scenePicture},</if>
<if test="staffId != null">staff_id = #{staffId},</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 waste_id = #{wasteId}
</update>
<delete id="deleteKitchenWasteDealByWasteId" parameterType="Long">
delete from kitchen_waste_deal where waste_id = #{wasteId}
</delete>
<delete id="deleteKitchenWasteDealByWasteIds" parameterType="String">
delete from kitchen_waste_deal where waste_id in
<foreach item="wasteId" collection="array" open="(" separator="," close=")">
#{wasteId}
</foreach>
</delete>
</mapper>