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.
329 lines
12 KiB
XML
329 lines
12 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.WarehouseUserDao">
|
|
<resultMap id="BaseResultMap" autoMapping="true" type="com.glxp.api.entity.auth.WarehouseUserEntity">
|
|
<!--@mbg.generated-->
|
|
<!--@Table auth_warehouse_user-->
|
|
<!-- <id column="id" jdbcType="INTEGER" property="id"/>-->
|
|
<result column="code" jdbcType="VARCHAR" property="code"/>
|
|
<result column="userId" jdbcType="BIGINT" property="userid"/>
|
|
<result column="userName" jdbcType="VARCHAR" property="username"/>
|
|
<result column="isDirector" javaType="boolean" property="isDirector"/>
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
|
<!--@mbg.generated-->
|
|
id,
|
|
code,
|
|
userId,
|
|
userName,
|
|
isDirector,
|
|
locSubInvCode
|
|
</sql>
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
<!--@mbg.generated-->
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from auth_warehouse_user
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</select>
|
|
<select id="selectNotSelectUserid" resultMap="BaseResultMap">
|
|
select *
|
|
from auth_warehouse_user
|
|
<where>
|
|
<if test="userIds != null and userIds.size() != 0">
|
|
and id in
|
|
<foreach collection="userIds" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<delete id="deleteByCodeAndId">
|
|
<!--@mbg.generated-->
|
|
delete
|
|
from auth_warehouse_user
|
|
where userid = #{id}
|
|
and code = #{code}
|
|
</delete>
|
|
<insert id="insertEntity" keyColumn="id" keyProperty="id"
|
|
parameterType="com.glxp.api.entity.auth.WarehouseUserEntity" useGeneratedKeys="true">
|
|
<!--@mbg.generated-->
|
|
insert into auth_warehouse_user (code, userId, userName, isDirector)
|
|
values (#{code,jdbcType=VARCHAR}, #{userid,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{isDirector})
|
|
</insert>
|
|
<insert id="insertSelective" keyColumn="id" keyProperty="id"
|
|
parameterType="com.glxp.api.entity.auth.WarehouseUserEntity" useGeneratedKeys="true">
|
|
<!--@mbg.generated-->
|
|
insert into auth_warehouse_user
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="code != null">
|
|
code,
|
|
</if>
|
|
<if test="userid != null">
|
|
userId,
|
|
</if>
|
|
<if test="username != null">
|
|
userName,
|
|
</if>
|
|
isDirector
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="code != null">
|
|
#{code,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="userid != null">
|
|
#{userid,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="username != null">
|
|
#{username,jdbcType=VARCHAR},
|
|
</if>
|
|
#{isDirector}
|
|
</trim>
|
|
</insert>
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.glxp.api.entity.auth.WarehouseUserEntity">
|
|
<!--@mbg.generated-->
|
|
update auth_warehouse_user
|
|
<set>
|
|
<if test="code != null">
|
|
code = #{code,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="userid != null">
|
|
userId = #{userid,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="username != null">
|
|
userName = #{username,jdbcType=VARCHAR},
|
|
</if>
|
|
</set>
|
|
isDirector = #{isDirector}
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
<update id="updateByPrimaryKey" parameterType="com.glxp.api.entity.auth.WarehouseUserEntity">
|
|
<!--@mbg.generated-->
|
|
update auth_warehouse_user
|
|
set code = #{code,jdbcType=VARCHAR},
|
|
userId = #{userid,jdbcType=BIGINT},
|
|
userName = #{username,jdbcType=VARCHAR} isDirector = #{isDirector}
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
<update id="updateBatch" parameterType="java.util.List">
|
|
<!--@mbg.generated-->
|
|
update auth_warehouse_user
|
|
<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="userId = case" suffix="end,">
|
|
<foreach collection="list" index="index" item="item">
|
|
when id = #{item.id,jdbcType=INTEGER} then #{item.userid,jdbcType=BIGINT}
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="userName = case" suffix="end,">
|
|
<foreach collection="list" index="index" item="item">
|
|
when id = #{item.id,jdbcType=INTEGER} then #{item.username,jdbcType=VARCHAR}
|
|
</foreach>
|
|
</trim>
|
|
</trim>
|
|
where id in
|
|
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
|
#{item.id,jdbcType=INTEGER}
|
|
</foreach>
|
|
</update>
|
|
<update id="updateBatchSelective" parameterType="java.util.List">
|
|
<!--@mbg.generated-->
|
|
update auth_warehouse_user
|
|
<trim prefix="set" suffixOverrides=",">
|
|
<trim prefix="code = case" suffix="end,">
|
|
<foreach collection="list" index="index" item="item">
|
|
<if test="item.code != null">
|
|
when id = #{item.id,jdbcType=INTEGER} then #{item.code,jdbcType=VARCHAR}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="userId = case" suffix="end,">
|
|
<foreach collection="list" index="index" item="item">
|
|
<if test="item.userid != null">
|
|
when id = #{item.id,jdbcType=INTEGER} then #{item.userid,jdbcType=BIGINT}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="userName = case" suffix="end,">
|
|
<foreach collection="list" index="index" item="item">
|
|
<if test="item.username != null">
|
|
when id = #{item.id,jdbcType=INTEGER} then #{item.username,jdbcType=VARCHAR}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
</trim>
|
|
where id in
|
|
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
|
#{item.id,jdbcType=INTEGER}
|
|
</foreach>
|
|
</update>
|
|
<insert id="insertOrUpdateEntity" keyColumn="id" keyProperty="id"
|
|
parameterType="com.glxp.api.entity.auth.WarehouseUserEntity" useGeneratedKeys="true">
|
|
<!--@mbg.generated-->
|
|
insert into auth_warehouse_user
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
id,
|
|
</if>
|
|
code,
|
|
userId,
|
|
userName,
|
|
isDirector,
|
|
</trim>
|
|
values
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
#{id,jdbcType=INTEGER},
|
|
</if>
|
|
#{code,jdbcType=VARCHAR},
|
|
#{userid,jdbcType=BIGINT},
|
|
#{username,jdbcType=VARCHAR},
|
|
#{isDirector}
|
|
</trim>
|
|
on duplicate key update
|
|
<trim suffixOverrides=",">
|
|
<if test="id != null">
|
|
id = #{id,jdbcType=INTEGER},
|
|
</if>
|
|
code = #{code,jdbcType=VARCHAR},
|
|
userId = #{userid,jdbcType=BIGINT},
|
|
userName = #{username,jdbcType=VARCHAR},
|
|
</trim>
|
|
</insert>
|
|
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id"
|
|
parameterType="com.glxp.api.entity.auth.WarehouseUserEntity" useGeneratedKeys="true">
|
|
<!--@mbg.generated-->
|
|
insert into auth_warehouse_user
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
id,
|
|
</if>
|
|
<if test="code != null">
|
|
code,
|
|
</if>
|
|
<if test="userid != null">
|
|
userId,
|
|
</if>
|
|
<if test="username != null">
|
|
userName,
|
|
</if>
|
|
</trim>
|
|
values
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
#{id,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="code != null">
|
|
#{code,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="userid != null">
|
|
#{userid,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="username != null">
|
|
#{username,jdbcType=VARCHAR},
|
|
</if>
|
|
</trim>
|
|
on duplicate key update
|
|
<trim suffixOverrides=",">
|
|
<if test="id != null">
|
|
id = #{id,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="code != null">
|
|
code = #{code,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="userid != null">
|
|
userId = #{userid,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="username != null">
|
|
userName = #{username,jdbcType=VARCHAR},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<select id="selectListByCode" resultMap="BaseResultMap">
|
|
select auth_warehouse_user.*, auth_user.employeeName
|
|
from auth_warehouse_user
|
|
inner join auth_user on auth_user.id = auth_warehouse_user.userId
|
|
where code = #{code}
|
|
</select>
|
|
|
|
<select id="selectListkey" resultType="com.glxp.api.entity.auth.WarehouseUserEntity"
|
|
parameterType="com.glxp.api.req.auth.FilterInvLinkDataRequest">
|
|
select auth_warehouse_user.*, auth_user.employeeName
|
|
from auth_warehouse_user
|
|
inner join auth_user on auth_user.id = auth_warehouse_user.userId
|
|
<where>
|
|
<if test="code != '' and code != null">
|
|
AND code = #{code}
|
|
</if>
|
|
<if test="userName != '' and userName != null">
|
|
AND auth_warehouse_user.userName = #{userName}
|
|
</if>
|
|
<if test="employeeName != '' and employeeName != null">
|
|
AND auth_user.employeeName = #{employeeName}
|
|
</if>
|
|
<if test="key != '' and key != null">
|
|
AND (auth_user.employeeName = #{key} or auth_warehouse_user.userName = #{key})
|
|
</if>
|
|
</where>
|
|
GROUP BY auth_warehouse_user.userId
|
|
</select>
|
|
|
|
|
|
<select id="filterList" parameterType="com.glxp.api.req.auth.FilterInvUserRequest"
|
|
resultType="com.glxp.api.entity.auth.WarehouseUserEntity">
|
|
SELECT *
|
|
FROM auth_warehouse_user
|
|
<where>
|
|
<if test="id != '' and id != null">
|
|
AND id = #{id}
|
|
</if>
|
|
<if test="code != '' and code != null">
|
|
AND code = #{code}
|
|
</if>
|
|
<if test="userid != null">
|
|
and userId = #{userid}
|
|
</if>
|
|
<if test="lastUpdateTime != null and lastUpdateTime != ''">
|
|
<![CDATA[
|
|
and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S')
|
|
]]>
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectCodeByUser" resultType="java.lang.String">
|
|
select code
|
|
from auth_warehouse_user
|
|
where userId = #{userId}
|
|
</select>
|
|
|
|
<select id="countByCode" resultType="java.lang.Integer">
|
|
select count(*)
|
|
from auth_warehouse_user
|
|
where code = #{code}
|
|
</select>
|
|
|
|
<delete id="deleteByCode">
|
|
delete
|
|
from auth_warehouse_user
|
|
where code = #{code}
|
|
</delete>
|
|
|
|
<update id="updateDirector">
|
|
update auth_warehouse_user
|
|
set isDirector = #{isDirector}
|
|
where code = #{code}
|
|
</update>
|
|
|
|
<update id="updateDirectorById">
|
|
update auth_warehouse_user
|
|
set isDirector = #{isDirector}
|
|
where id = #{id}
|
|
</update>
|
|
</mapper>
|