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.
udiwms-java/api-admin/src/main/resources/mybatis/mapper/thrsys/ThrSubInvWarehouseDao.xml

111 lines
3.9 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.thrsys.ThrSubInvWarehouseDao">
<select id="filterThrInvWarehouse" parameterType="com.glxp.api.admin.req.thrsys.FilterThrInvWarehouseRequest"
resultType="com.glxp.api.admin.entity.thrsys.ThrSubInvWarehouseEntity">
SELECT *
FROM thr_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>
<if test="thirdSysFk != null">
and thirdSysFk = #{thirdSysFk}
</if>
</where>
</select>
<select id="selectById" parameterType="Map"
resultType="com.glxp.api.admin.entity.thrsys.ThrSubInvWarehouseEntity">
SELECT *
FROM thr_inv_warehouse_sub
WHERE id = #{id}
</select>
<select id="countSubInvByParentInvId" resultType="java.lang.Integer">
select count(*) from thr_inv_warehouse_sub where
parentId = (select code from thr_inv_warehouse where id = #{parentInvId})
</select>
<select id="filterThrInvWarehouseResponse"
resultType="com.glxp.api.admin.res.thrsys.ThrSubInvWarehouseResponse">
select t1.*, t2.name as parentName from thr_inv_warehouse_sub t1
left join thr_inv_warehouse t2
on t2.code =t1.parentId
<where>
<if test="id != '' and id != null">
AND t1.id = #{id}
</if>
<if test="code != '' and code != null">
AND t1.code = #{code}
</if>
<if test="name != '' and name != null">
AND t1.`name` = #{name}
</if>
<if test="parentId != '' and parentId != null">
AND t1.parentId = #{parentId}
</if>
<if test="thirdSysFk != null">
and t1.thirdSysFk = #{thirdSysFk}
</if>
</where>
</select>
<insert id="insertThrInvWarehouse" keyProperty="id"
parameterType="com.glxp.api.admin.entity.thrsys.ThrSubInvWarehouseEntity">
replace
INTO thr_inv_warehouse_sub
(id, code, `name`, parentId, remark, thirdSysFk)
values (
#{id},
#{code},
#{name},
#{parentId},
#{remark},
#{thirdSysFk}
)
</insert>
<insert id="insertThrInvWarehouses" parameterType="java.util.List">
replace INTO thr_inv_warehouse_sub
(id, code, `name`, parentId, remark, thirdSysFk)
VALUES
<foreach collection="thrInvWarehouseEntitys" item="item" index="index"
separator=",">
(
#{item.id}, #{item.code},
#{item.name}, #{item.parentId},
#{item.remark}, #{item.thirdSysFk})
</foreach>
</insert>
<delete id="deleteById" parameterType="Map">
DELETE
FROM thr_inv_warehouse_sub
WHERE id = #{id}
</delete>
<update id="updateThrInvWarehouse" parameterType="com.glxp.api.admin.entity.thrsys.ThrSubInvWarehouseEntity">
UPDATE thr_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="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if>
</trim>
WHERE id = #{id}
</update>
</mapper>