| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- <?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.zd.alg.smartlock.mapper.SlOpendoorApplyMapper">
- <resultMap type="com.zd.algorithm.api.smartlock.entity.vo.SlOpendoorApplyVo" id="SlOpendoorApplyResult">
- <result property="id" column="id"/>
- <result property="userId" column="user_id"/>
- <result property="userName" column="user_name"/>
- <result property="deptId" column="dept_id"/>
- <result property="deptName" column="dept_name"/>
- <result property="userCode" column="user_code"/>
- <result property="userSex" column="user_sex"/>
- <result property="phonenumber" column="phonenumber"/>
- <result property="userId2" column="user_id2"/>
- <result property="userName2" column="user_name2"/>
- <result property="userCode2" column="user_code2"/>
- <result property="userSex2" column="user_sex2"/>
- <result property="phonenumber2" column="phonenumber2"/>
- <result property="subjectId" column="subject_id"/>
- <result property="subjectName" column="subject_name"/>
- <result property="safeUserId" column="safe_user_id"/>
- <result property="safeUserName" column="safe_user_name"/>
- <result property="safeUserPhone" column="safe_user_phone"/>
- <result property="position" column="position"/>
- <result property="college" column="college"/>
- <result property="applyStatus" column="apply_status"/>
- <result property="applyNumber" column="apply_number"/>
- <result property="illustrate" column="illustrate"/>
- <result property="approvalUser" column="approval_user"/>
- <result property="approvalTime" column="approval_time"/>
- <result property="creatTime" column="creat_time"/>
- </resultMap>
- <sql id="selectSlOpendoorApplyVo">
- select id,
- user_id,
- user_name,
- dept_id,
- dept_name,
- user_code,
- user_sex,
- phonenumber,
- user_id2,
- user_name2,
- user_code2,
- user_sex2,
- phonenumber2,
- subject_id,
- subject_name,
- safe_user_id,
- safe_user_name,
- safe_user_phone,
- position,
- college,
- apply_status,
- apply_number,
- illustrate,
- approval_user,
- approval_time,
- creat_time
- from sl_opendoor_apply t
- </sql>
- <sql id="selectSlOpendoorApplyListVo">
- select t.id,
- t.user_id,
- t.user_name,
- t.dept_id,
- t.dept_name,
- t.user_code,
- t.user_sex,
- t.phonenumber,
- t.user_id2,
- t.user_name2,
- t.user_code2,
- t.user_sex2,
- t.phonenumber,
- t.subject_id,
- t.subject_name,
- t.safe_user_id,
- t.safe_user_name,
- t.safe_user_phone,
- t.position,
- t.college,
- t.apply_status,
- t.apply_number,
- t.illustrate,
- t.approval_user,
- t.approval_time,
- t.creat_time,
- (select GROUP_CONCAT(safe_user_name) from sl_subject_relation r where r.subject_id= t.subject_id ) authName,
- date_add(t.creat_time, interval 1 hour) loseTime
- from sl_opendoor_apply as t
- LEFT JOIN sys_dept d on t.dept_id=d.dept_id
- LEFT JOIN sys_user u on t.user_id=u.user_id
- </sql>
- <select id="selectSlOpendoorApplyList" parameterType="com.zd.algorithm.api.smartlock.entity.vo.SlOpendoorApplyVo"
- resultMap="SlOpendoorApplyResult">
- <include refid="selectSlOpendoorApplyListVo"/>
- <where>
- <if test="userId != null ">and t.user_id = #{userId}</if>
- <if test="userName != null and userName != ''">and user_name like concat('%', #{userName}, '%')</if>
- <if test="deptId != null ">and t.dept_id = #{deptId}</if>
- <if test="deptName != null ">and t.dept_name = #{deptName}</if>
- <if test="userCode != null ">and t.user_code = #{userCode}</if>
- <if test="userSex != null ">and t.user_sex = #{userSex}</if>
- <if test="phonenumber != null ">and t.phonenumber = #{phonenumber}</if>
- <if test="userId2 != null ">and t.user_id2 = #{userId2}</if>
- <if test="userName2 != null and userName2 != ''">and t.user_name2 = #{userName2}</if>
- <if test="userCode2 != null ">and t.user_code2 = #{userCode2}</if>
- <if test="userSex2 != null ">and t.user_sex2 = #{userSex2}</if>
- <if test="phonenumber2 != null ">and t.phonenumber2 = #{phonenumber2}</if>
- <if test="subjectId != null ">and t.subject_id = #{subjectId}</if>
- <if test="subjectName != null and subjectName != ''">and t.subject_name like concat('%', #{subjectName},
- '%')
- </if>
- <if test="safeUserId != null and position != ''">and t.safe_user_id = #{safeUserId}</if>
- <if test="safeUserName != null and position != ''">and t.safe_user_name = #{safeUserName}</if>
- <if test="position != null and position != ''">and t.position = #{position}</if>
- <if test="college != null and college != ''">and t.college = #{college}</if>
- <if test="applyStatus != null ">
- <if test="applyStatus == 1 ">and t.creat_time > now() </if>
- <if test="applyStatus == 2 ">and t.creat_time < now() </if>
- </if>
- <if test="applyNumber != null ">and t.apply_number = #{applyNumber}</if>
- <if test="illustrate != null ">and t.illustrate = #{illustrate}</if>
- <if test="approvalUser != null ">and t.approval_user = #{approvalUser}</if>
- <if test="approvalTime != null ">and t.approval_time = #{approvalTime}</if>
- <if test="creatTime != null ">and t.creat_time = #{creatTime}</if>
- <if test="searchValue != null and searchValue != ''">
- and
- (t.user_name like concat('%', #{searchValue}, '%') or
- t.user_name2 like concat('%', #{searchValue}, '%') or
- t.subject_name like concat('%', #{searchValue}, '%')
- )
- </if>
- <if test="startTime != null "> and date_format(t.creat_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null "> and date_format(t.creat_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')</if>
- </where>
- <!-- 数据范围过滤 -->
- ${params.dataScope}
- </select>
- <select id="getListByIds" resultMap="SlOpendoorApplyResult">
- <include refid="selectSlOpendoorApplyVo"/>
- <where>
- id in
- <foreach item="id" collection="list" open="(" separator="," close=")">
- #{id}
- </foreach>
- </where>
- </select>
- <select id="selectSlOpendoorApplyById" resultMap="SlOpendoorApplyResult">
- <include refid="selectSlOpendoorApplyVo"/>
- where id = #{id}
- </select>
- <insert id="insertSlOpendoorApply" parameterType="com.zd.algorithm.api.smartlock.entity.SlOpendoorApply" useGeneratedKeys="true"
- keyProperty="id">
- insert into sl_opendoor_apply
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="userId != null">user_id,</if>
- <if test="userName != null">user_name,</if>
- <if test="deptId != null">dept_id,</if>
- <if test="deptName != null">dept_name,</if>
- <if test="userCode != null">user_code,</if>
- <if test="userSex != null">user_sex,</if>
- <if test="phonenumber != null">phonenumber,</if>
- <if test="userId2 != null">user_id2,</if>
- <if test="userName2 != null">user_name2,</if>
- <if test="userCode2 != null">user_code2,</if>
- <if test="userSex2 != null">user_sex2,</if>
- <if test="phonenumber2 != null">phonenumber2,</if>
- <if test="subjectId != null">subject_id,</if>
- <if test="subjectName != null">subject_name,</if>
- <if test="safeUserId != null">safe_user_id,</if>
- <if test="safeUserName != null">safe_user_name,</if>
- <if test="safeUserPhone != null">safe_user_phone,</if>
- <if test="position != null">position,</if>
- <if test="college != null">college,</if>
- <if test="applyStatus != null">apply_status,</if>
- <if test="applyNumber != null">apply_number,</if>
- <if test="illustrate != null">illustrate,</if>
- <if test="approvalUser != null">approval_user,</if>
- <if test="approvalTime != null">approval_time,</if>
- <if test="creatTime != null">creat_time,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="userId != null">#{userId},</if>
- <if test="userName != null">#{userName},</if>
- <if test="deptId != null">#{deptId},</if>
- <if test="deptName != null">#{deptName},</if>
- <if test="userCode != null">#{userCode},</if>
- <if test="userSex != null">#{userSex},</if>
- <if test="phonenumber != null">#{phonenumber},</if>
- <if test="userId2 != null">#{userId2},</if>
- <if test="userName2 != null">#{userName2},</if>
- <if test="userCode2 != null">#{userCode2},</if>
- <if test="userSex2 != null">#{userSex2},</if>
- <if test="phonenumber2 != null">#{phonenumber2},</if>
- <if test="subjectId != null">#{subjectId},</if>
- <if test="subjectName != null">#{subjectName},</if>
- <if test="safeUserId != null">#{safeUserId},</if>
- <if test="safeUserName != null">#{safeUserName},</if>
- <if test="safeUserPhone != null">#{safeUserPhone},</if>
- <if test="position != null">#{position},</if>
- <if test="college != null">#{college},</if>
- <if test="applyStatus != null">#{applyStatus},</if>
- <if test="applyNumber != null">#{applyNumber},</if>
- <if test="illustrate != null">#{illustrate},</if>
- <if test="approvalUser != null">#{approval_user},</if>
- <if test="approvalTime != null">#{approval_time},</if>
- <if test="creatTime != null">#{creatTime},</if>
- </trim>
- </insert>
- <update id="updateSlOpendoorApply" parameterType="com.zd.algorithm.api.smartlock.entity.SlOpendoorApply">
- update sl_opendoor_apply
- <trim prefix="SET" suffixOverrides=",">
- <if test="userId != null">user_id = #{userId},</if>
- <if test="userName != null">user_name = #{userName},</if>
- <if test="deptId != null">dept_id = #{deptId},</if>
- <if test="deptName != null">dept_name = #{deptName},</if>
- <if test="userCode != null">user_code = #{userCode},</if>
- <if test="userSex != null">user_sex = #{userSex},</if>
- <if test="phonenumber != null">phonenumber = #{phonenumber},</if>
- <if test="userId2 != null">user_id2 = #{userId2},</if>
- <if test="userName2 != null">user_name2 = #{userName2},</if>
- <if test="userCode2 != null">user_code2 = #{userCode2},</if>
- <if test="userSex2 != null">user_sex2 = #{userSex2},</if>
- <if test="phonenumber2 != null">phonenumber2 = #{phonenumber2},</if>
- <if test="subjectId != null">subject_id = #{subjectId},</if>
- <if test="subjectName != null">subject_name = #{subjectName},</if>
- <if test="safeUserId != null">safe_user_id = #{safeUserId},</if>
- <if test="safeUserName != null">safe_user_name = #{safeUserName},</if>
- <if test="safeUserPhone != null">safe_user_phone = #{safeUserPhone},</if>
- <if test="position != null">position = #{position},</if>
- <if test="college != null">college = #{college},</if>
- <if test="applyStatus != null">apply_status = #{applyStatus},</if>
- <if test="applyNumber != null">apply_number = #{applyNumber},</if>
- <if test="illustrate != null">illustrate = #{illustrate},</if>
- <if test="approvalUser != null">approval_user = #{approvalUser},</if>
- <if test="approvalTime != null">approval_time = #{approvalTime},</if>
- <if test="creatTime != null">creat_time = #{creatTime},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteSlOpendoorApplyById">
- delete
- from sl_opendoor_apply
- where id = #{id}
- </delete>
- <delete id="deleteSlOpendoorApplyByIds">
- delete from sl_opendoor_apply where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|