Merge remote-tracking branch 'origin/main'

This commit is contained in:
ll
2025-07-18 13:09:52 +08:00
11 changed files with 183 additions and 118 deletions

View File

@@ -14,13 +14,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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>
<!-- <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="selectBasSheepGroupMappingList"
parameterType="map"
resultType="map"> <!-- 1. 返回 map 方便前端直接取值 -->
SELECT
m.id,
m.sheep_id,
m.group_id,
s.id AS bs_sheep_id,
s.bs_manage_tags,
s.variety,
s.gender,
s.name,
s.birthday,
s.parity,
s.month_age,
s.breed,
s.birth_weight,
s.weaning_weight,
s.current_weight,
s.father_manage_tags,
s.mother_manage_tags,
s.family
FROM bas_sheep_group_mapping m
JOIN sheep_file s ON s.id = m.sheep_id
<where>
<if test="sheepId != null"> AND m.sheep_id = #{sheepId}</if>
<if test="groupId != null"> AND m.group_id = #{groupId}</if>
<if test="bsManageTags != null and bsManageTags.size > 0">
AND s.bs_manage_tags IN
<foreach collection="bsManageTags" item="bsManageTag " open="(" separator="," close=")">
#{bsManageTag}
</foreach>
</if>
</where>
ORDER BY m.id
</select>
<select id="selectBasSheepGroupMappingById" parameterType="Long" resultMap="BasSheepGroupMappingResult">
<include refid="selectBasSheepGroupMappingVo"/>

View File

@@ -6,9 +6,8 @@
<resultMap type="ScFixHoof" id="ScFixHoofResult">
<result property="id" column="id"/>
<result property="manageTags" column="manageTags"/>
<result property="sheepId" column="sheep_id"/>
<result property="sheepfold" column="sheepfold"/>
<result property="varietyId" column="variety_id"/>
<result property="sheepfoldName" column="sheepfoldName"/>
<result property="comment" column="comment"/>
<result property="technician" column="technician"/>
@@ -18,19 +17,15 @@
<sql id="selectScFixHoofVo">
select fh.id,
bs.manage_tags AS manageTags,
fh.sheep_id,
fh.sheepfold,
sf.sheepfold_name AS sheepfoldName,
fh.variety_id,
bv.variety AS varietyName,
sf.sheepfold_name as sheepfoldName,
fh.comment,
fh.technician,
fh.create_by,
fh.create_time
from sc_fix_hoof fh
left join bas_sheep bs on fh.sheep_id = bs.id
left join da_sheepfold sf on fh.sheepfold = sf.id
left join bas_sheep_variety bv on fh.variety_id = bv.id
</sql>
<select id="selectScFixHoofList" parameterType="ScFixHoof" resultMap="ScFixHoofResult">
@@ -38,15 +33,9 @@
<where>
<if test="sheepId != null ">and sheep_id = #{sheepId}</if>
<if test="sheepfold != null ">and sheepfold = #{sheepfold}</if>
<if test="varietyId != null">
and fh.variety_id = #{varietyId}
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%')
</if>
</where>
</select>
@@ -55,24 +44,24 @@
where fh.id = #{id}
</select>
<insert id="insertScFixHoof" parameterType="ScFixHoof"
useGeneratedKeys="true" keyProperty="id">
INSERT INTO sc_fix_hoof
(sheep_id,
sheepfold,
variety_id,
<if test="comment != null">comment,</if>
<if test="technician != null and technician != ''">technician,</if>
create_by,
create_time)
VALUES
(#{sheepId},
#{sheepfold},
<if test="varietyId != null">#{varietyId},</if>
<if test="comment != null">#{comment},</if>
<if test="technician != null and technician != ''">#{technician},</if>
#{createBy},
#{createTime})
<insert id="insertScFixHoof" parameterType="ScFixHoof" useGeneratedKeys="true" keyProperty="id">
insert into sc_fix_hoof
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null and sheepId != ''">and fh.sheep_id like concat('%', #{sheepId}, '%')</if>
<if test="sheepfold != null">and fh.sheepfold = #{sheepfold}</if>
<if test="comment != null">comment,</if>
<if test="technician != null and technician != ''">technician,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="sheepfold != null">#{sheepfold},</if>
<if test="comment != null">#{comment},</if>
<if test="technician != null and technician != ''">#{technician},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateScFixHoof" parameterType="ScFixHoof">
@@ -80,7 +69,6 @@
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="sheepfold != null">sheepfold = #{sheepfold},</if>
<if test="varietyId != null">variety_id=#{varietyId},</if>
<if test="comment != null">comment = #{comment},</if>
<if test="technician != null and technician != ''">technician = #{technician},</if>
<if test="createBy != null">create_by = #{createBy},</if>
@@ -101,6 +89,4 @@
#{id}
</foreach>
</delete>
</mapper>