|
|
|
@ -2,7 +2,6 @@
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
|
|
|
|
|
|
|
|
<mapper namespace="com.glxp.api.dao.auth.InvSubWarehouseDao">
|
|
|
|
|
|
|
|
|
|
<select id="filterInvSubWarehouse" parameterType="com.glxp.api.req.auth.FilterInvSubWarehouseRequest"
|
|
|
|
|
resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
|
|
|
|
|
select *
|
|
|
|
@ -15,7 +14,7 @@
|
|
|
|
|
AND a.code = #{code}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="name != '' and name != null">
|
|
|
|
|
AND a.name like concat('%',#{name},'%')
|
|
|
|
|
AND a.name like concat('%', #{name}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="parentId != '' and parentId != null">
|
|
|
|
|
AND a.parentId = #{parentId}
|
|
|
|
@ -23,21 +22,24 @@
|
|
|
|
|
<if test="defaultInv != '' and defaultInv != null">
|
|
|
|
|
AND a.defaultInv = #{defaultInv}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</where>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectJoinThirdSys" parameterType="Map"
|
|
|
|
|
resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
|
|
|
|
|
select auth_warehouse.* ,a.name thirdName,a1.name thirdName1,a2.name thirdName2,a3.name thirdName3,a4.name
|
|
|
|
|
thirdName4
|
|
|
|
|
select auth_warehouse.*,
|
|
|
|
|
a.name thirdName,
|
|
|
|
|
a1.name thirdName1,
|
|
|
|
|
a2.name thirdName2,
|
|
|
|
|
a3.name thirdName3,
|
|
|
|
|
a4.name
|
|
|
|
|
thirdName4
|
|
|
|
|
from auth_warehouse
|
|
|
|
|
LEFT JOIN thr_inv_warehouse a on a.code = auth_warehouse.thirdId
|
|
|
|
|
LEFT JOIN thr_inv_warehouse a1 on a1.code = auth_warehouse.thirdId1
|
|
|
|
|
LEFT JOIN thr_inv_warehouse a2 on a2.code = auth_warehouse.thirdId2
|
|
|
|
|
LEFT JOIN thr_inv_warehouse a3 on a3.code = auth_warehouse.thirdId3
|
|
|
|
|
LEFT JOIN thr_inv_warehouse a4 on a4.code = auth_warehouse.thirdId4
|
|
|
|
|
LEFT JOIN thr_inv_warehouse a on a.code = auth_warehouse.thirdId
|
|
|
|
|
LEFT JOIN thr_inv_warehouse a1 on a1.code = auth_warehouse.thirdId1
|
|
|
|
|
LEFT JOIN thr_inv_warehouse a2 on a2.code = auth_warehouse.thirdId2
|
|
|
|
|
LEFT JOIN thr_inv_warehouse a3 on a3.code = auth_warehouse.thirdId3
|
|
|
|
|
LEFT JOIN thr_inv_warehouse a4 on a4.code = auth_warehouse.thirdId4
|
|
|
|
|
<where>
|
|
|
|
|
<if test="code != '' and code != null">
|
|
|
|
|
AND auth_warehouse.code = #{code}
|
|
|
|
@ -52,9 +54,11 @@
|
|
|
|
|
limit 1
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="filterGroupInvSub" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest"
|
|
|
|
|
resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
|
|
|
|
|
select auth_warehouse.*, auth_dept.`name` AS warehouseName from auth_warehouse INNER JOIN
|
|
|
|
|
select auth_warehouse.*, auth_dept.`name` AS warehouseName from auth_warehouse
|
|
|
|
|
INNER JOIN
|
|
|
|
|
auth_dept
|
|
|
|
|
on auth_warehouse.parentId = auth_dept.code
|
|
|
|
|
<if test="userId != '' and userId != null">
|
|
|
|
@ -64,6 +68,9 @@
|
|
|
|
|
<if test="userId != '' and userId != null">
|
|
|
|
|
AND auth_warehouse_user.userId = #{userId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="deptCode != '' and deptCode != null">
|
|
|
|
|
AND auth_warehouse.parentId = #{deptCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pcode != '' and pcode != null">
|
|
|
|
|
AND auth_dept.code = #{pcode}
|
|
|
|
|
</if>
|
|
|
|
@ -75,7 +82,7 @@
|
|
|
|
|
</if>
|
|
|
|
|
<if test="superiorCode != '' and superiorCode != null">
|
|
|
|
|
AND (auth_dept.code = #{superiorPcode}
|
|
|
|
|
OR auth_dept.pcode = #{superiorCode})
|
|
|
|
|
OR auth_dept.pcode = #{superiorCode})
|
|
|
|
|
</if>
|
|
|
|
|
<if test="subordinateCode != '' and subordinateCode != null">
|
|
|
|
|
AND auth_dept.pcode = #{subordinateCode}
|
|
|
|
@ -86,19 +93,20 @@
|
|
|
|
|
|
|
|
|
|
<select id="filterGroupInvSubAndcode" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest"
|
|
|
|
|
resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
|
|
|
|
|
select auth_warehouse.* from auth_warehouse
|
|
|
|
|
select auth_warehouse.*
|
|
|
|
|
from auth_warehouse
|
|
|
|
|
<where>
|
|
|
|
|
<if test="code != '' and code != null">
|
|
|
|
|
AND auth_warehouse.code = #{code}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
group by auth_warehouse.id
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectMaxCode" parameterType="com.glxp.api.req.auth.FilterInvSubWarehouseRequest"
|
|
|
|
|
resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
|
|
|
|
|
select max(code) as code from auth_warehouse
|
|
|
|
|
select max(code) as code
|
|
|
|
|
from auth_warehouse
|
|
|
|
|
<where>
|
|
|
|
|
<if test="id != '' and id != null">
|
|
|
|
|
AND id = #{id}
|
|
|
|
@ -113,7 +121,6 @@
|
|
|
|
|
AND parentId = #{parentId}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -150,27 +157,44 @@
|
|
|
|
|
<update id="updateInvSubWarehouse" parameterType="com.glxp.api.entity.auth.InvWarehouseEntity">
|
|
|
|
|
UPDATE auth_warehouse
|
|
|
|
|
<trim prefix="set" suffixOverrides=",">
|
|
|
|
|
<if test="name != null">name=#{name},</if>
|
|
|
|
|
<if test="code != null">code=#{code},</if>
|
|
|
|
|
<if test="parentId != null">parentId=#{parentId},</if>
|
|
|
|
|
<if test="remark != null">remark=#{remark},</if>
|
|
|
|
|
<if test="defaultInv != null">defaultInv=#{defaultInv},</if>
|
|
|
|
|
<if test="parentCode != null">parentCode=#{parentCode},</if>
|
|
|
|
|
<if test="name != null">
|
|
|
|
|
name=#{name},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="code != null">
|
|
|
|
|
code=#{code},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="parentId != null">
|
|
|
|
|
parentId=#{parentId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="remark != null">
|
|
|
|
|
remark=#{remark},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="defaultInv != null">
|
|
|
|
|
defaultInv=#{defaultInv},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="parentCode != null">
|
|
|
|
|
parentCode=#{parentCode},
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<insert id="importInvSubWarehouse" parameterType="java.util.List">
|
|
|
|
|
replace into auth_warehouse
|
|
|
|
|
replace
|
|
|
|
|
into auth_warehouse
|
|
|
|
|
(id, code, `name`, parentId, remark,defaultInv,parentCode)
|
|
|
|
|
values
|
|
|
|
|
|
|
|
|
|
<foreach collection="invWarehouseEntities" item="item" index="index" separator=",">
|
|
|
|
|
(
|
|
|
|
|
#{item.id},
|
|
|
|
|
#{item.code},
|
|
|
|
|
#{item.name},
|
|
|
|
|
#{item.parentId},
|
|
|
|
|
#{item.remark},#{item.defaultInv},#{item.parentCode})
|
|
|
|
|
#{item.remark},
|
|
|
|
|
#{item.defaultInv},
|
|
|
|
|
#{item.parentCode}
|
|
|
|
|
)
|
|
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
@ -195,11 +219,23 @@
|
|
|
|
|
|
|
|
|
|
<select id="filterInvSubWarehouseResponse"
|
|
|
|
|
resultType="com.glxp.api.res.auth.InvSubWarehouseResponse">
|
|
|
|
|
select a.id, a.code, a.name, a.parentId, a.remark, a.defaultInv, a.thirdId, a.thirdId1, a.thirdId2,
|
|
|
|
|
a.thirdId3, a.thirdId4, b.name as parentName,a.parentCode,c.name parentInvName
|
|
|
|
|
select a.id,
|
|
|
|
|
a.code,
|
|
|
|
|
a.name,
|
|
|
|
|
a.parentId,
|
|
|
|
|
a.remark,
|
|
|
|
|
a.defaultInv,
|
|
|
|
|
a.thirdId,
|
|
|
|
|
a.thirdId1,
|
|
|
|
|
a.thirdId2,
|
|
|
|
|
a.thirdId3,
|
|
|
|
|
a.thirdId4,
|
|
|
|
|
b.name as parentName,
|
|
|
|
|
a.parentCode,
|
|
|
|
|
c.name parentInvName
|
|
|
|
|
FROM auth_warehouse a
|
|
|
|
|
left join auth_dept b on a.parentId = b.code
|
|
|
|
|
left join auth_warehouse c on a.parentCode = c.code
|
|
|
|
|
left join auth_dept b on a.parentId = b.code
|
|
|
|
|
left join auth_warehouse c on a.parentCode = c.code
|
|
|
|
|
<where>
|
|
|
|
|
<if test="id != '' and id != null">
|
|
|
|
|
AND a.id = #{id}
|
|
|
|
@ -208,7 +244,7 @@
|
|
|
|
|
AND a.code = #{code}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="name != '' and name != null">
|
|
|
|
|
AND a.name like concat('%',#{name},'%')
|
|
|
|
|
AND a.name like concat('%', #{name}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="parentId != '' and parentId != null">
|
|
|
|
|
AND a.parentId = #{parentId}
|
|
|
|
@ -224,35 +260,36 @@
|
|
|
|
|
|
|
|
|
|
<select id="filterGroupInvSubDown" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest"
|
|
|
|
|
resultType="com.glxp.api.entity.auth.InvWarehouseEntity">
|
|
|
|
|
select auth_warehouse.*, auth_dept.`name` AS warehouseName from auth_warehouse INNER JOIN
|
|
|
|
|
auth_dept
|
|
|
|
|
on auth_warehouse.parentId = auth_dept.code
|
|
|
|
|
select auth_warehouse.*, auth_dept.`name` AS warehouseName
|
|
|
|
|
from auth_warehouse
|
|
|
|
|
INNER JOIN
|
|
|
|
|
auth_dept
|
|
|
|
|
on auth_warehouse.parentId = auth_dept.code
|
|
|
|
|
<where>
|
|
|
|
|
<if test="subordinateCode != '' and subordinateCode != null">
|
|
|
|
|
AND auth_dept.pcode = #{subordinateCode}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</where>
|
|
|
|
|
group by auth_warehouse.id
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="filterSubInvList" resultType="com.glxp.api.res.auth.InvSubWarehouseResponse">
|
|
|
|
|
select a.id,
|
|
|
|
|
a.code,
|
|
|
|
|
a.name,
|
|
|
|
|
a.parentId,
|
|
|
|
|
a.remark,
|
|
|
|
|
a.defaultInv,
|
|
|
|
|
a.thirdId,
|
|
|
|
|
a.thirdId1,
|
|
|
|
|
a.thirdId2,
|
|
|
|
|
a.thirdId3,
|
|
|
|
|
a.thirdId4,
|
|
|
|
|
b.name parentName,a.parentCode
|
|
|
|
|
a.code,
|
|
|
|
|
a.name,
|
|
|
|
|
a.parentId,
|
|
|
|
|
a.remark,
|
|
|
|
|
a.defaultInv,
|
|
|
|
|
a.thirdId,
|
|
|
|
|
a.thirdId1,
|
|
|
|
|
a.thirdId2,
|
|
|
|
|
a.thirdId3,
|
|
|
|
|
a.thirdId4,
|
|
|
|
|
b.name parentName,
|
|
|
|
|
a.parentCode
|
|
|
|
|
from auth_warehouse a
|
|
|
|
|
left join auth_dept b on a.parentId = b.code
|
|
|
|
|
left join auth_warehouse_user c on a.code = c.code
|
|
|
|
|
left join auth_dept b on a.parentId = b.code
|
|
|
|
|
left join auth_warehouse_user c on a.code = c.code
|
|
|
|
|
<where>
|
|
|
|
|
<if test="userId != null">
|
|
|
|
|
AND c.userId = #{userId}
|
|
|
|
|