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.

149 lines
5.4 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.op.wms.mapper.BaseTeamUserMapper">
<resultMap type="BaseTeamUser" id="BaseTeamUserResult">
<result property="id" column="id" />
<result property="teamId" column="team_id" />
<result property="teamCode" column="team_code" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectBaseTeamUserVo">
select id, team_id, team_code, user_id, user_name, create_by, create_time, update_by, update_time from base_team_user
</sql>
<select id="selectBaseTeamUserList" parameterType="BaseTeamUser" resultMap="BaseTeamUserResult">
<include refid="selectBaseTeamUserVo"/>
<where>
<if test="teamId != null and teamId != ''"> and team_id = #{teamId}</if>
<if test="teamCode != null and teamCode != ''"> and team_code = #{teamCode}</if>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
</where>
</select>
<select id="selectBaseTeamUserById" parameterType="String" resultMap="BaseTeamUserResult">
<include refid="selectBaseTeamUserVo"/>
where id = #{id}
</select>
<insert id="insertBaseTeamUser" parameterType="BaseTeamUser">
insert into base_team_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="teamId != null and teamId != ''">team_id,</if>
<if test="teamCode != null">team_code,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null">user_name,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="teamId != null and teamId != ''">#{teamId},</if>
<if test="teamCode != null">#{teamCode},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null">#{userName},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateBaseTeamUser" parameterType="BaseTeamUser">
update base_team_user
<trim prefix="SET" suffixOverrides=",">
<if test="teamId != null and teamId != ''">team_id = #{teamId},</if>
<if test="teamCode != null">team_code = #{teamCode},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBaseTeamUserById" parameterType="String">
delete from base_team_user where id = #{id}
</delete>
<delete id="deleteBaseTeamUserByTeamId" parameterType="String">
delete from base_team_user where team_id = #{teamId}
</delete>
<delete id="deleteBaseTeamUserByIds" parameterType="String">
delete from base_team_user where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectTeamMembers" parameterType="BaseTeamUser" resultMap="BaseTeamUserResult">
select
user_id,
user_name,
nick_name,
CONCAT(nick_name,user_name) AS teamUserName
from sys_user
</select>
<select id="selectTeamMembersNameById" parameterType="BaseTeamUser" resultType="java.lang.String">
select user_name
from sys_user su
where su.id = #{id}
</select>
<select id="selectTeamMembersIds" parameterType="BaseTeamUser" resultType="java.lang.String">
select user_id
from base_team_user
</select>
<select id="selectId" parameterType="BaseTeamUser" resultType="java.lang.String">
select id
from base_team_user
where user_id = #{userId}
and team_id = #{teamId}
</select>
<select id="selectUserName" parameterType="BaseTeamUser" resultType="java.lang.String">
select user_name
from sys_user
where user_id = #{userId}
</select>
<delete id="deleteBaseTeamUserByTeamIds" parameterType="String">
delete from base_team_user where team_id in
<foreach item="teamId" collection="array" open="(" separator="," close=")">
#{teamId}
</foreach>
</delete>
<select id="getPersonList" parameterType="BaseTeamUser" resultType="com.op.wms.domain.BaseTeamUser">
select
user_id AS userId,
user_name AS userName,
nick_name AS nickName,
CONCAT(nick_name,user_name) AS teamUserName,
phonenumber AS phonenumber
from sys_user
<where>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
and del_flag = '0'
</where>
</select>
</mapper>