fix: 健康管理系统,新增婴幼儿管理-吃奶记录。

This commit is contained in:
tianyongbao
2025-02-01 18:31:33 +08:00
parent 83d11768cb
commit 5d7416445b
8 changed files with 646 additions and 0 deletions

View File

@@ -0,0 +1,139 @@
<?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.intc.health.mapper.HealthMilkPowderRecordMapper">
<resultMap type="HealthMilkPowderRecordVo" id="HealthMilkPowderRecordResult">
<result property="id" column="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" />
<result property="delFlag" column="del_flag" />
<result property="remark" column="remark" />
<result property="sucklesTime" column="suckles_time" />
<result property="consumption" column="consumption" />
<result property="personId" column="person_id" />
<result property="milkPowderBrand" column="milk_powder_brand" />
<result property="spoonful" column="spoonful" />
<result property="personName" column="person_name" />
</resultMap>
<sql id="selectHealthMilkPowderRecordVo">
select
a.id,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.del_flag,
a.remark,
a.suckles_time,
a.consumption,
a.person_id,
a.milk_powder_brand,
a.spoonful,
hp."name" as person_name
from
health_milk_powder_record a
left join health_person hp on
hp.id = a.person_id
</sql>
<select id="selectHealthMilkPowderRecordList" parameterType="HealthMilkPowderRecordDto" resultMap="HealthMilkPowderRecordResult">
<include refid="selectHealthMilkPowderRecordVo"/>
<where>
a.del_flag='0'
<if test="sucklesTime != null "> and a.suckles_time = #{sucklesTime}</if>
<if test="personId != null "> and a.person_id = #{personId}</if>
<if test="endTime!=null and endTime !=''">
and #{endTime}>=to_char(a.suckles_time, 'yyyy-MM-dd')
</if>
<if test="startTime!=null and startTime !=''">
and to_char(a.suckles_time, 'yyyy-MM-dd')>=#{startTime}
</if>
<if test="milkPowderBrand != null and milkPowderBrand != ''"> and a.milk_powder_brand like '%'|| #{milkPowderBrand}||'%'</if>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
order by a.suckles_time desc
</select>
<select id="selectHealthMilkPowderRecordById" parameterType="Long" resultMap="HealthMilkPowderRecordResult">
<include refid="selectHealthMilkPowderRecordVo"/>
where a.id = #{id}
</select>
<insert id="insertHealthMilkPowderRecord" parameterType="HealthMilkPowderRecord">
insert into health_milk_powder_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">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>
<if test="delFlag != null">del_flag,</if>
<if test="remark != null">remark,</if>
<if test="sucklesTime != null">suckles_time,</if>
<if test="consumption != null">consumption,</if>
<if test="personId != null">person_id,</if>
<if test="milkPowderBrand != null">milk_powder_brand,</if>
<if test="spoonful != null">spoonful,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</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>
<if test="delFlag != null">#{delFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="sucklesTime != null">#{sucklesTime},</if>
<if test="consumption != null">#{consumption},</if>
<if test="personId != null">#{personId},</if>
<if test="milkPowderBrand != null">#{milkPowderBrand},</if>
<if test="spoonful != null">#{spoonful},</if>
</trim>
</insert>
<update id="updateHealthMilkPowderRecord" parameterType="HealthMilkPowderRecord">
update health_milk_powder_record
<trim prefix="SET" suffixOverrides=",">
<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>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="sucklesTime != null">suckles_time = #{sucklesTime},</if>
<if test="consumption != null">consumption = #{consumption},</if>
<if test="personId != null">person_id = #{personId},</if>
<if test="milkPowderBrand != null">milk_powder_brand = #{milkPowderBrand},</if>
<if test="spoonful != null">spoonful = #{spoonful},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteHealthMilkPowderRecordById" parameterType="Long">
delete from health_milk_powder_record where id = #{id}
</delete>
<delete id="deleteHealthMilkPowderRecordByIds" parameterType="String">
delete from health_milk_powder_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="removeHealthMilkPowderRecordById" parameterType="Long">
update health_milk_powder_record set del_flag='1' where id = #{id}
</update>
<update id="removeHealthMilkPowderRecordByIds" parameterType="String">
update health_milk_powder_record set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>