业务结构调整

This commit is contained in:
2025-07-18 15:27:22 +08:00
parent e822fc5c54
commit 696a36a0d2
130 changed files with 315 additions and 394 deletions

View File

@@ -0,0 +1,130 @@
<?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.base.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="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"/>
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

@@ -0,0 +1,105 @@
<?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.base.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="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"/>
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>

View File

@@ -0,0 +1,259 @@
<?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.base.mapper.BasSheepMapper">
<resultMap type="BasSheep" id="BasSheepResult">
<result property="id" column="id" />
<result property="manageTags" column="manage_tags" />
<result property="ranchId" column="ranch_id" />
<result property="sheepfoldId" column="sheepfold_id" />
<result property="electronicTags" column="electronic_tags" />
<result property="varietyId" column="variety_id" />
<result property="family" column="family" />
<result property="typeId" column="type_id" />
<result property="gender" column="gender" />
<result property="birthday" column="birthday" />
<result property="birthWeight" column="birth_weight" />
<result property="parity" column="parity" />
<result property="statusId" column="status_id" />
<result property="weaningDate" column="weaning_date" />
<result property="weaningWeight" column="weaning_weight" />
<result property="breedStatusId" column="breed_status_id" />
<result property="fatherId" column="father_id" />
<result property="motherId" column="mother_id" />
<result property="receptorId" column="receptor_id" />
<result property="matingDate" column="mating_date" />
<result property="matingTypeId" column="mating_type_id" />
<result property="pregDate" column="preg_date" />
<result property="lambingDate" column="lambing_date" />
<result property="lambingDay" column="lambing_day" />
<result property="expectedDate" column="expected_date" />
<result property="controlled" column="controlled" />
<result property="matingCounts" column="mating_counts" />
<result property="matingTotal" column="mating_total" />
<result property="miscarriageCounts" column="miscarriage_counts" />
<result property="body" column="body" />
<result property="breast" column="breast" />
<result property="source" column="source" />
<result property="sourceDate" column="source_date" />
<result property="sourceRanchId" column="source_ranch_id" />
<result property="comment" column="comment" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="isDelete" column="is_delete" />
</resultMap>
<sql id="selectBasSheepVo">
select id, manage_tags, ranch_id, sheepfold_id, electronic_tags, variety_id, family, type_id, gender, birthday, birth_weight, parity, status_id, weaning_date, weaning_weight, breed_status_id, father_id, mother_id, receptor_id, mating_date, mating_type_id, preg_date, lambing_date, lambing_day, expected_date, controlled, mating_counts, mating_total, miscarriage_counts, body, breast, source, source_date, source_ranch_id, comment, update_by, update_time, create_by, create_time, is_delete from bas_sheep
</sql>
<select id="selectBasSheepList" parameterType="BasSheep" resultMap="BasSheepResult">
<include refid="selectBasSheepVo"/>
<where>
<if test="manageTags != null and manageTags != ''"> and manage_tags = #{manageTags}</if>
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
<if test="electronicTags != null and electronicTags != ''"> and electronic_tags = #{electronicTags}</if>
<if test="varietyId != null "> and variety_id = #{varietyId}</if>
<if test="family != null and family != ''"> and family = #{family}</if>
<if test="typeId != null "> and type_id = #{typeId}</if>
<if test="gender != null "> and gender = #{gender}</if>
<if test="birthday != null "> and birthday = #{birthday}</if>
<if test="birthWeight != null "> and birth_weight = #{birthWeight}</if>
<if test="parity != null "> and parity = #{parity}</if>
<if test="statusId != null "> and status_id = #{statusId}</if>
<if test="weaningDate != null "> and weaning_date = #{weaningDate}</if>
<if test="weaningWeight != null "> and weaning_weight = #{weaningWeight}</if>
<if test="breedStatusId != null "> and breed_status_id = #{breedStatusId}</if>
<if test="fatherId != null "> and father_id = #{fatherId}</if>
<if test="motherId != null "> and mother_id = #{motherId}</if>
<if test="receptorId != null "> and receptor_id = #{receptorId}</if>
<if test="matingDate != null "> and mating_date = #{matingDate}</if>
<if test="matingTypeId != null "> and mating_type_id = #{matingTypeId}</if>
<if test="pregDate != null "> and preg_date = #{pregDate}</if>
<if test="lambingDate != null "> and lambing_date = #{lambingDate}</if>
<if test="lambingDay != null "> and lambing_day = #{lambingDay}</if>
<if test="expectedDate != null "> and expected_date = #{expectedDate}</if>
<if test="controlled != null "> and controlled = #{controlled}</if>
<if test="matingCounts != null "> and mating_counts = #{matingCounts}</if>
<if test="matingTotal != null "> and mating_total = #{matingTotal}</if>
<if test="miscarriageCounts != null "> and miscarriage_counts = #{miscarriageCounts}</if>
<if test="body != null "> and body = #{body}</if>
<if test="breast != null "> and breast = #{breast}</if>
<if test="source != null and source != ''"> and source = #{source}</if>
<if test="sourceDate != null "> and source_date = #{sourceDate}</if>
<if test="sourceRanchId != null "> and source_ranch_id = #{sourceRanchId}</if>
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
</where>
</select>
<select id="selectBasSheepById" parameterType="java.lang.Long" resultType="BasSheep">
SELECT s.id,
s.sheepfold_id AS sheepfoldId,
sf.sheepfold_name AS sheepfoldName,
s.variety_id AS varietyId,
bv.variety AS varietyName
FROM bas_sheep s
LEFT JOIN da_sheepfold sf ON s.sheepfold_id = sf.id
LEFT JOIN bas_sheep_variety bv ON s.variety_id = bv.id
WHERE s.id = #{id}
</select>
<select id="selectBasSheepByManageTags" parameterType="string" resultType="com.zhyc.module.base.domain.BasSheep">
SELECT id, sheepfold_id AS sheepfoldId, variety_id AS varietyId
FROM bas_sheep
WHERE LOWER(TRIM(manage_tags)) = LOWER(TRIM(#{manageTags}))
AND is_delete = 0
LIMIT 1
</select>
<insert id="insertBasSheep" parameterType="BasSheep" useGeneratedKeys="true" keyProperty="id">
insert into bas_sheep
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="manageTags != null">manage_tags,</if>
<if test="ranchId != null">ranch_id,</if>
<if test="sheepfoldId != null">sheepfold_id,</if>
<if test="electronicTags != null">electronic_tags,</if>
<if test="varietyId != null">variety_id,</if>
<if test="family != null">family,</if>
<if test="typeId != null">type_id,</if>
<if test="gender != null">gender,</if>
<if test="birthday != null">birthday,</if>
<if test="birthWeight != null">birth_weight,</if>
<if test="parity != null">parity,</if>
<if test="statusId != null">status_id,</if>
<if test="weaningDate != null">weaning_date,</if>
<if test="weaningWeight != null">weaning_weight,</if>
<if test="breedStatusId != null">breed_status_id,</if>
<if test="fatherId != null">father_id,</if>
<if test="motherId != null">mother_id,</if>
<if test="receptorId != null">receptor_id,</if>
<if test="matingDate != null">mating_date,</if>
<if test="matingTypeId != null">mating_type_id,</if>
<if test="pregDate != null">preg_date,</if>
<if test="lambingDate != null">lambing_date,</if>
<if test="lambingDay != null">lambing_day,</if>
<if test="expectedDate != null">expected_date,</if>
<if test="controlled != null">controlled,</if>
<if test="matingCounts != null">mating_counts,</if>
<if test="matingTotal != null">mating_total,</if>
<if test="miscarriageCounts != null">miscarriage_counts,</if>
<if test="body != null">body,</if>
<if test="breast != null">breast,</if>
<if test="source != null">source,</if>
<if test="sourceDate != null">source_date,</if>
<if test="sourceRanchId != null">source_ranch_id,</if>
<if test="comment != null">comment,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="isDelete != null">is_delete,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="manageTags != null">#{manageTags},</if>
<if test="ranchId != null">#{ranchId},</if>
<if test="sheepfoldId != null">#{sheepfoldId},</if>
<if test="electronicTags != null">#{electronicTags},</if>
<if test="varietyId != null">#{varietyId},</if>
<if test="family != null">#{family},</if>
<if test="typeId != null">#{typeId},</if>
<if test="gender != null">#{gender},</if>
<if test="birthday != null">#{birthday},</if>
<if test="birthWeight != null">#{birthWeight},</if>
<if test="parity != null">#{parity},</if>
<if test="statusId != null">#{statusId},</if>
<if test="weaningDate != null">#{weaningDate},</if>
<if test="weaningWeight != null">#{weaningWeight},</if>
<if test="breedStatusId != null">#{breedStatusId},</if>
<if test="fatherId != null">#{fatherId},</if>
<if test="motherId != null">#{motherId},</if>
<if test="receptorId != null">#{receptorId},</if>
<if test="matingDate != null">#{matingDate},</if>
<if test="matingTypeId != null">#{matingTypeId},</if>
<if test="pregDate != null">#{pregDate},</if>
<if test="lambingDate != null">#{lambingDate},</if>
<if test="lambingDay != null">#{lambingDay},</if>
<if test="expectedDate != null">#{expectedDate},</if>
<if test="controlled != null">#{controlled},</if>
<if test="matingCounts != null">#{matingCounts},</if>
<if test="matingTotal != null">#{matingTotal},</if>
<if test="miscarriageCounts != null">#{miscarriageCounts},</if>
<if test="body != null">#{body},</if>
<if test="breast != null">#{breast},</if>
<if test="source != null">#{source},</if>
<if test="sourceDate != null">#{sourceDate},</if>
<if test="sourceRanchId != null">#{sourceRanchId},</if>
<if test="comment != null">#{comment},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="isDelete != null">#{isDelete},</if>
</trim>
</insert>
<update id="updateBasSheep" parameterType="BasSheep">
update bas_sheep
<trim prefix="SET" suffixOverrides=",">
<if test="manageTags != null">manage_tags = #{manageTags},</if>
<if test="ranchId != null">ranch_id = #{ranchId},</if>
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
<if test="electronicTags != null">electronic_tags = #{electronicTags},</if>
<if test="varietyId != null">variety_id = #{varietyId},</if>
<if test="family != null">family = #{family},</if>
<if test="typeId != null">type_id = #{typeId},</if>
<if test="gender != null">gender = #{gender},</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="birthWeight != null">birth_weight = #{birthWeight},</if>
<if test="parity != null">parity = #{parity},</if>
<if test="statusId != null">status_id = #{statusId},</if>
<if test="weaningDate != null">weaning_date = #{weaningDate},</if>
<if test="weaningWeight != null">weaning_weight = #{weaningWeight},</if>
<if test="breedStatusId != null">breed_status_id = #{breedStatusId},</if>
<if test="fatherId != null">father_id = #{fatherId},</if>
<if test="motherId != null">mother_id = #{motherId},</if>
<if test="receptorId != null">receptor_id = #{receptorId},</if>
<if test="matingDate != null">mating_date = #{matingDate},</if>
<if test="matingTypeId != null">mating_type_id = #{matingTypeId},</if>
<if test="pregDate != null">preg_date = #{pregDate},</if>
<if test="lambingDate != null">lambing_date = #{lambingDate},</if>
<if test="lambingDay != null">lambing_day = #{lambingDay},</if>
<if test="expectedDate != null">expected_date = #{expectedDate},</if>
<if test="controlled != null">controlled = #{controlled},</if>
<if test="matingCounts != null">mating_counts = #{matingCounts},</if>
<if test="matingTotal != null">mating_total = #{matingTotal},</if>
<if test="miscarriageCounts != null">miscarriage_counts = #{miscarriageCounts},</if>
<if test="body != null">body = #{body},</if>
<if test="breast != null">breast = #{breast},</if>
<if test="source != null">source = #{source},</if>
<if test="sourceDate != null">source_date = #{sourceDate},</if>
<if test="sourceRanchId != null">source_ranch_id = #{sourceRanchId},</if>
<if test="comment != null">comment = #{comment},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBasSheepById" parameterType="Long">
delete from bas_sheep where id = #{id}
</delete>
<delete id="deleteBasSheepByIds" parameterType="String">
delete from bas_sheep where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,56 @@
<?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.base.mapper.BasSheepVarietyMapper">
<resultMap type="BasSheepVariety" id="BasSheepVarietyResult">
<result property="id" column="id" />
<result property="variety" column="variety" />
</resultMap>
<sql id="selectBasSheepVarietyVo">
select id, variety from bas_sheep_variety
</sql>
<select id="selectBasSheepVarietyList" parameterType="BasSheepVariety" resultMap="BasSheepVarietyResult">
<include refid="selectBasSheepVarietyVo"/>
<where>
<if test="variety != null and variety != ''"> and variety = #{variety}</if>
</where>
</select>
<select id="selectBasSheepVarietyById" parameterType="Long" resultMap="BasSheepVarietyResult">
<include refid="selectBasSheepVarietyVo"/>
where id = #{id}
</select>
<insert id="insertBasSheepVariety" parameterType="BasSheepVariety" useGeneratedKeys="true" keyProperty="id">
insert into bas_sheep_variety
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="variety != null">variety,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="variety != null">#{variety},</if>
</trim>
</insert>
<update id="updateBasSheepVariety" parameterType="BasSheepVariety">
update bas_sheep_variety
<trim prefix="SET" suffixOverrides=",">
<if test="variety != null">variety = #{variety},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBasSheepVarietyById" parameterType="Long">
delete from bas_sheep_variety where id = #{id}
</delete>
<delete id="deleteBasSheepVarietyByIds" parameterType="String">
delete from bas_sheep_variety where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,89 @@
<?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.base.mapper.DaSheepfoldMapper">
<resultMap type="DaSheepfold" id="DaSheepfoldResult">
<result property="id" column="id" />
<result property="ranchId" column="ranch_id" />
<result property="sheepfoldName" column="sheepfold_name" />
<result property="sheepfoldTypeId" column="sheepfold_type_id" />
<result property="sheepfoldNo" column="sheepfold_no" />
<result property="rowNo" column="row_no" />
<result property="columns" column="columns" />
<result property="comment" column="comment" />
</resultMap>
<sql id="selectDaSheepfoldVo">
select id, ranch_id, sheepfold_name, sheepfold_type_id, sheepfold_no, row_no, columns, comment from da_sheepfold
</sql>
<select id="selectDaSheepfoldList" parameterType="DaSheepfold" resultMap="DaSheepfoldResult">
<include refid="selectDaSheepfoldVo"/>
<where>
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
<if test="sheepfoldTypeId != null "> and sheepfold_type_id = #{sheepfoldTypeId}</if>
</where>
</select>
<select id="selectDaSheepfoldById" parameterType="Long" resultMap="DaSheepfoldResult">
<include refid="selectDaSheepfoldVo"/>
where id = #{id}
</select>
<insert id="insertDaSheepfold" parameterType="DaSheepfold" useGeneratedKeys="true" keyProperty="id">
insert into da_sheepfold
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ranchId != null">ranch_id,</if>
<if test="sheepfoldName != null">sheepfold_name,</if>
<if test="sheepfoldTypeId != null">sheepfold_type_id,</if>
<if test="sheepfoldNo != null">sheepfold_no,</if>
<if test="rowNo != null">row_no,</if>
<if test="columns != null">columns,</if>
<if test="comment != null">comment,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ranchId != null">#{ranchId},</if>
<if test="sheepfoldName != null">#{sheepfoldName},</if>
<if test="sheepfoldTypeId != null">#{sheepfoldTypeId},</if>
<if test="sheepfoldNo != null">#{sheepfoldNo},</if>
<if test="rowNo != null">#{rowNo},</if>
<if test="columns != null">#{columns},</if>
<if test="comment != null">#{comment},</if>
</trim>
</insert>
<update id="updateDaSheepfold" parameterType="DaSheepfold">
update da_sheepfold
<trim prefix="SET" suffixOverrides=",">
<if test="ranchId != null">ranch_id = #{ranchId},</if>
<if test="sheepfoldName != null">sheepfold_name = #{sheepfoldName},</if>
<if test="sheepfoldTypeId != null">sheepfold_type_id = #{sheepfoldTypeId},</if>
<if test="sheepfoldNo != null">sheepfold_no = #{sheepfoldNo},</if>
<if test="rowNo != null">row_no = #{rowNo},</if>
<if test="columns != null">columns = #{columns},</if>
<if test="comment != null">comment = #{comment},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDaSheepfoldById" parameterType="Long">
delete from da_sheepfold where id = #{id}
</delete>
<delete id="deleteDaSheepfoldByIds" parameterType="String">
delete from da_sheepfold where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectCount" parameterType="DaSheepfold" resultType="int">
SELECT COUNT(*)
FROM da_sheepfold
WHERE ranch_id = #{ranchId}
AND sheepfold_type_id = #{sheepfoldTypeId}
AND sheepfold_no = #{sheepfoldNo}
</select>
</mapper>

View File

@@ -0,0 +1,316 @@
<?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.base.mapper.SheepFileMapper">
<resultMap type="SheepFile" id="SheepFileResult">
<result property="id" column="id" />
<result property="bsManageTags" column="bs_manage_tags" />
<result property="ranchId" column="ranch_id" />
<result property="drRanch" column="dr_ranch" />
<result property="sheepfoldId" column="sheepfold_id" />
<result property="sheepfoldName" column="sheepfold_name" />
<result property="electronicTags" column="electronic_tags" />
<result property="varietyId" column="variety_id" />
<result property="variety" column="variety" />
<result property="family" column="family" />
<result property="name" column="name" />
<result property="gender" column="gender" />
<result property="birthday" column="birthday" />
<result property="dayAge" column="day_age" />
<result property="monthAge" column="month_age" />
<result property="parity" column="parity" />
<result property="birthWeight" column="birth_weight" />
<result property="weaningDate" column="weaning_date" />
<result property="statusId" column="status_id" />
<result property="weaningWeight" column="weaning_weight" />
<result property="currentWeight" column="current_weight" />
<result property="breedStatusId" column="breed_status_id" />
<result property="breed" column="breed" />
<result property="bsFatherId" column="bs_father_id" />
<result property="fatherManageTags" column="father_manage_tags" />
<result property="bsMotherId" column="bs_mother_id" />
<result property="motherManageTags" column="mother_manage_tags" />
<result property="receptorId" column="receptor_id" />
<result property="receptorManageTags" column="receptor_manage_tags" />
<result property="fatherFatherId" column="father_father_id" />
<result property="grandfatherManageTags" column="grandfather_manage_tags" />
<result property="fatherMotherId" column="father_mother_id" />
<result property="grandmotherManageTags" column="grandmother_manage_tags" />
<result property="fatherId" column="father_id" />
<result property="maternalGrandfatherManageTags" column="maternal_grandfather_manage_tags" />
<result property="motherId" column="mother_id" />
<result property="maternalGrandmotherManageTags" column="maternal_grandmother_manage_tags" />
<result property="matingDate" column="mating_date" />
<result property="matingTypeId" column="mating_type_id" />
<result property="pregDate" column="preg_date" />
<result property="lambingDate" column="lambing_date" />
<result property="lambingDay" column="lambing_day" />
<result property="matingDay" column="mating_day" />
<result property="gestationDay" column="gestation_day" />
<result property="expectedDate" column="expected_date" />
<result property="postLambingDay" column="post_lambing_day" />
<result property="lactationDay" column="lactation_day" />
<result property="anestrousDay" column="anestrous_day" />
<result property="matingCounts" column="mating_counts" />
<result property="matingTotal" column="mating_total" />
<result property="miscarriageCounts" column="miscarriage_counts" />
<result property="comment" column="comment" />
<result property="controlled" column="controlled" />
<result property="body" column="body" />
<result property="breast" column="breast" />
<result property="source" column="source" />
<result property="sourceDate" column="source_date" />
<result property="sourceRanchId" column="source_ranch_id" />
<result property="sourceRanch" column="source_ranch" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="isDelete" column="is_delete" />
</resultMap>
<sql id="selectSheepFileVo">
select id, bs_manage_tags, ranch_id, dr_ranch, sheepfold_id, sheepfold_name, electronic_tags, variety_id, variety, family, name, gender, birthday, day_age, month_age, parity, birth_weight, weaning_date, status_id, weaning_weight, current_weight, breed_status_id, breed, bs_father_id, father_manage_tags, bs_mother_id, mother_manage_tags, receptor_id, receptor_manage_tags, father_father_id, grandfather_manage_tags, father_mother_id, grandmother_manage_tags, father_id, maternal_grandfather_manage_tags, mother_id, maternal_grandmother_manage_tags, mating_date, mating_type_id, preg_date, lambing_date, lambing_day, mating_day, gestation_day, expected_date, post_lambing_day, lactation_day, anestrous_day, mating_counts, mating_total, miscarriage_counts, comment, controlled, body, breast, source, source_date, source_ranch_id, source_ranch, update_by, update_time, create_by, create_time, is_delete from sheep_file
</sql>
<select id="selectSheepFileList" parameterType="SheepFile" resultMap="SheepFileResult">
<include refid="selectSheepFileVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="bsManageTags != null and bsManageTags != ''"> and bs_manage_tags = #{bsManageTags}</if>
<if test="drRanch != null and drRanch != ''"> and dr_ranch = #{drRanch}</if>
<if test="electronicTags != null and electronicTags != ''"> and electronic_tags = #{electronicTags}</if>
<if test="variety != null and variety != ''"> and variety = #{variety}</if>
<if test="name != null and name != ''"> and name = #{name}</if>
<if test="gender != null "> and gender = #{gender}</if>
<if test="statusId != null "> and status_id = #{statusId}</if>
<if test="breed != null and breed != ''"> and breed = #{breed}</if>
</where>
</select>
<select id="selectSheepFileById" parameterType="Long" resultMap="SheepFileResult">
<include refid="selectSheepFileVo"/>
where id = #{id}
</select>
<insert id="insertSheepFile" parameterType="SheepFile">
insert into sheep_file
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="bsManageTags != null">bs_manage_tags,</if>
<if test="ranchId != null">ranch_id,</if>
<if test="drRanch != null">dr_ranch,</if>
<if test="sheepfoldId != null">sheepfold_id,</if>
<if test="sheepfoldName != null">sheepfold_name,</if>
<if test="electronicTags != null">electronic_tags,</if>
<if test="varietyId != null">variety_id,</if>
<if test="variety != null">variety,</if>
<if test="family != null">family,</if>
<if test="name != null">name,</if>
<if test="gender != null">gender,</if>
<if test="birthday != null">birthday,</if>
<if test="dayAge != null">day_age,</if>
<if test="monthAge != null">month_age,</if>
<if test="parity != null">parity,</if>
<if test="birthWeight != null">birth_weight,</if>
<if test="weaningDate != null">weaning_date,</if>
<if test="statusId != null">status_id,</if>
<if test="weaningWeight != null">weaning_weight,</if>
<if test="currentWeight != null">current_weight,</if>
<if test="breedStatusId != null">breed_status_id,</if>
<if test="breed != null">breed,</if>
<if test="bsFatherId != null">bs_father_id,</if>
<if test="fatherManageTags != null">father_manage_tags,</if>
<if test="bsMotherId != null">bs_mother_id,</if>
<if test="motherManageTags != null">mother_manage_tags,</if>
<if test="receptorId != null">receptor_id,</if>
<if test="receptorManageTags != null">receptor_manage_tags,</if>
<if test="fatherFatherId != null">father_father_id,</if>
<if test="grandfatherManageTags != null">grandfather_manage_tags,</if>
<if test="fatherMotherId != null">father_mother_id,</if>
<if test="grandmotherManageTags != null">grandmother_manage_tags,</if>
<if test="fatherId != null">father_id,</if>
<if test="maternalGrandfatherManageTags != null">maternal_grandfather_manage_tags,</if>
<if test="motherId != null">mother_id,</if>
<if test="maternalGrandmotherManageTags != null">maternal_grandmother_manage_tags,</if>
<if test="matingDate != null">mating_date,</if>
<if test="matingTypeId != null">mating_type_id,</if>
<if test="pregDate != null">preg_date,</if>
<if test="lambingDate != null">lambing_date,</if>
<if test="lambingDay != null">lambing_day,</if>
<if test="matingDay != null">mating_day,</if>
<if test="gestationDay != null">gestation_day,</if>
<if test="expectedDate != null">expected_date,</if>
<if test="postLambingDay != null">post_lambing_day,</if>
<if test="lactationDay != null">lactation_day,</if>
<if test="anestrousDay != null">anestrous_day,</if>
<if test="matingCounts != null">mating_counts,</if>
<if test="matingTotal != null">mating_total,</if>
<if test="miscarriageCounts != null">miscarriage_counts,</if>
<if test="comment != null">comment,</if>
<if test="controlled != null">controlled,</if>
<if test="body != null">body,</if>
<if test="breast != null">breast,</if>
<if test="source != null">source,</if>
<if test="sourceDate != null">source_date,</if>
<if test="sourceRanchId != null">source_ranch_id,</if>
<if test="sourceRanch != null">source_ranch,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="isDelete != null">is_delete,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="bsManageTags != null">#{bsManageTags},</if>
<if test="ranchId != null">#{ranchId},</if>
<if test="drRanch != null">#{drRanch},</if>
<if test="sheepfoldId != null">#{sheepfoldId},</if>
<if test="sheepfoldName != null">#{sheepfoldName},</if>
<if test="electronicTags != null">#{electronicTags},</if>
<if test="varietyId != null">#{varietyId},</if>
<if test="variety != null">#{variety},</if>
<if test="family != null">#{family},</if>
<if test="name != null">#{name},</if>
<if test="gender != null">#{gender},</if>
<if test="birthday != null">#{birthday},</if>
<if test="dayAge != null">#{dayAge},</if>
<if test="monthAge != null">#{monthAge},</if>
<if test="parity != null">#{parity},</if>
<if test="birthWeight != null">#{birthWeight},</if>
<if test="weaningDate != null">#{weaningDate},</if>
<if test="statusId != null">#{statusId},</if>
<if test="weaningWeight != null">#{weaningWeight},</if>
<if test="currentWeight != null">#{currentWeight},</if>
<if test="breedStatusId != null">#{breedStatusId},</if>
<if test="breed != null">#{breed},</if>
<if test="bsFatherId != null">#{bsFatherId},</if>
<if test="fatherManageTags != null">#{fatherManageTags},</if>
<if test="bsMotherId != null">#{bsMotherId},</if>
<if test="motherManageTags != null">#{motherManageTags},</if>
<if test="receptorId != null">#{receptorId},</if>
<if test="receptorManageTags != null">#{receptorManageTags},</if>
<if test="fatherFatherId != null">#{fatherFatherId},</if>
<if test="grandfatherManageTags != null">#{grandfatherManageTags},</if>
<if test="fatherMotherId != null">#{fatherMotherId},</if>
<if test="grandmotherManageTags != null">#{grandmotherManageTags},</if>
<if test="fatherId != null">#{fatherId},</if>
<if test="maternalGrandfatherManageTags != null">#{maternalGrandfatherManageTags},</if>
<if test="motherId != null">#{motherId},</if>
<if test="maternalGrandmotherManageTags != null">#{maternalGrandmotherManageTags},</if>
<if test="matingDate != null">#{matingDate},</if>
<if test="matingTypeId != null">#{matingTypeId},</if>
<if test="pregDate != null">#{pregDate},</if>
<if test="lambingDate != null">#{lambingDate},</if>
<if test="lambingDay != null">#{lambingDay},</if>
<if test="matingDay != null">#{matingDay},</if>
<if test="gestationDay != null">#{gestationDay},</if>
<if test="expectedDate != null">#{expectedDate},</if>
<if test="postLambingDay != null">#{postLambingDay},</if>
<if test="lactationDay != null">#{lactationDay},</if>
<if test="anestrousDay != null">#{anestrousDay},</if>
<if test="matingCounts != null">#{matingCounts},</if>
<if test="matingTotal != null">#{matingTotal},</if>
<if test="miscarriageCounts != null">#{miscarriageCounts},</if>
<if test="comment != null">#{comment},</if>
<if test="controlled != null">#{controlled},</if>
<if test="body != null">#{body},</if>
<if test="breast != null">#{breast},</if>
<if test="source != null">#{source},</if>
<if test="sourceDate != null">#{sourceDate},</if>
<if test="sourceRanchId != null">#{sourceRanchId},</if>
<if test="sourceRanch != null">#{sourceRanch},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="isDelete != null">#{isDelete},</if>
</trim>
</insert>
<update id="updateSheepFile" parameterType="SheepFile">
update sheep_file
<trim prefix="SET" suffixOverrides=",">
<if test="bsManageTags != null">bs_manage_tags = #{bsManageTags},</if>
<if test="ranchId != null">ranch_id = #{ranchId},</if>
<if test="drRanch != null">dr_ranch = #{drRanch},</if>
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
<if test="sheepfoldName != null">sheepfold_name = #{sheepfoldName},</if>
<if test="electronicTags != null">electronic_tags = #{electronicTags},</if>
<if test="varietyId != null">variety_id = #{varietyId},</if>
<if test="variety != null">variety = #{variety},</if>
<if test="family != null">family = #{family},</if>
<if test="name != null">name = #{name},</if>
<if test="gender != null">gender = #{gender},</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="dayAge != null">day_age = #{dayAge},</if>
<if test="monthAge != null">month_age = #{monthAge},</if>
<if test="parity != null">parity = #{parity},</if>
<if test="birthWeight != null">birth_weight = #{birthWeight},</if>
<if test="weaningDate != null">weaning_date = #{weaningDate},</if>
<if test="statusId != null">status_id = #{statusId},</if>
<if test="weaningWeight != null">weaning_weight = #{weaningWeight},</if>
<if test="currentWeight != null">current_weight = #{currentWeight},</if>
<if test="breedStatusId != null">breed_status_id = #{breedStatusId},</if>
<if test="breed != null">breed = #{breed},</if>
<if test="bsFatherId != null">bs_father_id = #{bsFatherId},</if>
<if test="fatherManageTags != null">father_manage_tags = #{fatherManageTags},</if>
<if test="bsMotherId != null">bs_mother_id = #{bsMotherId},</if>
<if test="motherManageTags != null">mother_manage_tags = #{motherManageTags},</if>
<if test="receptorId != null">receptor_id = #{receptorId},</if>
<if test="receptorManageTags != null">receptor_manage_tags = #{receptorManageTags},</if>
<if test="fatherFatherId != null">father_father_id = #{fatherFatherId},</if>
<if test="grandfatherManageTags != null">grandfather_manage_tags = #{grandfatherManageTags},</if>
<if test="fatherMotherId != null">father_mother_id = #{fatherMotherId},</if>
<if test="grandmotherManageTags != null">grandmother_manage_tags = #{grandmotherManageTags},</if>
<if test="fatherId != null">father_id = #{fatherId},</if>
<if test="maternalGrandfatherManageTags != null">maternal_grandfather_manage_tags = #{maternalGrandfatherManageTags},</if>
<if test="motherId != null">mother_id = #{motherId},</if>
<if test="maternalGrandmotherManageTags != null">maternal_grandmother_manage_tags = #{maternalGrandmotherManageTags},</if>
<if test="matingDate != null">mating_date = #{matingDate},</if>
<if test="matingTypeId != null">mating_type_id = #{matingTypeId},</if>
<if test="pregDate != null">preg_date = #{pregDate},</if>
<if test="lambingDate != null">lambing_date = #{lambingDate},</if>
<if test="lambingDay != null">lambing_day = #{lambingDay},</if>
<if test="matingDay != null">mating_day = #{matingDay},</if>
<if test="gestationDay != null">gestation_day = #{gestationDay},</if>
<if test="expectedDate != null">expected_date = #{expectedDate},</if>
<if test="postLambingDay != null">post_lambing_day = #{postLambingDay},</if>
<if test="lactationDay != null">lactation_day = #{lactationDay},</if>
<if test="anestrousDay != null">anestrous_day = #{anestrousDay},</if>
<if test="matingCounts != null">mating_counts = #{matingCounts},</if>
<if test="matingTotal != null">mating_total = #{matingTotal},</if>
<if test="miscarriageCounts != null">miscarriage_counts = #{miscarriageCounts},</if>
<if test="comment != null">comment = #{comment},</if>
<if test="controlled != null">controlled = #{controlled},</if>
<if test="body != null">body = #{body},</if>
<if test="breast != null">breast = #{breast},</if>
<if test="source != null">source = #{source},</if>
<if test="sourceDate != null">source_date = #{sourceDate},</if>
<if test="sourceRanchId != null">source_ranch_id = #{sourceRanchId},</if>
<if test="sourceRanch != null">source_ranch = #{sourceRanch},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSheepFileById" parameterType="Long">
delete from sheep_file where id = #{id}
</delete>
<delete id="deleteSheepFileByIds" parameterType="String">
delete from sheep_file where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>