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.
udi-spms-java/src/main/resources/mybatis/mapper/auth/WarehouseUserDao.xml

134 lines
4.8 KiB
XML

2 years ago
<?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">
2 years ago
<resultMap id="BaseResultMap" autoMapping="true" type="com.glxp.api.entity.auth.WarehouseUserEntity">
2 years ago
<!--@mbg.generated-->
<!--@Table auth_warehouse_user-->
2 years ago
<!-- <id column="id" jdbcType="INTEGER" property="id"/>-->
2 years ago
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="userId" jdbcType="BIGINT" property="userid"/>
<result column="userName" jdbcType="VARCHAR" property="username"/>
2 years ago
<!-- <result column="isDirector" javaType="boolean" property="isDirector"/>-->
2 years ago
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id,
code,
userId,
userName,
isDirector,
locSubInvCode
</sql>
<delete id="deleteByCodeAndId">
<!--@mbg.generated-->
delete
from auth_warehouse_user
where userid = #{id}
and code = #{code}
</delete>
<insert id="insertEntity" keyColumn="id" keyProperty="id"
2 years ago
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="insertOrUpdateEntity" keyColumn="id" keyProperty="id"
2 years ago
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},
2 years ago
</trim>
</insert>
<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
2 years ago
<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
2 years ago
</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>
</mapper>