生物安全排序

This commit is contained in:
漂泊 2025-10-13 13:27:02 +08:00
parent f331f35a5c
commit 6f12dd7231
13 changed files with 115 additions and 16 deletions

View File

@ -77,4 +77,7 @@ public class Deworm extends BaseEntity
this.gender = gender;
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
}
// 排序查询
private String orderByColumn;
private String isAsc;
}

View File

@ -100,4 +100,8 @@ public class Diagnosis extends BaseEntity
this.gender = gender;
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
}
// 排序查询
private String orderByColumn;
private String isAsc;
}

View File

@ -72,4 +72,7 @@ public class Health extends BaseEntity
this.gender = gender;
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
}
// 排序查询
private String orderByColumn;
private String isAsc;
}

View File

@ -79,4 +79,8 @@ public class Immunity extends BaseEntity
this.gender = gender;
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
}
// 排序查询
private String orderByColumn;
private String isAsc;
}

View File

@ -95,4 +95,8 @@ public class QuarantineReport extends BaseEntity
this.gender = gender;
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
}
// 排序查询
private String orderByColumn;
private String isAsc;
}

View File

@ -110,4 +110,8 @@ public class Treatment extends BaseEntity
this.gender = gender;
this.genderName = Gender.getDescByCode(Integer.valueOf(gender));
}
// 排序查询
private String orderByColumn;
private String isAsc;
}

View File

@ -34,12 +34,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDewormList" parameterType="Deworm" resultMap="DewormResult">
<include refid="selectDewormVo"/>
<where>
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
<if test="sheepId != null">and sheep_id = #{sheepId}</if>
<if test="sheepNo != null and sheepNo != ''">and bs.manage_tags like concat('%',#{sheepNo},'%')</if>
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''"> and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
<if test="technical != null and technical != ''"> and technical = #{technical}</if>
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''">
and datetime between #{params.beginDatetime} and #{params.endDatetime}
</if>
<if test="technical != null and technical != ''">and technical = #{technical}</if>
</where>
ORDER BY datetime DESC
<!-- 基准排序:日期永远第一序,降序 -->
ORDER BY datetime DESC
<!-- 第二序:仅当用户点击月龄/胎次时追加 -->
<choose>
<when test="orderByColumn == 'monthAge'">, month_age ${isAsc}</when>
<when test="orderByColumn == 'parity'">, parity ${isAsc}</when>
</choose>
</select>
<select id="selectDewormById" parameterType="Long" resultMap="DewormResult">

View File

@ -53,6 +53,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sheepfoldId != null "> and sd.sheepfold_id = #{sheepfoldId}</if>
</where>
ORDER BY datetime DESC
<choose>
<when test="orderByColumn == 'begindate'">, begindate ${isAsc}</when>
<when test="orderByColumn == 'enddate'">, enddate ${isAsc}</when>
<when test="orderByColumn == 'parity'">, parity ${isAsc}</when>
</choose>
</select>
<select id="selectDiagnosisById" parameterType="Long" resultMap="DiagnosisResult">

View File

@ -46,7 +46,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''"> and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
<if test="technical != null and technical != ''"> and technical = #{technical}</if>
</where>
ORDER BY datetime DESC
<!-- 基准排序:日期永远第一序,降序 -->
ORDER BY datetime DESC
<!-- 第二序:仅当用户点击月龄/胎次时追加 -->
<choose>
<when test="orderByColumn == 'monthAge'">, month_age ${isAsc}</when>
<when test="orderByColumn == 'parity'">, parity ${isAsc}</when>
</choose>
</select>
<select id="selectHealthById" parameterType="Long" resultMap="HealthResult">

View File

@ -44,7 +44,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''"> and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
<if test="technical != null and technical != ''"> and technical = #{technical}</if>
</where>
ORDER BY datetime DESC
<!-- 基准排序:日期永远第一序,降序 -->
ORDER BY datetime DESC
<!-- 第二序:仅当用户点击月龄/胎次时追加 -->
<choose>
<when test="orderByColumn == 'monthAge'">, month_age ${isAsc}</when>
<when test="orderByColumn == 'parity'">, parity ${isAsc}</when>
</choose>
</select>
<select id="selectImmunityById" parameterType="Long" resultMap="ImmunityResult">

View File

@ -54,6 +54,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null "> and status = #{status}</if>
<if test="sheepType != null and sheepType!= ''"> and sqr.sheep_type=#{sheepType}</if>
</where>
ORDER BY datetime DESC
<choose>
<when test="orderByColumn == 'monthAge'">, month_age ${isAsc}</when>
</choose>
</select>
<select id="selectQuarantineReportById" parameterType="Long" resultMap="QuarantineReportResult">

View File

@ -46,15 +46,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectSwMedicineUsageList" parameterType="SwMedicineUsage" resultMap="SwMedicineUsageResult">
<include refid="selectSwMedicineUsageVo"/>
SELECT
smu.id,
smu.sheepfold AS sheepfold_id,
smu.sheep AS sheep_id,
smu.name,
smu.datetime,
smu.use_type,
smu.update_by,
smu.update_time,
smu.create_by,
smu.create_time,
ds.sheepfold_name,
bs.manage_tags AS sheep_no
FROM sw_medicine_usage smu
LEFT JOIN da_sheepfold ds ON ds.id = smu.sheepfold
LEFT JOIN bas_sheep bs ON bs.id = smu.sheep
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="useType != null and useType != ''"> and use_type = #{useType}</if>
<if test="sheepNo != null and sheepNo != ''"> and bs.manage_tags like concat('%', #{sheepNo}, '%')</if>
<if test="params.beginUseTime != null and params.beginUseTime != '' and params.endUseTime != null and params.endUseTime != ''"> and smu.datetime between #{params.beginUseTime} and #{params.endUseTime}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and smu.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if> <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and smu.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
<!-- 2. 使用类型 -->
<if test="useType != null and useType != ''">
AND smu.use_type = #{useType}
</if>
<!-- 3. 羊只耳号 -->
<if test="sheepNo != null and sheepNo != ''">
AND bs.manage_tags LIKE CONCAT('%', #{sheepNo}, '%')
</if>
<!-- 4. 使用时间区间 -->
<if test="params.beginUseTime != null and params.endUseTime != null">
AND smu.datetime BETWEEN #{params.beginUseTime} AND #{params.endUseTime}
</if>
<!-- 5. 创建时间区间 -->
<if test="params.beginCreateTime != null and params.endCreateTime != null">
AND smu.create_time BETWEEN #{params.beginCreateTime} AND #{params.endCreateTime}
</if>
<!-- 按药品名称过滤 -->
<if test="name != null and name != ''">
AND EXISTS (
SELECT 1
FROM sw_medicine_usage_details mud
JOIN sw_medicine sm ON sm.id = mud.medi_id
WHERE mud.medi_usage = smu.id
AND sm.name LIKE CONCAT('%', #{name}, '%')
)
</if>
</where>
ORDER BY datetime DESC
ORDER BY smu.datetime DESC
</select>
<select id="selectSwMedicineUsageById" parameterType="Integer" resultMap="SwMedicineUsageSwMedicineUsageDetailsResult">

View File

@ -61,6 +61,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="veterinary != null and veterinary != ''"> and veterinary = #{veterinary}</if>
</where>
ORDER BY datetime DESC
<choose>
<when test="orderByColumn == 'monthAge'">, month_age ${isAsc}</when>
<when test="orderByColumn == 'parity'">, parity ${isAsc}</when>
<when test="orderByColumn == 'lactDay'">, lact_day ${isAsc}</when>
<when test="orderByColumn == 'gestDay'">, gest_day ${isAsc}</when>
</choose>
</select>
<select id="selectTreatmentById" parameterType="Long" resultMap="TreatmentResult">