perf(module/feed): 所有模块支持模糊查询

修改SQL Mapper使用`CONCAT('%',?,'%')`支持模糊查询
This commit is contained in:
2026-01-18 15:46:39 +08:00
parent 83f8332cd9
commit ed2daf6cfa
6 changed files with 15 additions and 15 deletions

View File

@@ -19,9 +19,9 @@
<select id="selectSgFeedListList" parameterType="SgFeedList" resultMap="SgFeedListResult"> <select id="selectSgFeedListList" parameterType="SgFeedList" resultMap="SgFeedListResult">
<include refid="selectSgFeedListVo"/> <include refid="selectSgFeedListVo"/>
<where> <where>
<if test="formulaId != null and formulaId != ''"> and formula_id = #{formulaId}</if> <if test="formulaId != null and formulaId != ''"> and formula_id LIKE CONCAT('%',#{formulaId},'%')</if>
<if test="formulaBatchId != null and formulaBatchId != ''"> and formula_batch_id = #{formulaBatchId}</if> <if test="formulaBatchId != null and formulaBatchId != ''"> and formula_batch_id LIKE CONCAT('%',#{formulaBatchId},'%')</if>
<if test="zookeeper != null and zookeeper != ''"> and zookeeper = #{zookeeper}</if> <if test="zookeeper != null and zookeeper != ''"> and zookeeper LIKE CONCAT('%',#{zookeeper},'%')</if>
<if test="deployDate != null "> and deploy_date = #{deployDate}</if> <if test="deployDate != null "> and deploy_date = #{deployDate}</if>
</where> </where>
ORDER BY deploy_date ASC, formula_id ASC, formula_batch_id ASC ORDER BY deploy_date ASC, formula_id ASC, formula_batch_id ASC

View File

@@ -36,9 +36,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSgFeedPlanList" parameterType="SgFeedPlan" resultMap="SgFeedPlanResult"> <select id="selectSgFeedPlanList" parameterType="SgFeedPlan" resultMap="SgFeedPlanResult">
<include refid="selectSgFeedPlanVo"/> <include refid="selectSgFeedPlanVo"/>
<where> <where>
<if test="formulaId != null and formulaId != ''"> and formula_id = #{formulaId}</if> <if test="formulaId != null and formulaId != ''"> and formula_id LIKE CONCAT('%',#{formulaId},'%')</if>
<if test="batchId != null and batchId != ''"> and batch_id = #{batchId}</if> <if test="batchId != null and batchId != ''"> and batch_id LIKE CONCAT('%',#{batchId},'%')</if>
<if test="sheepHouseId != null "> and sheep_house_id = #{sheepHouseId}</if> <if test="sheepHouseId != null "> and sheep_house_id LIKE CONCAT('%',#{sheepHouseId},'%')</if>
<if test="planDate != null "> and plan_date = #{planDate}</if> <if test="planDate != null "> and plan_date = #{planDate}</if>
</where> </where>
ORDER BY plan_date ASC, formula_id ASC , batch_id ASC ORDER BY plan_date ASC, formula_id ASC , batch_id ASC

View File

@@ -31,8 +31,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSgFeedStatisticList" parameterType="SgFeedStatistic" resultMap="SgFeedStatisticResult"> <select id="selectSgFeedStatisticList" parameterType="SgFeedStatistic" resultMap="SgFeedStatisticResult">
<include refid="selectSgFeedStatisticVo"/> <include refid="selectSgFeedStatisticVo"/>
<where> <where>
<if test="formulaId != null and formulaId != ''"> and formula_id = #{formulaId}</if> <if test="formulaId != null and formulaId != ''"> and formula_id LIKE CONCAT('%',#{formulaId},'%')</if>
<if test="formulaBatchId != null and formulaBatchId != ''"> and formula_batch_id = #{formulaBatchId}</if> <if test="formulaBatchId != null and formulaBatchId != ''"> and formula_batch_id = LIKE CONCAT('%',#{formulaBatchId},'%')</if>
<if test="silageLossRate != null and silageLossRate != ''"> and silage_loss_rate = #{silageLossRate}</if> <if test="silageLossRate != null and silageLossRate != ''"> and silage_loss_rate = #{silageLossRate}</if>
</where> </where>
</select> </select>

View File

@@ -22,9 +22,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSgFormulaListList" parameterType="SgFormulaList" resultMap="SgFormulaListResult"> <select id="selectSgFormulaListList" parameterType="SgFormulaList" resultMap="SgFormulaListResult">
<include refid="selectSgFormulaListVo"/> <include refid="selectSgFormulaListVo"/>
<where> <where>
<if test="materialId != null and materialId != ''">material_id = #{materialId}</if> <if test="materialId != null and materialId != ''">material_id LIKE CONCAT('%',#{materialId},'%')</if>
<if test="formulaId != null and formulaId != ''">and formula_id = #{formulaId}</if> <if test="formulaId != null and formulaId != ''">and formula_id LIKE CONCAT('%',#{formulaId},'%')</if>
<if test="batchId != null and batchId != ''"> and batch_id = #{batchId}</if> <if test="batchId != null and batchId != ''"> and batch_id LIKE CONCAT('%',#{batchId},'%')</if>
</where> </where>
</select> </select>

View File

@@ -21,9 +21,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSgFormulaManagementList" parameterType="SgFormulaManagement" resultMap="SgFormulaManagementResult"> <select id="selectSgFormulaManagementList" parameterType="SgFormulaManagement" resultMap="SgFormulaManagementResult">
<include refid="selectSgFormulaManagementVo"/> <include refid="selectSgFormulaManagementVo"/>
<where> <where>
<if test="formulaId != null and formulaId != ''"> and formula_id = #{formulaId}</if> <if test="formulaId != null and formulaId != ''"> and formula_id LIKE CONCAT('%',#{formulaId},'%')</if>
<if test="feedStage != null and feedStage != ''"> and feed_stage = #{feedStage}</if> <if test="feedStage != null and feedStage != ''"> and feed_stage LIKE CONCAT('%',#{feedStage},'%')</if>
<if test="batchId != null and batchId != ''"> and batch_id = #{batchId}</if> <if test="batchId != null and batchId != ''"> and batch_id LIKE CONCAT('%',#{batchId},'%')</if>
</where> </where>
</select> </select>

View File

@@ -17,7 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSgMaterialList" parameterType="SgMaterial" resultMap="SgMaterialResult"> <select id="selectSgMaterialList" parameterType="SgMaterial" resultMap="SgMaterialResult">
<include refid="selectSgMaterialVo"/> <include refid="selectSgMaterialVo"/>
<where> <where>
<if test="materialId != null and materialId != ''"> and material_id = #{materialId}</if> <if test="materialId != null and materialId != ''"> and material_id LIKE CONCAT('%',#{materialId},'%')</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if> <if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="isGranular != null "> and is_granular = #{isGranular}</if> <if test="isGranular != null "> and is_granular = #{isGranular}</if>
</where> </where>