123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- <?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.bz.smart_city.dao.UserAtendanceMapper">
- <!--auto generated Code-->
- <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.UserAtendance">
- <result column="id" property="id" jdbcType="INTEGER"/>
- <result column="attend_date" property="attendDate" jdbcType="INTEGER"/>
- <result column="plan_id" property="planId" jdbcType="INTEGER"/>
- <result column="user_id" property="userId" jdbcType="INTEGER"/>
- <result column="first_clock_time" property="firstClockTime" jdbcType="TIMESTAMP"/>
- <result column="last_clock_time" property="lastClockTime" jdbcType="TIMESTAMP"/>
- <result column="is_abnormal" property="isAbnormal" jdbcType="VARCHAR"/>
- <result column="description" property="description" jdbcType="VARCHAR"/>
- <result column="status" property="status" jdbcType="INTEGER"/>
- <result column="date_create" property="dateCreate" jdbcType="TIMESTAMP"/>
- <result column="" property="dateUpdate" jdbcType="TIMESTAMP"/>
- <result column="create_by" property="createBy" jdbcType="VARCHAR"/>
- <result column="update_by" property="updateBy" jdbcType="VARCHAR"/>
- </resultMap>
- <!--auto generated Code-->
- <sql id="Base_Column_List">
- id,
- attend_date,
- plan_id,
- user_id,
- first_clock_time,
- last_clock_time,
- is_abnormal,
- description,
- status,
- date_create,
- date_update,
- create_by,
- update_by
- </sql>
- <select id="queryList" resultType="com.bz.smart_city.entity.UserAtendance">
- SELECT
- ua.id as id,
- ua.attend_date AS attend_date,
- u.username AS user_name,
- u.`name` AS NAME,
- o.`name` AS org_name,
- p.plan_time AS plan_time,
- ua.first_clock_time AS first_clock_time,
- ua.last_clock_time AS last_clock_time,
- ua.work_time AS work_time,
- ua.is_abnormal AS is_abnormal ,
- ua.abnormal_type as abnormal_type
- FROM
- sc_user_atendance ua
- LEFT JOIN sc_attend_plan p ON ( ua.plan_id = p.id AND p.`status` = 1 )
- LEFT JOIN sc_user u ON ( ua.user_id = u.id )
- LEFT JOIN sc_organization o ON ( u.organ_id = o.id )
- WHERE 1 = 1
- <if test ="userAtendance.isAbnormal!=null and userAtendance.isAbnormal!= '' ">and ua.is_abnormal = #{userAtendance.isAbnormal,jdbcType=VARCHAR}</if>
- <if test ="userAtendance.abnormalType!=null">and ua.abnormal_type = #{userAtendance.abnormalType,jdbcType=INTEGER}</if>
- <if test ="userAtendance.startDate!=null">and ua.attend_date >= #{userAtendance.startDate,jdbcType=INTEGER}</if>
- <if test ="userAtendance.endDate!=null"><![CDATA[ and ua.attend_date <= #{userAtendance.endDate,jdbcType=INTEGER} ]]></if>
- <if test ="userAtendance.orgId!=null">and u.organ_id = #{userAtendance.orgId,jdbcType=INTEGER}</if>
- <if test ="userAtendance.userId!=null">and ua.user_id = #{userAtendance.userId,jdbcType=INTEGER}</if>
- <if test ="userAtendance.userName!=null and userAtendance.userName!='' ">and u.username like #{userAtendance.userName,jdbcType=VARCHAR}</if>
- <if test ="userAtendance.siteId!=null">and ua.site_id = #{userAtendance.siteId,jdbcType=INTEGER}</if>
- order by ua.attend_date desc
- </select>
- <!--auto generated Code-->
- <insert id="insert" useGeneratedKeys="true" keyProperty="userAtendance.id">
- INSERT INTO sc_user_atendance (
- id,
- attend_date,
- plan_id,
- user_id,
- first_clock_time,
- last_clock_time,
- is_abnormal,
- description,
- status,
- date_create,
- date_update,
- create_by,
- update_by
- ) VALUES (
- #{userAtendance.id,jdbcType=INTEGER},
- #{userAtendance.attendDate,jdbcType=INTEGER},
- #{userAtendance.planId,jdbcType=INTEGER},
- #{userAtendance.userId,jdbcType=INTEGER},
- #{userAtendance.firstClockTime,jdbcType=TIMESTAMP},
- #{userAtendance.lastClockTime,jdbcType=TIMESTAMP},
- #{userAtendance.isAbnormal,jdbcType=VARCHAR},
- #{userAtendance.description,jdbcType=VARCHAR},
- #{userAtendance.status,jdbcType=INTEGER},
- #{userAtendance.dateCreate,jdbcType=TIMESTAMP},
- #{userAtendance.dateUpdate,jdbcType=TIMESTAMP},
- #{userAtendance.createBy,jdbcType=VARCHAR},
- #{userAtendance.updateBy,jdbcType=VARCHAR}
- )
- </insert>
- <!--auto generated Code-->
- <insert id="insertSelective" useGeneratedKeys="true" keyProperty="userAtendance.id">
- INSERT INTO sc_user_atendance
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="userAtendance.id!=null"> id,</if>
- <if test="userAtendance.attendDate!=null"> attend_date,</if>
- <if test="userAtendance.planId!=null"> plan_id,</if>
- <if test="userAtendance.userId!=null"> user_id,</if>
- <if test="userAtendance.firstClockTime!=null"> first_clock_time,</if>
- <if test="userAtendance.lastClockTime!=null"> last_clock_time,</if>
- <if test="userAtendance.isAbnormal!=null"> is_abnormal,</if>
- <if test="userAtendance.description!=null"> description,</if>
- <if test="userAtendance.status!=null"> status,</if>
- <if test="userAtendance.dateCreate!=null"> date_create,</if>
- <if test="userAtendance.dateUpdate!=null"> date_update,</if>
- <if test="userAtendance.createBy!=null"> create_by,</if>
- <if test="userAtendance.updateBy!=null"> update_by,</if>
- </trim>
- VALUES
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="userAtendance.id!=null">#{userAtendance.id,jdbcType=INTEGER},
- </if>
- <if test="userAtendance.attendDate!=null">#{userAtendance.attendDate,jdbcType=INTEGER},
- </if>
- <if test="userAtendance.planId!=null">#{userAtendance.planId,jdbcType=INTEGER},
- </if>
- <if test="userAtendance.userId!=null">#{userAtendance.userId,jdbcType=INTEGER},
- </if>
- <if test="userAtendance.firstClockTime!=null">#{userAtendance.firstClockTime,jdbcType=TIMESTAMP},
- </if>
- <if test="userAtendance.lastClockTime!=null">#{userAtendance.lastClockTime,jdbcType=TIMESTAMP},
- </if>
- <if test="userAtendance.isAbnormal!=null">#{userAtendance.isAbnormal,jdbcType=VARCHAR},
- </if>
- <if test="userAtendance.description!=null">#{userAtendance.description,jdbcType=VARCHAR},
- </if>
- <if test="userAtendance.status!=null">#{userAtendance.status,jdbcType=INTEGER},
- </if>
- <if test="userAtendance.dateCreate!=null">#{userAtendance.dateCreate,jdbcType=TIMESTAMP},
- </if>
- <if test="userAtendance.dateUpdate!=null">#{userAtendance.dateUpdate,jdbcType=TIMESTAMP},
- </if>
- <if test="userAtendance.createBy!=null">#{userAtendance.createBy,jdbcType=VARCHAR},
- </if>
- <if test="userAtendance.updateBy!=null">#{userAtendance.updateBy,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <!--auto generated Code-->
- <insert id="insertList">
- INSERT INTO sc_user_atendance (
- id,
- site_id,
- attend_date,
- plan_id,
- user_id,
- org_id,
- first_clock_time,
- last_clock_time,
- is_abnormal,
- description,
- status,
- date_create,
- date_update,
- create_by,
- update_by
- )VALUES
- <foreach collection="userAtendances" item="userAtendance" index="index" separator=",">
- (
- #{userAtendance.id,jdbcType=INTEGER},
- #{userAtendance.siteId,jdbcType=INTEGER},
- #{userAtendance.attendDate,jdbcType=INTEGER},
- #{userAtendance.planId,jdbcType=INTEGER},
- #{userAtendance.userId,jdbcType=INTEGER},
- #{userAtendance.orgId,jdbcType=INTEGER},
- #{userAtendance.firstClockTime,jdbcType=TIMESTAMP},
- #{userAtendance.lastClockTime,jdbcType=TIMESTAMP},
- #{userAtendance.isAbnormal,jdbcType=VARCHAR},
- #{userAtendance.description,jdbcType=VARCHAR},
- #{userAtendance.status,jdbcType=INTEGER},
- #{userAtendance.dateCreate,jdbcType=TIMESTAMP},
- #{userAtendance.dateUpdate,jdbcType=TIMESTAMP},
- #{userAtendance.createBy,jdbcType=VARCHAR},
- #{userAtendance.updateBy,jdbcType=VARCHAR}
- )
- </foreach>
- </insert>
- <!--auto generated Code-->
- <update id="updateByPrimaryKeySelective">
- UPDATE sc_user_atendance
- <set>
- <if test="userAtendance.attendDate != null"> attend_date= #{userAtendance.attendDate,jdbcType=INTEGER},</if>
- <if test="userAtendance.planId != null"> plan_id= #{userAtendance.planId,jdbcType=INTEGER},</if>
- <if test="userAtendance.userId != null"> user_id= #{userAtendance.userId,jdbcType=INTEGER},</if>
- <if test="userAtendance.firstClockTime != null"> first_clock_time= #{userAtendance.firstClockTime,jdbcType=TIMESTAMP},</if>
- <if test="userAtendance.lastClockTime != null"> last_clock_time= #{userAtendance.lastClockTime,jdbcType=TIMESTAMP},</if>
- <if test="userAtendance.isAbnormal != null"> is_abnormal= #{userAtendance.isAbnormal,jdbcType=VARCHAR},</if>
- <if test="userAtendance.abnormalType != null"> abnormal_type= #{userAtendance.abnormalType,jdbcType=INTEGER},</if>
- <if test="userAtendance.workTime != null"> work_time= #{userAtendance.workTime,jdbcType=DOUBLE},</if>
- <if test="userAtendance.description != null"> description= #{userAtendance.description,jdbcType=VARCHAR},</if>
- <if test="userAtendance.status != null"> status= #{userAtendance.status,jdbcType=INTEGER},</if>
- <if test="userAtendance.dateCreate != null"> date_create= #{userAtendance.dateCreate,jdbcType=TIMESTAMP},</if>
- <if test="userAtendance.dateUpdate != null"> date_update= #{userAtendance.dateUpdate,jdbcType=TIMESTAMP},</if>
- <if test="userAtendance.createBy != null"> create_by= #{userAtendance.createBy,jdbcType=VARCHAR},</if>
- <if test="userAtendance.updateBy != null"> update_by= #{userAtendance.updateBy,jdbcType=VARCHAR}</if>
- </set>
- WHERE id = #{userAtendance.id,jdbcType=INTEGER}
- </update>
- </mapper>
|