Merge remote-tracking branch 'origin/main'

This commit is contained in:
zyh
2025-07-17 09:59:02 +08:00
18 changed files with 1688 additions and 1 deletions

View File

@@ -0,0 +1,142 @@
<?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.dairyProducts.rawMilkTest.mapper.NpRawMilkInspeMapper">
<resultMap type="NpRawMilkInspe" id="NpRawMilkInspeResult">
<result property="id" column="id" />
<result property="datetime" column="datetime" />
<result property="source" column="source" />
<result property="freeze" column="freeze" />
<result property="density" column="density" />
<result property="fat" column="fat" />
<result property="protein" column="protein" />
<result property="nonFat" column="non_fat" />
<result property="dryMatter" column="dry_matter" />
<result property="impurityDegree" column="impurity" />
<result property="lactose" column="lactose" />
<result property="ashContent" column="ash_content" />
<result property="acidity" column="acidity" />
<result property="ph" column="ph" />
<result property="bacterialColony" column="bacterial_colony" />
<result property="lactoferrin" column="lactoferrin" />
<result property="ig" column="ig" />
<result property="somaticCell" column="somatic_cell" />
<result property="usea" column="usea" />
<result property="fatRatio" column="fat_ratio" />
<result property="comment" column="comment" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectNpRawMilkInspeVo">
select id, datetime, source, freeze, density, fat, protein, non_fat, dry_matter,
impurity, lactose, ash_content, acidity, ph, bacterial_colony, lactoferrin,
ig, somatic_cell, usea, fat_ratio, comment, create_by, create_time
from np_raw_milk_inspe
</sql>
<select id="selectNpRawMilkInspeList" parameterType="NpRawMilkInspe" resultMap="NpRawMilkInspeResult">
<include refid="selectNpRawMilkInspeVo"/>
<where>
<if test="datetime != null "> and datetime = #{datetime}</if>
<if test="source != null and source != ''"> and source like concat('%', #{source}, '%')</if>
</where>
</select>
<select id="selectNpRawMilkInspeById" parameterType="Long" resultMap="NpRawMilkInspeResult">
<include refid="selectNpRawMilkInspeVo"/>
where id = #{id}
</select>
<insert id="insertNpRawMilkInspe" parameterType="NpRawMilkInspe" useGeneratedKeys="true" keyProperty="id">
insert into np_raw_milk_inspe
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="datetime != null">datetime,</if>
<if test="source != null">source,</if>
<if test="freeze != null">freeze,</if>
<if test="density != null">density,</if>
<if test="fat != null">fat,</if>
<if test="protein != null">protein,</if>
<if test="nonFat != null">non_fat,</if>
<if test="dryMatter != null">dry_matter,</if>
<if test="impurityDegree != null">impurity,</if>
<if test="lactose != null">lactose,</if>
<if test="ashContent != null">ash_content,</if>
<if test="acidity != null">acidity,</if>
<if test="ph != null">ph,</if>
<if test="bacterialColony != null">bacterial_colony,</if>
<if test="lactoferrin != null">lactoferrin,</if>
<if test="ig != null">ig,</if>
<if test="somaticCell != null">somatic_cell,</if>
<if test="usea != null">usea,</if>
<if test="fatRatio != null">fat_ratio,</if>
<if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="datetime != null">#{datetime},</if>
<if test="source != null">#{source},</if>
<if test="freeze != null">#{freeze},</if>
<if test="density != null">#{density},</if>
<if test="fat != null">#{fat},</if>
<if test="protein != null">#{protein},</if>
<if test="nonFat != null">#{nonFat},</if>
<if test="dryMatter != null">#{dryMatter},</if>
<if test="impurityDegree != null">#{impurityDegree},</if>
<if test="lactose != null">#{lactose},</if>
<if test="ashContent != null">#{ashContent},</if>
<if test="acidity != null">#{acidity},</if>
<if test="ph != null">#{ph},</if>
<if test="bacterialColony != null">#{bacterialColony},</if>
<if test="lactoferrin != null">#{lactoferrin},</if>
<if test="ig != null">#{ig},</if>
<if test="somaticCell != null">#{somaticCell},</if>
<if test="usea != null">#{usea},</if>
<if test="fatRatio != null">#{fatRatio},</if>
<if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateNpRawMilkInspe" parameterType="NpRawMilkInspe">
update np_raw_milk_inspe
<trim prefix="SET" suffixOverrides=",">
<if test="datetime != null">datetime = #{datetime},</if>
<if test="source != null">source = #{source},</if>
<if test="freeze != null">freeze = #{freeze},</if>
<if test="density != null">density = #{density},</if>
<if test="fat != null">fat = #{fat},</if>
<if test="protein != null">protein = #{protein},</if>
<if test="nonFat != null">non_fat = #{nonFat},</if>
<if test="dryMatter != null">dry_matter = #{dryMatter},</if>
<if test="impurityDegree != null">impurity = #{impurityDegree},</if>
<if test="lactose != null">lactose = #{lactose},</if>
<if test="ashContent != null">ash_content = #{ashContent},</if>
<if test="acidity != null">acidity = #{acidity},</if>
<if test="ph != null">ph = #{ph},</if>
<if test="bacterialColony != null">bacterial_colony = #{bacterialColony},</if>
<if test="lactoferrin != null">lactoferrin = #{lactoferrin},</if>
<if test="ig != null">ig = #{ig},</if>
<if test="somaticCell != null">somatic_cell = #{somaticCell},</if>
<if test="usea != null">usea = #{usea},</if>
<if test="fatRatio != null">fat_ratio = #{fatRatio},</if>
<if test="comment != null">comment = #{comment},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteNpRawMilkInspeById" parameterType="Long">
delete from np_raw_milk_inspe where id = #{id}
</delete>
<delete id="deleteNpRawMilkInspeByIds" parameterType="String">
delete from np_raw_milk_inspe where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,80 @@
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<mapper namespace="com.zhyc.module.fileManagement.mapper.BasSheepGroupMapper">
<resultMap type="BasSheepGroup" id="BasSheepGroupResult">
<result property="groupId" column="group_id"/>
<result property="parentId" column="parent_id"/>
<result property="groupName" column="group_name"/>
<result property="ancestors" column="ancestors"/>
<result property="ancestorNames" column="ancestor_names"/>
<result property="isLeaf" column="is_leaf"/>
<result property="status" column="status"/>
<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="selectBasSheepGroupVo"> -->
<!-- select group_id, parent_id, group_name, ancestors, status, create_by, create_time, update_by, update_time from bas_sheep_group -->
<!-- </sql> -->
<!-- 修改基础查询语句 -->
<sql id="selectBasSheepGroupVo">
SELECT g.group_id, g.parent_id, g.group_name, g.ancestors, g.status, g.create_by, g.create_time, g.update_by, g.update_time,
<!-- 新增祖先名称查询 -->
(SELECT GROUP_CONCAT(parent.group_name ORDER BY FIND_IN_SET(parent.group_id, g.ancestors)) FROM bas_sheep_group parent WHERE FIND_IN_SET(parent.group_id, g.ancestors) > 0 ) AS ancestor_names, (CASE WHEN (SELECT COUNT(1) FROM bas_sheep_group child WHERE child.parent_id = g.group_id) > 0 THEN 0 ELSE 1 END) AS is_leaf FROM bas_sheep_group g
</sql>
<select id="selectBasSheepGroupList" parameterType="BasSheepGroup" resultMap="BasSheepGroupResult">
<include refid="selectBasSheepGroupVo"/>
<where>
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
ORDER BY g.group_id
<!-- 确保正确排序 -->
</select>
<select id="selectBasSheepGroupByGroupId" parameterType="Long" resultMap="BasSheepGroupResult">
<include refid="selectBasSheepGroupVo"/>
where group_id = #{groupId}
</select>
<insert id="insertBasSheepGroup" parameterType="BasSheepGroup" useGeneratedKeys="true" keyProperty="groupId">
insert into bas_sheep_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parent_id,</if>
<if test="groupName != null and groupName != ''">group_name,</if>
<if test="ancestors != null">ancestors,</if>
<if test="status != null">status,</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="parentId != null">#{parentId},</if>
<if test="groupName != null and groupName != ''">#{groupName},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="status != null">#{status},</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="updateBasSheepGroup" parameterType="BasSheepGroup">
update bas_sheep_group
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="groupName != null and groupName != ''">group_name = #{groupName},</if>
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="status != null">status = #{status},</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 group_id = #{groupId}
</update>
<delete id="deleteBasSheepGroupByGroupId" parameterType="Long"> delete from bas_sheep_group where group_id = #{groupId} </delete>
<delete id="deleteBasSheepGroupByGroupIds" parameterType="String">
delete from bas_sheep_group where group_id in
<foreach item="groupId" collection="array" open="(" separator="," close=")"> #{groupId} </foreach>
</delete>
</mapper>

View File

@@ -49,6 +49,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''"> and status = #{status}</if>
</where>ORDER BY g.group_id <!-- 确保正确排序 -->
</select>
<select id="selectLeafNodes" resultMap="BasSheepGroupResult">
SELECT g.group_id,
g.parent_id,
g.group_name,
g.ancestors,
g.status,
g.create_by,
g.create_time,
g.update_by,
g.update_time,
(SELECT GROUP_CONCAT(parent.group_name ORDER BY FIND_IN_SET(parent.group_id, g.ancestors))
FROM bas_sheep_group parent
WHERE FIND_IN_SET(parent.group_id, g.ancestors) > 0) AS ancestor_names,
(CASE WHEN (SELECT COUNT(1)
FROM bas_sheep_group child
WHERE child.parent_id = g.group_id) > 0 THEN 0 ELSE 1 END) AS is_leaf
FROM bas_sheep_group g
WHERE g.status = '0'
HAVING is_leaf = 1
</select>
<select id="selectBasSheepGroupByGroupId" parameterType="Long" resultMap="BasSheepGroupResult">
<include refid="selectBasSheepGroupVo"/>

View File

@@ -0,0 +1,61 @@
<?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.fileManagement.mapper.BasSheepGroupMappingMapper">
<resultMap type="BasSheepGroupMapping" id="BasSheepGroupMappingResult">
<result property="id" column="id" />
<result property="sheepId" column="sheep_id" />
<result property="groupId" column="group_id" />
</resultMap>
<sql id="selectBasSheepGroupMappingVo">
select id, sheep_id, group_id from bas_sheep_group_mapping
</sql>
<select id="selectBasSheepGroupMappingList" parameterType="BasSheepGroupMapping" resultMap="BasSheepGroupMappingResult">
<include refid="selectBasSheepGroupMappingVo"/>
<where>
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
<if test="groupId != null "> and group_id = #{groupId}</if>
</where>
</select>
<select id="selectBasSheepGroupMappingById" parameterType="Long" resultMap="BasSheepGroupMappingResult">
<include refid="selectBasSheepGroupMappingVo"/>
where id = #{id}
</select>
<insert id="insertBasSheepGroupMapping" parameterType="BasSheepGroupMapping" useGeneratedKeys="true" keyProperty="id">
insert into bas_sheep_group_mapping
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="groupId != null">group_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="groupId != null">#{groupId},</if>
</trim>
</insert>
<update id="updateBasSheepGroupMapping" parameterType="BasSheepGroupMapping">
update bas_sheep_group_mapping
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="groupId != null">group_id = #{groupId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBasSheepGroupMappingById" parameterType="Long">
delete from bas_sheep_group_mapping where id = #{id}
</delete>
<delete id="deleteBasSheepGroupMappingByIds" parameterType="String">
delete from bas_sheep_group_mapping where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>