123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- <?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.ruoyi.system.mapper.ClockRecordMapper">
- <resultMap type="ClockRecord" id="ClockRecordResult">
- <result property="clockId" column="clock_id" />
- <result property="userId" column="user_id" />
- <result property="deptName" column="dept_name" />
- <result property="userName" column="user_name" />
- <result property="phonenumber" column="phonenumber" />
- <result property="idCard" column="id_card" />
- <result property="recordDt" column="record_dt" />
- <result property="recordDate" column="record_date" />
- <result property="recordTime" column="record_time" />
- <result property="recordLocations" column="record_locations" />
- <result property="week" column="week" />
- <result property="isOutwork" column="is_outwork" />
- <result property="pictureUrl" column="picture_url" />
- <result property="type" column="type" />
- <result property="source" column="source" />
- <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="selectClockRecordVo">
- select clock_id, user_id, dept_name, user_name, phonenumber, id_card,record_dt,record_date, record_time,record_locations,week, is_outwork,picture_url,type,source, create_by, create_time, update_by, update_time, remark from clock_record
- </sql>
- <select id="selectClockRecordList" parameterType="ClockRecord" resultMap="ClockRecordResult">
- <include refid="selectClockRecordVo"/>
- <where>
- <if test="userId != null "> and user_id = #{userId}</if>
- <if test="deptName != null "> and dept_name like concat('%', #{deptName}, '%')</if>
- <if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
- <if test="phonenumber != null and phonenumber != ''"> and phonenumber = #{phonenumber}</if>
- <if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
- <if test="recordDate != null and recordDate != ''"> and record_date = #{recordDate}</if>
- <if test="week != null and week != ''"> and week = #{week}</if>
- <if test="isOutwork != null and isOutwork != ''"> and is_outwork = #{isOutwork}</if>
- <if test="type != null and type != ''"> and type = #{type}</if>
- <if test="source != null and source != ''"> and source = #{source}</if>
- <if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
- AND record_date >= #{startTime}
- </if>
- <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
- AND record_date <= #{endTime}
- </if>
- </where>
- </select>
-
- <select id="selectClockRecordByClockId" parameterType="Long" resultMap="ClockRecordResult">
- <include refid="selectClockRecordVo"/>
- where clock_id = #{clockId}
- </select>
- <select id="selectOrderFoodListRl" parameterType="ClockRecord" resultMap="ClockRecordResult">
- <include refid="selectClockRecordVo"/>
- <where>
- <if test="userId != null "> and user_id = #{userId}</if>
- <if test="deptName != null "> and dept_name like concat('%', #{deptName}, '%')</if>
- <if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
- <if test="phonenumber != null and phonenumber != ''"> and phonenumber = #{phonenumber}</if>
- <if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
- <if test="recordDate != null and recordDate != ''">
- and date_format(record_date,'%Y%m') = date_format(#{recordDate},'%Y%m')
- </if>
- <if test="isOutwork != null and isOutwork != ''"> and is_outwork = #{isOutwork}</if>
- <if test="type != null and type != ''"> and type = #{type}</if>
- <if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
- AND record_date >= #{startTime}
- </if>
- <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
- AND record_date <= #{endTime}
- </if>
- </where>
- </select>
- <select id="selectClockRecordNew" parameterType="ClockRecord" resultMap="ClockRecordResult">
- <include refid="selectClockRecordVo"/>
- where user_id = #{userId}
- order by record_time desc limit 1
- </select>
- <insert id="insertClockRecord" parameterType="ClockRecord" useGeneratedKeys="true" keyProperty="clockId">
- insert into clock_record
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="userId != null">user_id,</if>
- <if test="deptName != null">dept_name,</if>
- <if test="userName != null and userName != ''">user_name,</if>
- <if test="phonenumber != null">phonenumber,</if>
- <if test="idCard != null">id_card,</if>
- <if test="recordDt != null">record_dt,</if>
- <if test="recordDate != null">record_date,</if>
- <if test="recordTime != null">record_time,</if>
- <if test="recordLocations != null">record_locations,</if>
- <if test="week != null">week,</if>
- <if test="isOutwork != null and isOutwork != ''"> is_outwork,</if>
- <if test="pictureUrl != null and pictureUrl != ''"> picture_url,</if>
- <if test="type != null and type != ''">type,</if>
- <if test="source != null and source != ''"> source ,</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>
- <if test="remark != null">remark,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="userId != null">#{userId},</if>
- <if test="deptName != null">#{deptName},</if>
- <if test="userName != null and userName != ''">#{userName},</if>
- <if test="phonenumber != null">#{phonenumber},</if>
- <if test="idCard != null">#{idCard},</if>
- <if test="recordDt != null">#{recordDt},</if>
- <if test="recordDate != null">#{recordDate},</if>
- <if test="recordTime != null">#{recordTime},</if>
- <if test="recordLocations != null"> #{recordLocations},</if>
- <if test="week != null">#{week},</if>
- <if test="isOutwork != null and isOutwork != ''">#{isOutwork},</if>
- <if test="pictureUrl != null and pictureUrl != ''"> #{pictureUrl},</if>
- <if test="type != null and type != ''">#{type},</if>
- <if test="source != null and source != ''"> #{source},</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>
- <if test="remark != null">#{remark},</if>
- </trim>
- </insert>
- <update id="updateClockRecord" parameterType="ClockRecord">
- update clock_record
- <trim prefix="SET" suffixOverrides=",">
- <if test="userId != null">user_id = #{userId},</if>
- <if test="deptName != null">dept_name = #{deptName},</if>
- <if test="userName != null and userName != ''">user_name = #{userName},</if>
- <if test="phonenumber != null">phonenumber = #{phonenumber},</if>
- <if test="idCard != null">id_card = #{idCard},</if>
- <if test="recordDt != null">record_dt= #{recordDt},</if>
- <if test="recordDate != null">record_date = #{recordDate},</if>
- <if test="recordTime != null">record_time = #{recordTime},</if>
- <if test="recordLocations != null">record_locations = #{recordLocations},</if>
- <if test="week != null "> and week = #{week},</if>
- <if test="isOutwork != null and isOutwork != ''"> is_outwork = #{isOutwork},</if>
- <if test="pictureUrl != null and pictureUrl != ''"> picture_url=#{pictureUrl},</if>
- <if test="type != null and type != ''">type = #{type},</if>
- <if test="source != null and source != ''"> source = #{source},</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>
- <if test="remark != null">remark = #{remark},</if>
- </trim>
- where clock_id = #{clockId}
- </update>
- <delete id="deleteClockRecordByClockId" parameterType="Long">
- delete from clock_record where clock_id = #{clockId}
- </delete>
- <delete id="deleteClockRecordByClockIds" parameterType="String">
- delete from clock_record where clock_id in
- <foreach item="clockId" collection="array" open="(" separator="," close=")">
- #{clockId}
- </foreach>
- </delete>
- </mapper>
|