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.

213 lines
7.1 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.udi.admin.dao.inventory.InvWarehouseDao">
<select id="filterAllByUser" parameterType="com.glxp.udi.admin.req.inventory.FilterInvWarehouseRequest"
resultType="com.glxp.udi.admin.entity.inventory.InvWarehouseEntity">
select inv_warehouse.*
from inv_warehouse
INNER JOIN inv_warehouse_user
on inv_warehouse.`code` = inv_warehouse_user.code
<where>
<if test="id != '' and id != null">
AND id = #{id}
</if>
<if test="pid != '' and pid != null">
AND pid = #{pid}
</if>
<if test="code != '' and code != null">
AND inv_warehouse.code = #{code}
</if>
<if test="name != '' and name != null">
AND name = #{name}
</if>
<if test="advanceType != null">
AND advanceType = #{advanceType}
</if>
<if test="isDefault != null">
AND isDefault = #{isDefault}
</if>
<if test="pcode != null">
AND pcode = #{pcode}
</if>
<if test="userId != null">
AND inv_warehouse_user.userId = #{userId}
</if>
<if test="level != null">
AND level = #{level}
</if>
</where>
group by inv_warehouse.code
</select>
<select id="selectMaxCode" parameterType="com.glxp.udi.admin.req.inventory.FilterInvWarehouseRequest"
resultType="java.lang.String">
select max(code) as code
from inv_warehouse
<where>
<if test="id != '' and id != null">
AND id = #{id}
</if>
<if test="pid != '' and pid != null">
AND pid = #{pid}
</if>
<if test="code != '' and code != null">
AND code = #{code}
</if>
<if test="name != '' and name != null">
AND name = #{name}
</if>
<if test="advanceType != null">
AND advanceType = #{advanceType}
</if>
<if test="isDefault != null">
AND isDefault = #{isDefault}
</if>
<if test="pcode != null">
AND pcode = #{pcode}
</if>
<if test="level != null">
AND level = #{level}
</if>
</where>
</select>
<select id="filterGroupInvWarehouse" parameterType="com.glxp.udi.admin.req.inventory.FilterInvWarehouseRequest"
resultType="com.glxp.udi.admin.entity.inventory.InvWarehouseEntity">
SELECT *
FROM inv_warehouse
<where>
<if test="id != '' and id != null">
AND id = #{id}
</if>
<if test="pid != '' and pid != null">
AND pid = #{pid}
</if>
<if test="code != '' and code != null">
AND code = #{code}
</if>
<if test="name != '' and name != null">
AND name = #{name}
</if>
<if test="advanceType != '' and advanceType != null">
AND advanceType = #{advanceType}
</if>
<if test="isDefault != '' and isDefault != null">
AND isDefault = #{isDefault}
</if>
<if test="pcode != null">
AND pcode = #{pcode}
</if>
<if test="customerId != null and customerId != ''">
AND customerId = #{customerId}
</if>
</where>
</select>
<select id="getNameByCode" resultType="java.lang.String">
select name
from inv_warehouse
where code = #{fromCorpId}
</select>
<insert id="insertInvWarehouse" keyProperty="id"
parameterType="com.glxp.udi.admin.entity.inventory.InvWarehouseEntity">
replace INTO inv_warehouse
(pid, code, name, advanceType, isDefault,
status, updateTime, remark, level, pcode, customerId)
values (#{pid},
#{code},
#{name},
#{advanceType},
#{isDefault},
#{status},
#{updateTime},
#{remark},
#{level},
#{pcode},
#{customerId})
</insert>
<update id="updateInvWarehouse" parameterType="com.glxp.udi.admin.entity.inventory.InvWarehouseEntity">
UPDATE inv_warehouse
<trim prefix="set" suffixOverrides=",">
<if test="pid != null">
pid=#{pid},
</if>
<if test="name != null">
name=#{name},
</if>
<if test="code != null">
code=#{code},
</if>
<if test="advanceType != null">
advanceType=#{advanceType},
</if>
<if test="isDefault != null">
isDefault=#{isDefault},
</if>
<if test="status != null">
status=#{status},
</if>
<if test="updateTime != null">
updateTime=#{updateTime},
</if>
<if test="remark != null">
remark=#{remark},
</if>
<if test="level != null">
level=#{level},
</if>
<if test="pcode != null">
pcode=#{pcode},
</if>
<if test="thirdId != null">
remark=#{thirdId},
</if>
<if test="thirdId1 != null">
remark=#{thirdId1},
</if>
<if test="thirdId2 != null">
remark=#{thirdId2},
</if>
<if test="thirdId3 != null">
remark=#{thirdId3},
</if>
<if test="thirdId4 != null">
remark=#{thirdId4},
</if>
</trim>
WHERE id = #{id}
</update>
<insert id="importInvWarehouse" parameterType="java.util.List">
replace into inv_warehouse (id, pId, code, name, advanceType, isDefault, status,
updateTime, remark, level, pcode) values
<foreach collection="invWarehouseEntities" item="item" index="index" separator=",">
(#{item.id},
#{item.pid},
#{item.code},
#{item.name},
#{item.advanceType},
#{item.isDefault},
#{item.status},
#{item.updateTime},
#{item.remark}, #{item.level},
#{item.pcode})
</foreach>
</insert>
<update id="updateThridId" statementType="STATEMENT">
update inv_warehouse
set ${sysId} = ${thridWarehouseId}
where id = ${id}
</update>
<select id="selectNameByCode" resultType="java.lang.String">
select name
from inv_warehouse
where code = #{code}
</select>
</mapper>