From f8971b95d041a8205846a0b55bc75421bbbb84c3 Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期三, 07 六月 2023 13:37:30 +0800 Subject: [PATCH] #平库库位优化 --- src/main/resources/mapper/NodeMapper.xml | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 49 insertions(+), 0 deletions(-) diff --git a/src/main/resources/mapper/NodeMapper.xml b/src/main/resources/mapper/NodeMapper.xml index b2dcada..ac96844 100644 --- a/src/main/resources/mapper/NodeMapper.xml +++ b/src/main/resources/mapper/NodeMapper.xml @@ -29,9 +29,58 @@ <result column="lev1" property="lev1" /> </resultMap> + <sql id="nodeCondition"> + <if test="host_id != null and host_id != ''"> + and mld.host_id = #{host_id} + </if> + <if test="loc_no != null and loc_no != ''"> + and mld.loc_no like concat('%',#{loc_no},'%') + </if> + <if test="locNo != null and locNo != ''"> + and mld.loc_no like concat('%',#{loc_no},'%') + </if> + <if test="matnr != null and matnr != ''"> + and mld.matnr like concat('%',#{matnr},'%') + </if> + <if test="maktx != null and maktx != ''"> + and mld.maktx like concat('%',#{maktx},'%') + </if> + <if test="startTime!=null and endTime!=null"> + and mld.update_time between #{startTime} and #{endTime} + </if> + </sql> <select id="selectByUuid" resultMap="BaseResultMap"> select * from man_node where 1=1 and uuid=#{uuid} and host_id = #{hostId} and status = 1 </select> + <select id="listByPage" resultMap="BaseResultMap"> + select * from + ( + SELECT + ROW_NUMBER() over (order by mld.create_time desc) as row, + mld.* + FROM man_loc_detl mld + LEFT JOIN man_node mn ON mld.node_id = mn.id + LEFT JOIN man_mat mm ON mld.matnr = mm.matnr + LEFT JOIN man_tag mt ON mm.tag_id = mt.id + WHERE 1=1 + AND (CHARINDEX(','+#{node_id}+',', ','+mn.path+',') > 0 OR mn.id = #{node_id}) + AND (CHARINDEX(','+#{tag_id}+',', ','+mt.path+',') > 0 OR mt.id = #{tag_id}) + <include refid="nodeCondition"></include> + ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize}) + </select> + + <select id="listByPageCount" parameterType="java.util.Map" resultType="java.lang.Integer"> + select + count(1) + FROM man_loc_detl mld + LEFT JOIN man_node mn ON mld.node_id = mn.id + LEFT JOIN man_mat mm ON mld.matnr = mm.matnr + LEFT JOIN man_tag mt ON mm.tag_id = mt.id + WHERE 1=1 + AND (CHARINDEX(','+#{node_id}+',', ','+mn.path+',') > 0 OR mn.id = #{node_id}) + AND (CHARINDEX(','+#{tag_id}+',', ','+mt.path+',') > 0 OR mt.id = #{tag_id}) + <include refid="nodeCondition"></include> + </select> </mapper> -- Gitblit v1.9.1