HashMap e965c9c35c feat(module): 饲喂管理 - 配方管理
完成饲喂管理模块中的配方管理部分
2025-08-12 15:55:22 +08:00

137 lines
8.3 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.zhyc.module.feed.mapper.SgFeedPlanMapper">
<resultMap type="SgFeedPlan" id="SgFeedPlanResult">
<result property="createDate" column="create_date" />
<result property="formulaId" column="formula_id" />
<result property="sheepHouseId" column="sheep_house_id" />
<result property="sheepCount" column="sheep_count" />
<result property="planDailySize" column="plan_daily_size" />
<result property="planMorningSize" column="plan_morning_size" />
<result property="planMorningTotal" column="plan_morning_total" />
<result property="ratioMorning" column="ratio_morning" />
<result property="actualMorningSize" column="actual_morning_size" />
<result property="planNoonSize" column="plan_noon_size" />
<result property="planNoonTotal" column="plan_noon_total" />
<result property="actualNoonSize" column="actual_noon_size" />
<result property="ratioNoon" column="ratio_noon" />
<result property="planAfternoonSize" column="plan_afternoon_size" />
<result property="planAfternoonTotal" column="plan_afternoon_total" />
<result property="actualAfternoonSize" column="actual_afternoon_size" />
<result property="ratioAfternoon" column="ratio_afternoon" />
<result property="planFeedTotal" column="plan_feed_total" />
<result property="zookeeper" column="zookeeper" />
<result property="planDate" column="plan_date" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSgFeedPlanVo">
select create_date, formula_id, sheep_house_id, sheep_count, plan_daily_size, plan_morning_size, plan_morning_total, ratio_morning, actual_morning_size, plan_noon_size, plan_noon_total, actual_noon_size, ratio_noon, plan_afternoon_size, plan_afternoon_total, actual_afternoon_size, ratio_afternoon, plan_feed_total, zookeeper, plan_date, remark from sg_feed_plan
</sql>
<select id="selectSgFeedPlanList" parameterType="SgFeedPlan" resultMap="SgFeedPlanResult">
<include refid="selectSgFeedPlanVo"/>
<where>
<if test="formulaId != null and formulaId != ''"> and formula_id = #{formulaId}</if>
<if test="sheepHouseId != null "> and sheep_house_id = #{sheepHouseId}</if>
<if test="zookeeper != null and zookeeper != ''"> and zookeeper = #{zookeeper}</if>
<if test="planDate != null "> and plan_date = #{planDate}</if>
</where>
</select>
<select id="selectSgFeedPlanByCreateDate" parameterType="Date" resultMap="SgFeedPlanResult">
<include refid="selectSgFeedPlanVo"/>
where create_date = #{createDate}
</select>
<insert id="insertSgFeedPlan" parameterType="SgFeedPlan">
insert into sg_feed_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createDate != null">create_date,</if>
<if test="formulaId != null and formulaId != ''">formula_id,</if>
<if test="sheepHouseId != null">sheep_house_id,</if>
<if test="sheepCount != null">sheep_count,</if>
<if test="planDailySize != null">plan_daily_size,</if>
<if test="planMorningSize != null">plan_morning_size,</if>
<if test="planMorningTotal != null">plan_morning_total,</if>
<if test="ratioMorning != null">ratio_morning,</if>
<if test="actualMorningSize != null">actual_morning_size,</if>
<if test="planNoonSize != null">plan_noon_size,</if>
<if test="planNoonTotal != null">plan_noon_total,</if>
<if test="actualNoonSize != null">actual_noon_size,</if>
<if test="ratioNoon != null">ratio_noon,</if>
<if test="planAfternoonSize != null">plan_afternoon_size,</if>
<if test="planAfternoonTotal != null">plan_afternoon_total,</if>
<if test="actualAfternoonSize != null">actual_afternoon_size,</if>
<if test="ratioAfternoon != null">ratio_afternoon,</if>
<if test="planFeedTotal != null">plan_feed_total,</if>
<if test="zookeeper != null">zookeeper,</if>
<if test="planDate != null">plan_date,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="createDate != null">#{createDate},</if>
<if test="formulaId != null and formulaId != ''">#{formulaId},</if>
<if test="sheepHouseId != null">#{sheepHouseId},</if>
<if test="sheepCount != null">#{sheepCount},</if>
<if test="planDailySize != null">#{planDailySize},</if>
<if test="planMorningSize != null">#{planMorningSize},</if>
<if test="planMorningTotal != null">#{planMorningTotal},</if>
<if test="ratioMorning != null">#{ratioMorning},</if>
<if test="actualMorningSize != null">#{actualMorningSize},</if>
<if test="planNoonSize != null">#{planNoonSize},</if>
<if test="planNoonTotal != null">#{planNoonTotal},</if>
<if test="actualNoonSize != null">#{actualNoonSize},</if>
<if test="ratioNoon != null">#{ratioNoon},</if>
<if test="planAfternoonSize != null">#{planAfternoonSize},</if>
<if test="planAfternoonTotal != null">#{planAfternoonTotal},</if>
<if test="actualAfternoonSize != null">#{actualAfternoonSize},</if>
<if test="ratioAfternoon != null">#{ratioAfternoon},</if>
<if test="planFeedTotal != null">#{planFeedTotal},</if>
<if test="zookeeper != null">#{zookeeper},</if>
<if test="planDate != null">#{planDate},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSgFeedPlan" parameterType="SgFeedPlan">
update sg_feed_plan
<trim prefix="SET" suffixOverrides=",">
<if test="formulaId != null and formulaId != ''">formula_id = #{formulaId},</if>
<if test="sheepHouseId != null">sheep_house_id = #{sheepHouseId},</if>
<if test="sheepCount != null">sheep_count = #{sheepCount},</if>
<if test="planDailySize != null">plan_daily_size = #{planDailySize},</if>
<if test="planMorningSize != null">plan_morning_size = #{planMorningSize},</if>
<if test="planMorningTotal != null">plan_morning_total = #{planMorningTotal},</if>
<if test="ratioMorning != null">ratio_morning = #{ratioMorning},</if>
<if test="actualMorningSize != null">actual_morning_size = #{actualMorningSize},</if>
<if test="planNoonSize != null">plan_noon_size = #{planNoonSize},</if>
<if test="planNoonTotal != null">plan_noon_total = #{planNoonTotal},</if>
<if test="actualNoonSize != null">actual_noon_size = #{actualNoonSize},</if>
<if test="ratioNoon != null">ratio_noon = #{ratioNoon},</if>
<if test="planAfternoonSize != null">plan_afternoon_size = #{planAfternoonSize},</if>
<if test="planAfternoonTotal != null">plan_afternoon_total = #{planAfternoonTotal},</if>
<if test="actualAfternoonSize != null">actual_afternoon_size = #{actualAfternoonSize},</if>
<if test="ratioAfternoon != null">ratio_afternoon = #{ratioAfternoon},</if>
<if test="planFeedTotal != null">plan_feed_total = #{planFeedTotal},</if>
<if test="zookeeper != null">zookeeper = #{zookeeper},</if>
<if test="planDate != null">plan_date = #{planDate},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where create_date = #{createDate}
</update>
<delete id="deleteSgFeedPlanByCreateDate" parameterType="Date">
delete from sg_feed_plan where create_date = #{createDate}
</delete>
<delete id="deleteSgFeedPlanByCreateDates" parameterType="String">
delete from sg_feed_plan where create_date in
<foreach item="createDate" collection="array" open="(" separator="," close=")">
#{createDate}
</foreach>
</delete>
</mapper>