feat: 优化钢构包查询

This commit is contained in:
曹鹏飞 2025-09-25 17:52:50 +08:00
parent d679fd47bd
commit f1345a3249
1 changed files with 19 additions and 24 deletions

View File

@ -3,30 +3,25 @@
<mapper namespace="com.nflg.wms.repository.mapper.WmsStructuralPackageMapper"> <mapper namespace="com.nflg.wms.repository.mapper.WmsStructuralPackageMapper">
<select id="search" resultType="com.nflg.wms.common.pojo.vo.PackageVO"> <select id="search" resultType="com.nflg.wms.common.pojo.vo.PackageVO">
SELECT * SELECT *,get_modelnos(model_ids) as "modelNos"
FROM ( FROM wms_structural_package
SELECT DISTINCT ON ("no") id,"no","order_no","name",drawing_no,weight,cate,eco,version,remark,enable,create_by <where>
,create_time,update_by,update_time,get_modelnos(model_ids) as "modelNos" <if test="request.no!=null and request.no!=''">
FROM wms_structural_package and ("no" ilike concat('%', #{request.no}, '%') or "name" ilike concat('%', #{request.no}, '%'))
<where> </if>
<if test="request.no!=null and request.no!=''"> <if test="request.eco!=null and request.eco!=''">
and ("no" ilike concat('%', #{request.no}, '%') or "name" ilike concat('%', #{request.no}, '%')) and eco ilike concat('%', #{request.eco}, '%')
</if> </if>
<if test="request.eco!=null and request.eco!=''"> <if test="request.drawingNo!=null and request.drawingNo!=''">
and eco ilike concat('%', #{request.eco}, '%') and drawing_no like concat('%', #{request.drawingNo}, '%')
</if> </if>
<if test="request.drawingNo!=null and request.drawingNo!=''"> <if test="request.modelId!=null">
and drawing_no like concat('%', #{request.drawingNo}, '%') and find_in_set(#{request.modelId},model_ids)>0
</if> </if>
<if test="request.modelId!=null"> <if test="request.type==0">
and find_in_set(#{request.modelId},model_ids)>0 and latest=true
</if> </if>
<if test="request.type==0"> </where>
and latest=true
</if>
</where>
ORDER BY "no",id DESC
) t
ORDER BY id DESC ORDER BY id DESC
</select> </select>