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.
385 lines
16 KiB
XML
385 lines
16 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.auth.InvSpaceDao">
|
|
<resultMap id="BaseResultMap" type="com.glxp.api.entity.auth.InvSpace">
|
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
|
<result column="code" jdbcType="VARCHAR" property="code"/>
|
|
<result column="name" jdbcType="VARCHAR" property="name"/>
|
|
<result column="type" jdbcType="VARCHAR" property="type"/>
|
|
<result column="invStorageCode" jdbcType="VARCHAR" property="invStorageCode"/>
|
|
<result column="invWarehouseCode" jdbcType="VARCHAR" property="invWarehouseCode"/>
|
|
<result column="status" jdbcType="INTEGER" property="status"/>
|
|
<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"/>
|
|
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
|
</resultMap>
|
|
|
|
<sql id="Base_Column_List">
|
|
id,
|
|
code,
|
|
`name`,
|
|
type,
|
|
invStorageCode,
|
|
invWarehouseCode,
|
|
`status`,
|
|
createTime,
|
|
updateTime,
|
|
`createUser`,
|
|
updateUser,
|
|
remark
|
|
</sql>
|
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from auth_space
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</select>
|
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
delete
|
|
from auth_space
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</delete>
|
|
|
|
<insert id="insertEntity" keyColumn="id" keyProperty="id" parameterType="com.glxp.api.entity.auth.InvSpace"
|
|
useGeneratedKeys="true">
|
|
insert into auth_space (code, `name`, type, invStorageCode,
|
|
invWarehouseCode, `status`, createTime,
|
|
updateTime, `createUser`, updateUser,
|
|
remark)
|
|
values (#{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
|
#{invStorageCode,jdbcType=VARCHAR},
|
|
#{invWarehouseCode,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
|
|
#{updateTime,jdbcType=TIMESTAMP}, #{createUser,jdbcType=VARCHAR}, #{updateUser,jdbcType=VARCHAR},
|
|
#{remark,jdbcType=VARCHAR})
|
|
</insert>
|
|
|
|
<insert id="insertSelective" keyColumn="id" keyProperty="id"
|
|
parameterType="com.glxp.api.entity.auth.InvSpace" useGeneratedKeys="true">
|
|
insert into auth_space
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="code != null">
|
|
code,
|
|
</if>
|
|
<if test="name != null">
|
|
`name`,
|
|
</if>
|
|
<if test="type != null">
|
|
type,
|
|
</if>
|
|
<if test="invStorageCode != null">
|
|
invStorageCode,
|
|
</if>
|
|
<if test="invWarehouseCode != null">
|
|
invWarehouseCode,
|
|
</if>
|
|
<if test="status != null">
|
|
`status`,
|
|
</if>
|
|
<if test="createTime != null">
|
|
createTime,
|
|
</if>
|
|
<if test="updateTime != null">
|
|
updateTime,
|
|
</if>
|
|
<if test="createUser != null">
|
|
`createUser`,
|
|
</if>
|
|
<if test="updateUser != null">
|
|
updateUser,
|
|
</if>
|
|
<if test="remark != null">
|
|
remark,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="code != null">
|
|
#{code,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="name != null">
|
|
#{name,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="type != null">
|
|
#{type,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="invStorageCode != null">
|
|
#{invStorageCode,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="invWarehouseCode != null">
|
|
#{invWarehouseCode,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="status != null">
|
|
#{status,jdbcType=BOOLEAN},
|
|
</if>
|
|
<if test="createTime != null">
|
|
#{createTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="updateTime != null">
|
|
#{updateTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="createUser != null">
|
|
#{createUser,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="updateUser != null">
|
|
#{updateUser,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="remark != null">
|
|
#{remark,jdbcType=VARCHAR},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.glxp.api.entity.auth.InvSpace">
|
|
update auth_space
|
|
<set>
|
|
<if test="code != null">
|
|
code = #{code,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="name != null">
|
|
`name` = #{name,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="type != null">
|
|
type = #{type,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="invStorageCode != null">
|
|
invStorageCode = #{invStorageCode,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="invWarehouseCode != null">
|
|
invWarehouseCode = #{invWarehouseCode,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="status != null">
|
|
`status` = #{status,jdbcType=BOOLEAN},
|
|
</if>
|
|
<if test="createTime != null">
|
|
createTime = #{createTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="updateTime != null">
|
|
updateTime = #{updateTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="createUser != null">
|
|
`createUser` = #{createUser,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="updateUser != null">
|
|
updateUser = #{updateUser,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="remark != null">
|
|
remark = #{remark,jdbcType=VARCHAR},
|
|
</if>
|
|
</set>
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
|
|
<update id="updateByPrimaryKey" parameterType="com.glxp.api.entity.auth.InvSpace">
|
|
update auth_space
|
|
set code = #{code,jdbcType=VARCHAR},
|
|
`name` = #{name,jdbcType=VARCHAR},
|
|
type = #{type,jdbcType=VARCHAR},
|
|
invStorageCode = #{invStorageCode,jdbcType=VARCHAR},
|
|
invWarehouseCode = #{invWarehouseCode,jdbcType=VARCHAR},
|
|
`status` = #{status,jdbcType=BOOLEAN},
|
|
createTime = #{createTime,jdbcType=TIMESTAMP},
|
|
updateTime = #{updateTime,jdbcType=TIMESTAMP},
|
|
`createUser` = #{createUser,jdbcType=VARCHAR},
|
|
updateUser = #{updateUser,jdbcType=VARCHAR},
|
|
remark = #{remark,jdbcType=VARCHAR}
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
|
|
<update id="updateBatch" parameterType="java.util.List">
|
|
update auth_space
|
|
<trim prefix="set" suffixOverrides=",">
|
|
<trim prefix="code = case" suffix="end,">
|
|
<foreach collection="list" index="index" item="item">
|
|
when id = #{item.id,jdbcType=INTEGER} then #{item.code,jdbcType=VARCHAR}
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="`name` = case" suffix="end,">
|
|
<foreach collection="list" index="index" item="item">
|
|
when id = #{item.id,jdbcType=INTEGER} then #{item.name,jdbcType=VARCHAR}
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="type = case" suffix="end,">
|
|
<foreach collection="list" index="index" item="item">
|
|
when id = #{item.id,jdbcType=INTEGER} then #{item.type,jdbcType=VARCHAR}
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="invStorageCode = case" suffix="end,">
|
|
<foreach collection="list" index="index" item="item">
|
|
when id = #{item.id,jdbcType=INTEGER} then #{item.invStorageCode,jdbcType=VARCHAR}
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="invWarehouseCode = case" suffix="end,">
|
|
<foreach collection="list" index="index" item="item">
|
|
when id = #{item.id,jdbcType=INTEGER} then #{item.invWarehouseCode,jdbcType=VARCHAR}
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="`status` = case" suffix="end,">
|
|
<foreach collection="list" index="index" item="item">
|
|
when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=BOOLEAN}
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="createTime = case" suffix="end,">
|
|
<foreach collection="list" index="index" item="item">
|
|
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="updateTime = case" suffix="end,">
|
|
<foreach collection="list" index="index" item="item">
|
|
when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="`createUser` = case" suffix="end,">
|
|
<foreach collection="list" index="index" item="item">
|
|
when id = #{item.id,jdbcType=INTEGER} then #{item.createUser,jdbcType=VARCHAR}
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="updateUser = case" suffix="end,">
|
|
<foreach collection="list" index="index" item="item">
|
|
when id = #{item.id,jdbcType=INTEGER} then #{item.updateUser,jdbcType=VARCHAR}
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="remark = case" suffix="end,">
|
|
<foreach collection="list" index="index" item="item">
|
|
when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR}
|
|
</foreach>
|
|
</trim>
|
|
</trim>
|
|
where id in
|
|
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
|
#{item.id,jdbcType=INTEGER}
|
|
</foreach>
|
|
</update>
|
|
|
|
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
|
insert into auth_space
|
|
(code, `name`, type, invStorageCode, invWarehouseCode, `status`, createTime, updateTime,
|
|
`createUser`, updateUser, remark)
|
|
values
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.code,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR},
|
|
#{item.invStorageCode,jdbcType=VARCHAR},
|
|
#{item.invWarehouseCode,jdbcType=VARCHAR}, #{item.status,jdbcType=BOOLEAN},
|
|
#{item.createTime,jdbcType=TIMESTAMP},
|
|
#{item.updateTime,jdbcType=TIMESTAMP}, #{item.createUser,jdbcType=VARCHAR},
|
|
#{item.updateUser,jdbcType=VARCHAR},
|
|
#{item.remark,jdbcType=VARCHAR})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<select id="filterList" parameterType="com.glxp.api.req.auth.FilterInvSpaceRequest" resultType="com.glxp.api.res.auth.InvSpaceResponse">
|
|
select s.*,
|
|
w.name invStorageName,
|
|
iws.name invSubStorageName
|
|
from auth_space s
|
|
left join auth_dept w on s.invStorageCode = w.code
|
|
left join auth_warehouse iws on s.invWarehouseCode = iws.code
|
|
<where>
|
|
<if test="invStorageCode != null and invStorageCode != ''">
|
|
AND s.invStorageCode = #{invStorageCode}
|
|
</if>
|
|
<if test="invWarehouseCode != null and invWarehouseCode != ''">
|
|
AND s.invWarehouseCode = #{invWarehouseCode}
|
|
</if>
|
|
<if test="key != null and key != ''">
|
|
AND (s.code like concat('%', #{key}, '%') or s.name like concat('%', #{key}, '%') or
|
|
s.type like concat('%', #{key}, '%'))
|
|
</if>
|
|
<if test="status != null">
|
|
AND s.status = #{status}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectList" resultMap="BaseResultMap">
|
|
select *
|
|
from auth_space
|
|
<where>
|
|
<if test="invStorageCode != null and invStorageCode != ''">
|
|
AND invStorageCode = #{invStorageCode}
|
|
</if>
|
|
<if test="invWarehouseCode != null and invWarehouseCode != ''">
|
|
AND invWarehouseCode = #{invWarehouseCode}
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
AND name = #{name}
|
|
</if>
|
|
<if test="type != null and type != ''">
|
|
AND type = #{type}
|
|
</if>
|
|
<if test="code != null and code != ''">
|
|
AND code = #{code}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectSpaceCodeList" resultType="com.glxp.api.res.auth.InvSpaceResponse">
|
|
select auth_space.code, auth_space.name, iws.name invSubStorageName, iw.name invStorageName
|
|
from auth_space
|
|
left join auth_warehouse iws on iws.code = auth_space.invWarehouseCode
|
|
left join auth_dept iw on iw.code = auth_space.invStorageCode
|
|
<where>
|
|
<if test="invStorageCode != null and invStorageCode != ''">
|
|
AND auth_space.invStorageCode = #{invStorageCode}
|
|
</if>
|
|
<if test="invWarehouseCode != null and invWarehouseCode != ''">
|
|
AND auth_space.invWarehouseCode = #{invWarehouseCode}
|
|
</if>
|
|
<if test="status != null">
|
|
AND auth_space.status = #{status}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectNameByCode" resultType="java.lang.String">
|
|
select name
|
|
from auth_space
|
|
where invStorageCode = #{invStorageCode}
|
|
and invWarehouseCode = #{invWarehouseCode}
|
|
and code = #{code}
|
|
</select>
|
|
|
|
<select id="selectByWarehouseCode" resultMap="BaseResultMap">
|
|
select *
|
|
from auth_space
|
|
where invWarehouseCode = #{warehouseCode}
|
|
</select>
|
|
|
|
<select id="selectExist" resultMap="BaseResultMap">
|
|
select *
|
|
from auth_space
|
|
<where>
|
|
<if test="invStorageCode != null and invStorageCode != ''">
|
|
AND invStorageCode = #{invStorageCode}
|
|
</if>
|
|
<if test="invWarehouseCode != null and invWarehouseCode != ''">
|
|
AND invWarehouseCode = #{invWarehouseCode}
|
|
</if>
|
|
<if test="code != null and code != ''">
|
|
AND code = #{code}
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
AND name = #{name}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectByInvCode" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from auth_space
|
|
<where>
|
|
<if test="invStorageCode != null and invStorageCode != ''">
|
|
AND invStorageCode = #{invStorageCode}
|
|
</if>
|
|
<if test="invWarehouseCode != null and invWarehouseCode != ''">
|
|
AND invWarehouseCode = #{invWarehouseCode}
|
|
</if>
|
|
<if test="invSpaceCode != null and invSpaceCode != ''">
|
|
AND code = #{invSpaceCode}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
</mapper> |