You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udi-wms-java/src/main/resources/mybatis/mapper/basic/SysWorkplaceQueueMapper.xml

200 lines
7.5 KiB
XML

<?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.glxp.api.dao.basic.SysWorkplaceQueueMapper">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.basic.SysWorkplaceQueue">
<!--@mbg.generated-->
<!--@Table sys_workplace_queue-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="workPlaceIdFk" jdbcType="BIGINT" property="workPlaceIdFk"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="createTime" jdbcType="TIMESTAMP" property="createTime"/>
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="createUser" jdbcType="VARCHAR" property="createUser"/>
<result column="updateUser" jdbcType="VARCHAR" property="updateUser"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id,
code,
`name`,
workPlaceIdFk,
remark,
createTime,
updateTime,
`createUser`,
updateUser
</sql>
<select id="selectMaxLayer" resultType="java.lang.Integer">
select max(layer) as layer
from sys_workplace_queue
<where>
<if test="freightCode != null and freightCode != ''">
AND freightCode = #{freightCode}
</if>
</where>
</select>
<select id="filterBindList" resultType="com.glxp.api.res.basic.SysWorkplaceQueueResponse">
select swq.*,
bp.nameCode,
COALESCE(bp.ggxh, bp.bzgg) AS ggxh,
bp.cpmctymc,sys_workplace.workplaceName
from sys_workplace_queue swq
left join
(select bu.id, bp.nameCode, bp.ggxh, bp.cpmctymc, bp.bzgg
from basic_udirel bu
left join basic_products bp ON bu.uuid = bp.uuid
group by bu.id, bp.nameCode, bp.ggxh, bp.cpmctymc) as bp ON bp.id = swq.relId
left join sys_workplace on swq.workPlaceIdFk = sys_workplace.workplaceId
left join io_collect_led_group on swq.relId = io_collect_led_group.relId
<where>
<if test="key != null and key != ''">
AND (
swq.code like concat('%', #{key}, '%')
or swq.name like concat('%', #{key}, '%')
)
</if>
<if test="scanCode != null and scanCode != ''">
AND (
swq.code like concat('%', #{scanCode}, '%')
or swq.freightCode like concat('%', #{scanCode}, '%')
or swq.layerCode like concat('%', #{scanCode}, '%')
)
</if>
<if test="nameCode != null and nameCode != ''">
AND (
bp.nameCode like concat('%', #{nameCode}, '%')
)
</if>
<if test="cpmctymc != null and cpmctymc != ''">
AND (
bp.cpmctymc like concat('%', #{cpmctymc}, '%')
)
</if>
<if test="ggxh != null and ggxh != ''">
AND (
bp.ggxh like concat('%', #{ggxh}, '%')
or bp.bzgg like concat('%', #{ggxh}, '%')
)
</if>
<if test="layerCode != null and layerCode != ''">
AND (
layerCode like concat('%', #{layerCode}, '%')
)
</if>
<if test=" freightCode != null and freightCode != ''">
AND (
freightCode like concat('%', #{freightCode}, '%')
)
</if>
<if test="code != null and code != ''">
AND swq.code = #{code}
</if>
<if test="workPlaceIdFk != null and workPlaceIdFk != ''">
AND swq.workPlaceIdFk = #{workPlaceIdFk}
</if>
<if test="layerCodes != null and layerCodes.size() > 0">
and swq.layerCode in
<foreach collection="layerCodes" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="keyWords != null and keyWords != '' ">
AND (
bp.nameCode like concat('%', #{keyWords}, '%')
or bp.cpmctymc like concat('%', #{keyWords}, '%')
or bp.ggxh like concat('%', #{keyWords}, '%')
or bp.bzgg like concat('%', #{keyWords}, '%')
or layerCode like concat('%', #{keyWords}, '%')
or freightCode like concat('%', #{keyWords}, '%'))
</if>
</where>
GROUP BY swq.code
</select>
<select id="filterList" resultType="com.glxp.api.res.basic.SysWorkplaceQueueResponse">
select swq.*
from sys_workplace_queue swq
<where>
<if test="key != null and key != ''">
AND (
swq.code like concat('%', #{key}, '%')
or swq.name like concat('%', #{key}, '%')
)
</if>
<if test="layerCode != null and layerCode != ''">
AND layerCode = #{layerCode}
</if>
<if test="layerCodes != null and layerCodes.size() > 0">
and swq.layerCode in
<foreach collection="layerCodes" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
</select>
<select id="selectMaxGrid" resultType="java.lang.Integer">
select max(grid) as grid
from sys_workplace_queue
<where>
<if test="freightCode != null and freightCode != ''">
AND freightCode = #{freightCode}
</if>
<if test="layer != null and layer != ''">
AND layer = #{layer}
</if>
</where>
</select>
<select id="selectMaxCode" resultType="java.lang.String">
select max(code) as code
from sys_workplace_queue
<where>
<if test="layerCode != null and layerCode != ''">
AND layerCode = #{layerCode}
</if>
</where>
</select>
<select id="selectByLayerCode" resultType="com.glxp.api.entity.basic.SysWorkplaceQueue">
select *
from sys_workplace_queue
<where>
<if test="layerCode != null and layerCode != ''">
AND layerCode = #{layerCode}
</if>
</where>
ORDER BY code DESC
LIMIT 1
</select>
<!-- <update id="updateByRelId">-->
<!-- UPDATE sys_workplace_queue-->
<!-- <trim prefix="set" suffixOverrides=",">-->
<!-- <if test="nameCode != null">-->
<!-- nameCode=#{nameCode},-->
<!-- </if>-->
<!-- </trim>-->
<!-- WHERE nameCode = #{nameCode}-->
<!-- and uuid = #{uuid}-->
<!-- </update>-->
<update id="updateByRelId">
UPDATE sys_workplace_queue
<set>
relId = null
</set>
WHERE code = #{code}
</update>
<update id="removeQueueMac">
UPDATE sys_workplace_queue
<set>
mac = null
</set>
WHERE code = #{code}
</update>
</mapper>