|
|
@@ -0,0 +1,229 @@
|
|
|
+<?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.complaint.workorder.mapper.ComplaintStaffMapper">
|
|
|
+
|
|
|
+ <resultMap type="com.complaint.workorder.domain.ComplaintStaff" id="ComplaintStaffResult">
|
|
|
+ <id property="id" column="id" />
|
|
|
+ <result property="uNumber" column="u_number" />
|
|
|
+ <result property="idNumber" column="id_number" />
|
|
|
+ <result property="userUid" column="user_uid" />
|
|
|
+ <result property="userName" column="user_name" />
|
|
|
+ <result property="userAlias" column="user_alias" />
|
|
|
+ <result property="userSex" column="user_sex" />
|
|
|
+ <result property="mobile" column="mobile" />
|
|
|
+ <result property="email" column="email" />
|
|
|
+ <result property="unitUid" column="unit_uid" />
|
|
|
+ <result property="unitName" column="unit_name" />
|
|
|
+ <result property="idType" column="id_type" />
|
|
|
+ <result property="idTypeName" column="id_type_name" />
|
|
|
+ <result property="isActive" column="is_active" />
|
|
|
+ <result property="isActiveName" column="is_active_name" />
|
|
|
+ <result property="belongSchool" column="belong_school" />
|
|
|
+ <result property="belongClass" column="belong_class" />
|
|
|
+ <result property="beginTime" column="begin_time" />
|
|
|
+ <result property="endTime" column="end_time" />
|
|
|
+ <result property="dataUpdateTime" column="data_update_time" />
|
|
|
+ <result property="dataUpdateFlog" column="data_update_flog" />
|
|
|
+ <result property="syncTime" column="sync_time" />
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ <result property="remark" column="remark" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectComplaintStaffVo">
|
|
|
+ select id, u_number, id_number, user_uid, user_name, user_alias, user_sex, mobile, email,
|
|
|
+ unit_uid, unit_name, id_type, id_type_name, is_active, is_active_name,
|
|
|
+ belong_school, belong_class, begin_time, end_time, data_update_time, data_update_flog,
|
|
|
+ sync_time, create_by, create_time, update_by, update_time, remark
|
|
|
+ from complaint_staff
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectComplaintStaffList" parameterType="com.complaint.workorder.domain.ComplaintStaff" resultMap="ComplaintStaffResult">
|
|
|
+ <include refid="selectComplaintStaffVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
|
|
+ <if test="mobile != null and mobile != ''"> and mobile = #{mobile}</if>
|
|
|
+ <if test="unitUid != null and unitUid != ''"> and unit_uid = #{unitUid}</if>
|
|
|
+ <if test="unitName != null and unitName != ''"> and unit_name like concat('%', #{unitName}, '%')</if>
|
|
|
+ <if test="idNumber != null and idNumber != ''"> and id_number = #{idNumber}</if>
|
|
|
+ <if test="idTypeName != null and idTypeName != ''"> and id_type_name = #{idTypeName}</if>
|
|
|
+ <if test="isActive != null and isActive != ''"> and is_active = #{isActive}</if>
|
|
|
+ </where>
|
|
|
+ order by unit_name, id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectComplaintStaffById" parameterType="Long" resultMap="ComplaintStaffResult">
|
|
|
+ <include refid="selectComplaintStaffVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectComplaintStaffByMobile" parameterType="String" resultMap="ComplaintStaffResult">
|
|
|
+ <include refid="selectComplaintStaffVo"/>
|
|
|
+ where mobile = #{mobile}
|
|
|
+ fetch first 1 rows only
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="matchStaff" parameterType="com.complaint.workorder.domain.ComplaintStaff" resultMap="ComplaintStaffResult">
|
|
|
+ <include refid="selectComplaintStaffVo"/>
|
|
|
+ where user_name = #{userName}
|
|
|
+ and mobile = #{mobile}
|
|
|
+ and (unit_name = #{unitName} or belong_school = #{unitName})
|
|
|
+ fetch first 1 rows only
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectByUserUid" parameterType="String" resultMap="ComplaintStaffResult">
|
|
|
+ <include refid="selectComplaintStaffVo"/>
|
|
|
+ where user_uid = #{userUid}
|
|
|
+ fetch first 1 rows only
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertComplaintStaff" parameterType="com.complaint.workorder.domain.ComplaintStaff">
|
|
|
+ insert into complaint_staff
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="uNumber != null">u_number,</if>
|
|
|
+ <if test="idNumber != null">id_number,</if>
|
|
|
+ <if test="userUid != null">user_uid,</if>
|
|
|
+ <if test="userName != null">user_name,</if>
|
|
|
+ <if test="userAlias != null">user_alias,</if>
|
|
|
+ <if test="userSex != null">user_sex,</if>
|
|
|
+ <if test="mobile != null">mobile,</if>
|
|
|
+ <if test="email != null">email,</if>
|
|
|
+ <if test="unitUid != null">unit_uid,</if>
|
|
|
+ <if test="unitName != null">unit_name,</if>
|
|
|
+ <if test="idType != null">id_type,</if>
|
|
|
+ <if test="idTypeName != null">id_type_name,</if>
|
|
|
+ <if test="isActive != null">is_active,</if>
|
|
|
+ <if test="isActiveName != null">is_active_name,</if>
|
|
|
+ <if test="belongSchool != null">belong_school,</if>
|
|
|
+ <if test="belongClass != null">belong_class,</if>
|
|
|
+ <if test="beginTime != null">begin_time,</if>
|
|
|
+ <if test="endTime != null">end_time,</if>
|
|
|
+ <if test="dataUpdateTime != null">data_update_time,</if>
|
|
|
+ <if test="dataUpdateFlog != null">data_update_flog,</if>
|
|
|
+ <if test="syncTime != null">sync_time,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ create_time,
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="uNumber != null">#{uNumber},</if>
|
|
|
+ <if test="idNumber != null">#{idNumber},</if>
|
|
|
+ <if test="userUid != null">#{userUid},</if>
|
|
|
+ <if test="userName != null">#{userName},</if>
|
|
|
+ <if test="userAlias != null">#{userAlias},</if>
|
|
|
+ <if test="userSex != null">#{userSex},</if>
|
|
|
+ <if test="mobile != null">#{mobile},</if>
|
|
|
+ <if test="email != null">#{email},</if>
|
|
|
+ <if test="unitUid != null">#{unitUid},</if>
|
|
|
+ <if test="unitName != null">#{unitName},</if>
|
|
|
+ <if test="idType != null">#{idType},</if>
|
|
|
+ <if test="idTypeName != null">#{idTypeName},</if>
|
|
|
+ <if test="isActive != null">#{isActive},</if>
|
|
|
+ <if test="isActiveName != null">#{isActiveName},</if>
|
|
|
+ <if test="belongSchool != null">#{belongSchool},</if>
|
|
|
+ <if test="belongClass != null">#{belongClass},</if>
|
|
|
+ <if test="beginTime != null">#{beginTime},</if>
|
|
|
+ <if test="endTime != null">#{endTime},</if>
|
|
|
+ <if test="dataUpdateTime != null">#{dataUpdateTime},</if>
|
|
|
+ <if test="dataUpdateFlog != null">#{dataUpdateFlog},</if>
|
|
|
+ <if test="syncTime != null">#{syncTime},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ sysdate,
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 批量插入(大数据量同步用,每批500条) -->
|
|
|
+ <insert id="batchInsert" parameterType="java.util.List">
|
|
|
+ insert into complaint_staff (
|
|
|
+ u_number, id_number, user_uid, user_name, user_alias, user_sex, mobile, email,
|
|
|
+ unit_uid, unit_name, id_type, id_type_name, is_active, is_active_name,
|
|
|
+ belong_school, belong_class, begin_time, end_time, data_update_flog, sync_time, create_time
|
|
|
+ ) values
|
|
|
+ <foreach collection="list" item="item" separator=",">
|
|
|
+ (
|
|
|
+ #{item.uNumber}, #{item.idNumber}, #{item.userUid}, #{item.userName}, #{item.userAlias},
|
|
|
+ #{item.userSex}, #{item.mobile}, #{item.email}, #{item.unitUid}, #{item.unitName},
|
|
|
+ #{item.idType}, #{item.idTypeName}, #{item.isActive}, #{item.isActiveName},
|
|
|
+ #{item.belongSchool}, #{item.belongClass}, #{item.beginTime}, #{item.endTime},
|
|
|
+ #{item.dataUpdateFlog}, #{item.syncTime}, sysdate
|
|
|
+ )
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateComplaintStaff" parameterType="com.complaint.workorder.domain.ComplaintStaff">
|
|
|
+ update complaint_staff
|
|
|
+ <set>
|
|
|
+ <if test="uNumber != null">u_number = #{uNumber},</if>
|
|
|
+ <if test="idNumber != null">id_number = #{idNumber},</if>
|
|
|
+ <if test="userUid != null">user_uid = #{userUid},</if>
|
|
|
+ <if test="userName != null">user_name = #{userName},</if>
|
|
|
+ <if test="userAlias != null">user_alias = #{userAlias},</if>
|
|
|
+ <if test="userSex != null">user_sex = #{userSex},</if>
|
|
|
+ <if test="mobile != null">mobile = #{mobile},</if>
|
|
|
+ <if test="email != null">email = #{email},</if>
|
|
|
+ <if test="unitUid != null">unit_uid = #{unitUid},</if>
|
|
|
+ <if test="unitName != null">unit_name = #{unitName},</if>
|
|
|
+ <if test="idType != null">id_type = #{idType},</if>
|
|
|
+ <if test="idTypeName != null">id_type_name = #{idTypeName},</if>
|
|
|
+ <if test="isActive != null">is_active = #{isActive},</if>
|
|
|
+ <if test="isActiveName != null">is_active_name = #{isActiveName},</if>
|
|
|
+ <if test="belongSchool != null">belong_school = #{belongSchool},</if>
|
|
|
+ <if test="belongClass != null">belong_class = #{belongClass},</if>
|
|
|
+ <if test="beginTime != null">begin_time = #{beginTime},</if>
|
|
|
+ <if test="endTime != null">end_time = #{endTime},</if>
|
|
|
+ <if test="dataUpdateTime != null">data_update_time = #{dataUpdateTime},</if>
|
|
|
+ <if test="dataUpdateFlog != null">data_update_flog = #{dataUpdateFlog},</if>
|
|
|
+ <if test="syncTime != null">sync_time = #{syncTime},</if>
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ update_time = sysdate,
|
|
|
+ <if test="remark != null">remark = #{remark},</if>
|
|
|
+ </set>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="updateByUserUid" parameterType="com.complaint.workorder.domain.ComplaintStaff">
|
|
|
+ update complaint_staff
|
|
|
+ <set>
|
|
|
+ <if test="uNumber != null">u_number = #{uNumber},</if>
|
|
|
+ <if test="idNumber != null">id_number = #{idNumber},</if>
|
|
|
+ <if test="userName != null">user_name = #{userName},</if>
|
|
|
+ <if test="userAlias != null">user_alias = #{userAlias},</if>
|
|
|
+ <if test="userSex != null">user_sex = #{userSex},</if>
|
|
|
+ <if test="mobile != null">mobile = #{mobile},</if>
|
|
|
+ <if test="email != null">email = #{email},</if>
|
|
|
+ <if test="unitUid != null">unit_uid = #{unitUid},</if>
|
|
|
+ <if test="unitName != null">unit_name = #{unitName},</if>
|
|
|
+ <if test="idType != null">id_type = #{idType},</if>
|
|
|
+ <if test="idTypeName != null">id_type_name = #{idTypeName},</if>
|
|
|
+ <if test="isActive != null">is_active = #{isActive},</if>
|
|
|
+ <if test="isActiveName != null">is_active_name = #{isActiveName},</if>
|
|
|
+ <if test="belongSchool != null">belong_school = #{belongSchool},</if>
|
|
|
+ <if test="belongClass != null">belong_class = #{belongClass},</if>
|
|
|
+ <if test="beginTime != null">begin_time = #{beginTime},</if>
|
|
|
+ <if test="endTime != null">end_time = #{endTime},</if>
|
|
|
+ <if test="dataUpdateTime != null">data_update_time = #{dataUpdateTime},</if>
|
|
|
+ <if test="dataUpdateFlog != null">data_update_flog = #{dataUpdateFlog},</if>
|
|
|
+ sync_time = sysdate,
|
|
|
+ </set>
|
|
|
+ where user_uid = #{userUid}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteComplaintStaffById" parameterType="Long">
|
|
|
+ delete from complaint_staff where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteComplaintStaffByIds" parameterType="Long">
|
|
|
+ delete from complaint_staff where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <update id="truncateTable">
|
|
|
+ delete from complaint_staff
|
|
|
+ </update>
|
|
|
+
|
|
|
+</mapper>
|