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.
231 lines
8.7 KiB
XML
231 lines
8.7 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.admin.dao.inventory.InvSubWarehouseDao">
|
|
|
|
<select id="filterInvSubWarehouse" parameterType="com.glxp.api.admin.req.inventory.FilterInvSubWarehouseRequest"
|
|
resultType="com.glxp.api.admin.entity.inventory.InvSubWarehouseEntity">
|
|
select *
|
|
FROM inv_warehouse_sub a
|
|
<where>
|
|
<if test="id != '' and id != null">
|
|
AND a.id = #{id}
|
|
</if>
|
|
<if test="code != '' and code != null">
|
|
AND a.code = #{code}
|
|
</if>
|
|
<if test="name != '' and name != null">
|
|
AND a.name like concat('%',#{name},'%')
|
|
</if>
|
|
<if test="parentId != '' and parentId != null">
|
|
AND a.parentId = #{parentId}
|
|
</if>
|
|
<if test="defaultInv != '' and defaultInv != null">
|
|
AND a.defaultInv = #{defaultInv}
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
<select id="selectJoinThirdSys" parameterType="Map"
|
|
resultType="com.glxp.api.admin.entity.inventory.InvSubWarehouseEntity">
|
|
select inv_warehouse_sub.* ,a.name thirdName,a1.name thirdName1,a2.name thirdName2,a3.name thirdName3,a4.name
|
|
thirdName4
|
|
from inv_warehouse_sub
|
|
LEFT JOIN thr_inv_warehouse_sub a on a.code = inv_warehouse_sub.thirdId
|
|
LEFT JOIN thr_inv_warehouse_sub a1 on a1.code = inv_warehouse_sub.thirdId1
|
|
LEFT JOIN thr_inv_warehouse_sub a2 on a2.code = inv_warehouse_sub.thirdId2
|
|
LEFT JOIN thr_inv_warehouse_sub a3 on a3.code = inv_warehouse_sub.thirdId3
|
|
LEFT JOIN thr_inv_warehouse_sub a4 on a4.code = inv_warehouse_sub.thirdId4
|
|
<where>
|
|
<if test="code != '' and code != null">
|
|
AND inv_warehouse_sub.code = #{code}
|
|
</if>
|
|
<if test="name != '' and name != null">
|
|
AND inv_warehouse_sub.`name` = #{name}
|
|
</if>
|
|
<if test="parentId != '' and parentId != null">
|
|
AND inv_warehouse_sub.parentId = #{parentId}
|
|
</if>
|
|
</where>
|
|
limit 1
|
|
</select>
|
|
|
|
<select id="filterGroupInvSub" parameterType="com.glxp.api.admin.req.inventory.FilterInvWarehouseRequest"
|
|
resultType="com.glxp.api.admin.entity.inventory.InvSubWarehouseEntity">
|
|
select inv_warehouse_sub.*, inv_warehouse.`name` AS warehouseName from inv_warehouse_sub INNER JOIN inv_warehouse
|
|
on inv_warehouse_sub.parentId = inv_warehouse.code
|
|
<if test="userId != '' and userId != null">
|
|
INNER JOIN inv_warehouse_user on inv_warehouse_sub.code = inv_warehouse_user.code
|
|
</if>
|
|
<where>
|
|
<if test="userId != '' and userId != null">
|
|
AND inv_warehouse_user.userId = #{userId}
|
|
</if>
|
|
<if test="pcode != '' and pcode != null">
|
|
AND inv_warehouse.code = #{pcode}
|
|
</if>
|
|
<if test="warehouseCode != '' and warehouseCode != null">
|
|
AND inv_warehouse.code <> #{warehouseCode}
|
|
</if>
|
|
<if test="spUse != '' and spUse != null">
|
|
AND inv_warehouse.spUse = #{spUse}
|
|
</if>
|
|
<if test="superiorCode != '' and superiorCode != null">
|
|
AND (inv_warehouse.code = #{subordinateCode}
|
|
OR inv_warehouse.pcode = #{superiorCode})
|
|
</if>
|
|
<if test="subordinateCode != '' and subordinateCode != null">
|
|
AND inv_warehouse.pcode = #{subordinateCode}
|
|
</if>
|
|
</where>
|
|
group by inv_warehouse_sub.id
|
|
</select>
|
|
|
|
<select id="filterGroupInvSubAndcode" parameterType="com.glxp.api.admin.req.inventory.FilterInvWarehouseRequest"
|
|
resultType="com.glxp.api.admin.entity.inventory.InvSubWarehouseEntity">
|
|
select inv_warehouse_sub.* from inv_warehouse_sub
|
|
<where>
|
|
<if test="code != '' and code != null">
|
|
AND inv_warehouse_sub.code = #{code}
|
|
</if>
|
|
</where>
|
|
group by inv_warehouse_sub.id
|
|
|
|
</select>
|
|
|
|
<select id="selectMaxCode" parameterType="com.glxp.api.admin.req.inventory.FilterInvSubWarehouseRequest"
|
|
resultType="com.glxp.api.admin.entity.inventory.InvSubWarehouseEntity">
|
|
select max(code) as code from inv_warehouse_sub
|
|
<where>
|
|
<if test="id != '' and id != null">
|
|
AND id = #{id}
|
|
</if>
|
|
<if test="code != '' and code != null">
|
|
AND code = #{code}
|
|
</if>
|
|
<if test="name != '' and name != null">
|
|
AND name = #{name}
|
|
</if>
|
|
<if test="parentId != '' and parentId != null">
|
|
AND parentId = #{parentId}
|
|
</if>
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
<insert id="insertInvSubWarehouse" keyProperty="id"
|
|
parameterType="com.glxp.api.admin.entity.inventory.InvSubWarehouseEntity">
|
|
replace
|
|
INTO inv_warehouse_sub
|
|
(id, code, `name`, parentId, remark,defaultInv)
|
|
values (
|
|
#{id},
|
|
#{code},
|
|
#{name},
|
|
#{parentId},
|
|
#{remark},
|
|
#{defaultInv}
|
|
)
|
|
</insert>
|
|
|
|
|
|
<delete id="deleteById" parameterType="Map">
|
|
DELETE
|
|
FROM inv_warehouse_sub
|
|
WHERE id = #{id}
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteByParentCode" parameterType="Map">
|
|
DELETE
|
|
FROM inv_warehouse_sub
|
|
WHERE parentId = #{code}
|
|
</delete>
|
|
|
|
<update id="updateInvSubWarehouse" parameterType="com.glxp.api.admin.entity.inventory.InvSubWarehouseEntity">
|
|
UPDATE inv_warehouse_sub
|
|
<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>
|
|
</trim>
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
<insert id="importInvSubWarehouse" parameterType="java.util.List">
|
|
replace into inv_warehouse_sub
|
|
(id, code, `name`, parentId, remark,defaultInv)
|
|
values
|
|
<foreach collection="invWarehouseEntities" item="item" index="index" separator=",">
|
|
(
|
|
#{item.id},
|
|
#{item.code},
|
|
#{item.name},
|
|
#{item.parentId},
|
|
#{item.remark},#{item.defaultInv})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<select id="countByParentIdAndName" resultType="int">
|
|
select count(*)
|
|
from inv_warehouse_sub
|
|
where parentId = #{parentId}
|
|
and name = #{name}
|
|
</select>
|
|
|
|
<select id="selectNameByCode" resultType="java.lang.String">
|
|
select name
|
|
from inv_warehouse_sub
|
|
where code = #{code}
|
|
</select>
|
|
|
|
<update id="updateThridId" parameterType="Map">
|
|
update inv_warehouse_sub
|
|
set ${sysId} = #{thridWarehouseId,jdbcType=VARCHAR}
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<select id="filterInvSubWarehouseResponse"
|
|
resultType="com.glxp.api.admin.res.inventory.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
|
|
FROM inv_warehouse_sub a
|
|
left join inv_warehouse b on a.parentId = b.code
|
|
<where>
|
|
<if test="id != '' and id != null">
|
|
AND a.id = #{id}
|
|
</if>
|
|
<if test="code != '' and code != null">
|
|
AND a.code = #{code}
|
|
</if>
|
|
<if test="name != '' and name != null">
|
|
AND a.name like concat('%',#{name},'%')
|
|
</if>
|
|
<if test="parentId != '' and parentId != null">
|
|
AND a.parentId = #{parentId}
|
|
</if>
|
|
<if test="defaultInv != '' and defaultInv != null">
|
|
AND a.defaultInv = #{defaultInv}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="filterGroupInvSubDown" parameterType="com.glxp.api.admin.req.inventory.FilterInvWarehouseRequest"
|
|
resultType="com.glxp.api.admin.entity.inventory.InvSubWarehouseEntity">
|
|
select inv_warehouse_sub.*, inv_warehouse.`name` AS warehouseName from inv_warehouse_sub INNER JOIN inv_warehouse
|
|
on inv_warehouse_sub.parentId = inv_warehouse.code
|
|
<where>
|
|
<if test="subordinateCode != '' and subordinateCode != null">
|
|
AND inv_warehouse.pcode = #{subordinateCode}
|
|
</if>
|
|
|
|
</where>
|
|
group by inv_warehouse_sub.id
|
|
|
|
</select>
|
|
</mapper> |