|
@@ -0,0 +1,137 @@
|
|
|
+<?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.huashe.park.core.mapper.ParkAttendGroupUsrMapper">
|
|
|
+
|
|
|
+ <resultMap type="ParkAttendGroupUsr" id="ParkAttendGroupUsrResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="attendGroupId" column="attend_group_id"/>
|
|
|
+ <result property="usrId" column="usr_id"/>
|
|
|
+ <result property="usrName" column="usr_name"/>
|
|
|
+ <result property="usrDeptId" column="usr_dept_id"/>
|
|
|
+ <result property="usrDept" column="usr_dept"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="createBy" column="create_by"/>
|
|
|
+ <result property="updateBy" column="update_by"/>
|
|
|
+ <result property="tenantId" column="tenant_id"/>
|
|
|
+ <result property="groupName" column="group_name"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectParkAttendGroupUsrVo">
|
|
|
+ select rel.id,
|
|
|
+ rel.attend_group_id,
|
|
|
+ rel.usr_id,
|
|
|
+ rel.usr_name,
|
|
|
+ rel.usr_dept_id,
|
|
|
+ rel.usr_dept,
|
|
|
+ rel.update_time,
|
|
|
+ rel.create_time,
|
|
|
+ rel.create_by,
|
|
|
+ rel.update_by,
|
|
|
+ rel.tenant_id,
|
|
|
+ park_attend_group.name as group_name
|
|
|
+ from park_attend_group_usr rel
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectParkAttendGroupUsrList" parameterType="ParkAttendGroupUsr" resultMap="ParkAttendGroupUsrResult">
|
|
|
+ <include refid="selectParkAttendGroupUsrVo"/>
|
|
|
+ inner join park_attend_group on park_attend_group.id = rel.attend_group_id
|
|
|
+ <where>
|
|
|
+ <if test="usrName != null and usrName != ''">and usr_name like concat('%', #{usrName}, '%')</if>
|
|
|
+ <if test="usrDept != null and usrDept != ''">and usr_dept = #{usrDept}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectParkAttendGroupUsrById" parameterType="Long" resultMap="ParkAttendGroupUsrResult">
|
|
|
+ <include refid="selectParkAttendGroupUsrVo"/>
|
|
|
+ inner join park_attend_group on park_attend_group.id = rel.attend_group_id
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertParkAttendGroupUsr" parameterType="ParkAttendGroupUsr" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into park_attend_group_usr
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="attendGroupId != null">attend_group_id,</if>
|
|
|
+ <if test="usrId != null">usr_id,</if>
|
|
|
+ <if test="usrName != null">usr_name,</if>
|
|
|
+ <if test="usrDeptId != null">usr_dept_id,</if>
|
|
|
+ <if test="usrDept != null">usr_dept,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
+ <if test="tenantId != null">tenant_id,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="attendGroupId != null">#{attendGroupId},</if>
|
|
|
+ <if test="usrId != null">#{usrId},</if>
|
|
|
+ <if test="usrName != null">#{usrName},</if>
|
|
|
+ <if test="usrDeptId != null">#{usrDeptId},</if>
|
|
|
+ <if test="usrDept != null">#{usrDept},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="tenantId != null">#{tenantId},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="insertParkAttendGroupUsrBatch">
|
|
|
+ INSERT INTO park_attend_group_usr (attend_group_id,
|
|
|
+ usr_id,
|
|
|
+ usr_name,
|
|
|
+ usr_dept_id,
|
|
|
+ usr_dept,
|
|
|
+ update_time,
|
|
|
+ create_time)
|
|
|
+ VALUES
|
|
|
+ <foreach collection="userList" item="user" separator=",">
|
|
|
+ (
|
|
|
+ #{user.attendGroupId},
|
|
|
+ #{user.usrId},
|
|
|
+ #{user.usrName},
|
|
|
+ #{user.usrDeptId},
|
|
|
+ #{user.usrDept},
|
|
|
+ now(),
|
|
|
+ now()
|
|
|
+ )
|
|
|
+ </foreach>
|
|
|
+ on duplicate key update
|
|
|
+ usr_name = values(usr_name),
|
|
|
+ usr_dept = values(usr_dept),
|
|
|
+ update_time = now(),
|
|
|
+ create_time= now()
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateParkAttendGroupUsr" parameterType="ParkAttendGroupUsr">
|
|
|
+ update park_attend_group_usr
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="attendGroupId != null">attend_group_id = #{attendGroupId},</if>
|
|
|
+ <if test="usrId != null">usr_id = #{usrId},</if>
|
|
|
+ <if test="usrName != null">usr_name = #{usrName},</if>
|
|
|
+ <if test="usrDeptId != null">usr_dept_id = #{usrDeptId},</if>
|
|
|
+ <if test="usrDept != null">usr_dept = #{usrDept},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ <if test="tenantId != null">tenant_id = #{tenantId},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteParkAttendGroupUsrById" parameterType="Long">
|
|
|
+ delete
|
|
|
+ from park_attend_group_usr
|
|
|
+ where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteParkAttendGroupUsrByIds" parameterType="String">
|
|
|
+ delete from park_attend_group_usr where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|