UserAtendanceMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.bz.smart_city.dao.UserAtendanceMapper">
  4. <!--auto generated Code-->
  5. <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.UserAtendance">
  6. <result column="id" property="id" jdbcType="INTEGER"/>
  7. <result column="attend_date" property="attendDate" jdbcType="INTEGER"/>
  8. <result column="plan_id" property="planId" jdbcType="INTEGER"/>
  9. <result column="user_id" property="userId" jdbcType="INTEGER"/>
  10. <result column="first_clock_time" property="firstClockTime" jdbcType="TIMESTAMP"/>
  11. <result column="last_clock_time" property="lastClockTime" jdbcType="TIMESTAMP"/>
  12. <result column="is_abnormal" property="isAbnormal" jdbcType="VARCHAR"/>
  13. <result column="description" property="description" jdbcType="VARCHAR"/>
  14. <result column="status" property="status" jdbcType="INTEGER"/>
  15. <result column="date_create" property="dateCreate" jdbcType="TIMESTAMP"/>
  16. <result column="" property="dateUpdate" jdbcType="TIMESTAMP"/>
  17. <result column="create_by" property="createBy" jdbcType="VARCHAR"/>
  18. <result column="update_by" property="updateBy" jdbcType="VARCHAR"/>
  19. </resultMap>
  20. <!--auto generated Code-->
  21. <sql id="Base_Column_List">
  22. id,
  23. attend_date,
  24. plan_id,
  25. user_id,
  26. first_clock_time,
  27. last_clock_time,
  28. is_abnormal,
  29. description,
  30. status,
  31. date_create,
  32. date_update,
  33. create_by,
  34. update_by
  35. </sql>
  36. <select id="queryList" resultType="com.bz.smart_city.entity.UserAtendance">
  37. SELECT
  38. ua.id as id,
  39. ua.attend_date AS attend_date,
  40. u.username AS user_name,
  41. u.`name` AS NAME,
  42. o.`name` AS org_name,
  43. p.plan_time AS plan_time,
  44. ua.first_clock_time AS first_clock_time,
  45. ua.last_clock_time AS last_clock_time,
  46. ua.work_time AS work_time,
  47. ua.is_abnormal AS is_abnormal ,
  48. ua.abnormal_type as abnormal_type
  49. FROM
  50. sc_user_atendance ua
  51. LEFT JOIN sc_attend_plan p ON ( ua.plan_id = p.id AND p.`status` = 1 )
  52. LEFT JOIN sc_user u ON ( ua.user_id = u.id )
  53. LEFT JOIN sc_organization o ON ( u.organ_id = o.id )
  54. WHERE 1 = 1
  55. <if test ="userAtendance.isAbnormal!=null and userAtendance.isAbnormal!= '' ">and ua.is_abnormal = #{userAtendance.isAbnormal,jdbcType=VARCHAR}</if>
  56. <if test ="userAtendance.abnormalType!=null">and ua.abnormal_type = #{userAtendance.abnormalType,jdbcType=INTEGER}</if>
  57. <if test ="userAtendance.startDate!=null">and ua.attend_date >= #{userAtendance.startDate,jdbcType=INTEGER}</if>
  58. <if test ="userAtendance.endDate!=null"><![CDATA[ and ua.attend_date <= #{userAtendance.endDate,jdbcType=INTEGER} ]]></if>
  59. <if test ="userAtendance.orgId!=null">and u.organ_id = #{userAtendance.orgId,jdbcType=INTEGER}</if>
  60. <if test ="userAtendance.userId!=null">and ua.user_id = #{userAtendance.userId,jdbcType=INTEGER}</if>
  61. <if test ="userAtendance.userName!=null and userAtendance.userName!='' ">and u.username like #{userAtendance.userName,jdbcType=VARCHAR}</if>
  62. <if test ="userAtendance.siteId!=null">and ua.site_id = #{userAtendance.siteId,jdbcType=INTEGER}</if>
  63. order by ua.attend_date desc
  64. </select>
  65. <!--auto generated Code-->
  66. <insert id="insert" useGeneratedKeys="true" keyProperty="userAtendance.id">
  67. INSERT INTO sc_user_atendance (
  68. id,
  69. attend_date,
  70. plan_id,
  71. user_id,
  72. first_clock_time,
  73. last_clock_time,
  74. is_abnormal,
  75. description,
  76. status,
  77. date_create,
  78. date_update,
  79. create_by,
  80. update_by
  81. ) VALUES (
  82. #{userAtendance.id,jdbcType=INTEGER},
  83. #{userAtendance.attendDate,jdbcType=INTEGER},
  84. #{userAtendance.planId,jdbcType=INTEGER},
  85. #{userAtendance.userId,jdbcType=INTEGER},
  86. #{userAtendance.firstClockTime,jdbcType=TIMESTAMP},
  87. #{userAtendance.lastClockTime,jdbcType=TIMESTAMP},
  88. #{userAtendance.isAbnormal,jdbcType=VARCHAR},
  89. #{userAtendance.description,jdbcType=VARCHAR},
  90. #{userAtendance.status,jdbcType=INTEGER},
  91. #{userAtendance.dateCreate,jdbcType=TIMESTAMP},
  92. #{userAtendance.dateUpdate,jdbcType=TIMESTAMP},
  93. #{userAtendance.createBy,jdbcType=VARCHAR},
  94. #{userAtendance.updateBy,jdbcType=VARCHAR}
  95. )
  96. </insert>
  97. <!--auto generated Code-->
  98. <insert id="insertSelective" useGeneratedKeys="true" keyProperty="userAtendance.id">
  99. INSERT INTO sc_user_atendance
  100. <trim prefix="(" suffix=")" suffixOverrides=",">
  101. <if test="userAtendance.id!=null"> id,</if>
  102. <if test="userAtendance.attendDate!=null"> attend_date,</if>
  103. <if test="userAtendance.planId!=null"> plan_id,</if>
  104. <if test="userAtendance.userId!=null"> user_id,</if>
  105. <if test="userAtendance.firstClockTime!=null"> first_clock_time,</if>
  106. <if test="userAtendance.lastClockTime!=null"> last_clock_time,</if>
  107. <if test="userAtendance.isAbnormal!=null"> is_abnormal,</if>
  108. <if test="userAtendance.description!=null"> description,</if>
  109. <if test="userAtendance.status!=null"> status,</if>
  110. <if test="userAtendance.dateCreate!=null"> date_create,</if>
  111. <if test="userAtendance.dateUpdate!=null"> date_update,</if>
  112. <if test="userAtendance.createBy!=null"> create_by,</if>
  113. <if test="userAtendance.updateBy!=null"> update_by,</if>
  114. </trim>
  115. VALUES
  116. <trim prefix="(" suffix=")" suffixOverrides=",">
  117. <if test="userAtendance.id!=null">#{userAtendance.id,jdbcType=INTEGER},
  118. </if>
  119. <if test="userAtendance.attendDate!=null">#{userAtendance.attendDate,jdbcType=INTEGER},
  120. </if>
  121. <if test="userAtendance.planId!=null">#{userAtendance.planId,jdbcType=INTEGER},
  122. </if>
  123. <if test="userAtendance.userId!=null">#{userAtendance.userId,jdbcType=INTEGER},
  124. </if>
  125. <if test="userAtendance.firstClockTime!=null">#{userAtendance.firstClockTime,jdbcType=TIMESTAMP},
  126. </if>
  127. <if test="userAtendance.lastClockTime!=null">#{userAtendance.lastClockTime,jdbcType=TIMESTAMP},
  128. </if>
  129. <if test="userAtendance.isAbnormal!=null">#{userAtendance.isAbnormal,jdbcType=VARCHAR},
  130. </if>
  131. <if test="userAtendance.description!=null">#{userAtendance.description,jdbcType=VARCHAR},
  132. </if>
  133. <if test="userAtendance.status!=null">#{userAtendance.status,jdbcType=INTEGER},
  134. </if>
  135. <if test="userAtendance.dateCreate!=null">#{userAtendance.dateCreate,jdbcType=TIMESTAMP},
  136. </if>
  137. <if test="userAtendance.dateUpdate!=null">#{userAtendance.dateUpdate,jdbcType=TIMESTAMP},
  138. </if>
  139. <if test="userAtendance.createBy!=null">#{userAtendance.createBy,jdbcType=VARCHAR},
  140. </if>
  141. <if test="userAtendance.updateBy!=null">#{userAtendance.updateBy,jdbcType=VARCHAR},
  142. </if>
  143. </trim>
  144. </insert>
  145. <!--auto generated Code-->
  146. <insert id="insertList">
  147. INSERT INTO sc_user_atendance (
  148. id,
  149. site_id,
  150. attend_date,
  151. plan_id,
  152. user_id,
  153. org_id,
  154. first_clock_time,
  155. last_clock_time,
  156. is_abnormal,
  157. description,
  158. status,
  159. date_create,
  160. date_update,
  161. create_by,
  162. update_by
  163. )VALUES
  164. <foreach collection="userAtendances" item="userAtendance" index="index" separator=",">
  165. (
  166. #{userAtendance.id,jdbcType=INTEGER},
  167. #{userAtendance.siteId,jdbcType=INTEGER},
  168. #{userAtendance.attendDate,jdbcType=INTEGER},
  169. #{userAtendance.planId,jdbcType=INTEGER},
  170. #{userAtendance.userId,jdbcType=INTEGER},
  171. #{userAtendance.orgId,jdbcType=INTEGER},
  172. #{userAtendance.firstClockTime,jdbcType=TIMESTAMP},
  173. #{userAtendance.lastClockTime,jdbcType=TIMESTAMP},
  174. #{userAtendance.isAbnormal,jdbcType=VARCHAR},
  175. #{userAtendance.description,jdbcType=VARCHAR},
  176. #{userAtendance.status,jdbcType=INTEGER},
  177. #{userAtendance.dateCreate,jdbcType=TIMESTAMP},
  178. #{userAtendance.dateUpdate,jdbcType=TIMESTAMP},
  179. #{userAtendance.createBy,jdbcType=VARCHAR},
  180. #{userAtendance.updateBy,jdbcType=VARCHAR}
  181. )
  182. </foreach>
  183. </insert>
  184. <!--auto generated Code-->
  185. <update id="updateByPrimaryKeySelective">
  186. UPDATE sc_user_atendance
  187. <set>
  188. <if test="userAtendance.attendDate != null"> attend_date= #{userAtendance.attendDate,jdbcType=INTEGER},</if>
  189. <if test="userAtendance.planId != null"> plan_id= #{userAtendance.planId,jdbcType=INTEGER},</if>
  190. <if test="userAtendance.userId != null"> user_id= #{userAtendance.userId,jdbcType=INTEGER},</if>
  191. <if test="userAtendance.firstClockTime != null"> first_clock_time= #{userAtendance.firstClockTime,jdbcType=TIMESTAMP},</if>
  192. <if test="userAtendance.lastClockTime != null"> last_clock_time= #{userAtendance.lastClockTime,jdbcType=TIMESTAMP},</if>
  193. <if test="userAtendance.isAbnormal != null"> is_abnormal= #{userAtendance.isAbnormal,jdbcType=VARCHAR},</if>
  194. <if test="userAtendance.abnormalType != null"> abnormal_type= #{userAtendance.abnormalType,jdbcType=INTEGER},</if>
  195. <if test="userAtendance.workTime != null"> work_time= #{userAtendance.workTime,jdbcType=DOUBLE},</if>
  196. <if test="userAtendance.description != null"> description= #{userAtendance.description,jdbcType=VARCHAR},</if>
  197. <if test="userAtendance.status != null"> status= #{userAtendance.status,jdbcType=INTEGER},</if>
  198. <if test="userAtendance.dateCreate != null"> date_create= #{userAtendance.dateCreate,jdbcType=TIMESTAMP},</if>
  199. <if test="userAtendance.dateUpdate != null"> date_update= #{userAtendance.dateUpdate,jdbcType=TIMESTAMP},</if>
  200. <if test="userAtendance.createBy != null"> create_by= #{userAtendance.createBy,jdbcType=VARCHAR},</if>
  201. <if test="userAtendance.updateBy != null"> update_by= #{userAtendance.updateBy,jdbcType=VARCHAR}</if>
  202. </set>
  203. WHERE id = #{userAtendance.id,jdbcType=INTEGER}
  204. </update>
  205. </mapper>