AttendanceMapper.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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="cn.com.ty.lift.enterprise.oa.mapper.AttendanceMapper" >
  4. <resultMap id="BaseResultMap" type="cn.com.ty.lift.enterprise.oa.dto.AttendanceResponse" >
  5. <id column="id" property="id" jdbcType="BIGINT" />
  6. <result column="mt_company_id" property="mtCompanyId" jdbcType="BIGINT" />
  7. <result column="user_id" property="userId" jdbcType="BIGINT" />
  8. <result column="coordinate" property="coordinate" jdbcType="VARCHAR" />
  9. <result column="remarks" property="remarks" jdbcType="VARCHAR" />
  10. <result column="address" property="address" jdbcType="VARCHAR" />
  11. <result column="creator_id" property="creatorId" jdbcType="BIGINT" />
  12. <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
  13. <result column="update_id" property="updateId" jdbcType="BIGINT" />
  14. <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
  15. <result column="status" property="status" jdbcType="INTEGER" />
  16. <result column="type" property="type" jdbcType="INTEGER" />
  17. <result column="username" property="username" jdbcType="VARCHAR" />
  18. <result column="top_time" property="topTime" jdbcType="TIMESTAMP" />
  19. <result column="down_time" property="updateDate" jdbcType="TIMESTAMP" />
  20. <result column="top_time_pm" property="updateDate" jdbcType="TIMESTAMP" />
  21. <result column="down_time_pm" property="updateDate" jdbcType="TIMESTAMP" />
  22. <result column="top_time_ot" property="updateDate" jdbcType="TIMESTAMP" />
  23. <result column="down_time_ot" property="updateDate" jdbcType="TIMESTAMP" />
  24. </resultMap>
  25. <!--根据条件分页查询-->
  26. <select id="pageByCondition" resultMap="BaseResultMap" parameterType="cn.com.ty.lift.enterprise.oa.dto.AttendanceRequest">
  27. SELECT
  28. att.*,
  29. mt.top_time,
  30. mt.down_time,
  31. mt.top_time_pm,
  32. mt.down_time_pm,
  33. mt.top_time_ot,
  34. mt.down_time_ot,
  35. ui.name AS username
  36. FROM attendance att
  37. LEFT JOIN user_info ui ON att.user_id = ui.user_id
  38. LEFT JOIN maintenance_company mt ON att.mt_company_id = mt.id
  39. <where>
  40. <if test="cond.username != null and cond.username != ''">
  41. AND ui.name LIKE concat('%',#{cond.username},'%')
  42. </if>
  43. <if test="cond.mtCompanyId != null and cond.mtCompanyId > 0">
  44. AND att.mt_company_id = #{cond.mtCompanyId}
  45. </if>
  46. <if test="cond.clockTime != null">
  47. AND date(att.create_date) = #{cond.clockTime}
  48. </if>
  49. <if test="cond.begin != null">
  50. AND date(att.create_date) &gt;= #{cond.begin}
  51. </if>
  52. <if test="cond.end != null">
  53. AND date(att.create_date) &lt;= #{cond.end}
  54. </if>
  55. </where>
  56. </select>
  57. <select id="listByIdList" resultMap="BaseResultMap" parameterType="cn.com.ty.lift.enterprise.oa.dto.AttendanceRequest">
  58. SELECT
  59. att.*,
  60. mt.top_time,
  61. mt.down_time,
  62. mt.top_time_pm,
  63. mt.down_time_pm,
  64. mt.top_time_ot,
  65. mt.down_time_ot,
  66. ui.name AS username
  67. FROM attendance att
  68. LEFT JOIN user_info ui ON att.user_id = ui.user_id
  69. LEFT JOIN maintenance_company mt ON att.mt_company_id = mt.id
  70. <where>
  71. <if test="cond.ids != null and cond.ids.size > 0">
  72. AND att.id IN
  73. <foreach collection="cond.ids" item="id" open="(" separator="," close=")">
  74. #{id}
  75. </foreach>
  76. </if>
  77. </where>
  78. </select>
  79. <select id="pageByUser" resultMap="BaseResultMap" parameterType="cn.com.ty.lift.enterprise.oa.dto.AttendanceRequest">
  80. SELECT
  81. att.*,
  82. ui.name AS username
  83. FROM attendance att
  84. LEFT JOIN user_info ui ON att.user_id = ui.user_id
  85. <where>
  86. <if test="cond.mtCompanyId != null and cond.mtCompanyId > 0">
  87. AND att.mt_company_id = #{cond.mtCompanyId}
  88. </if>
  89. <if test="cond.userId != null">
  90. AND ui.user_id LIKE #{cond.userId}
  91. </if>
  92. <if test="cond.clockTime != null">
  93. AND date(att.create_date) = #{cond.clockTime}
  94. </if>
  95. <if test="cond.begin != null">
  96. AND att.create_date &gt; #{cond.begin}
  97. </if>
  98. <if test="cond.end != null">
  99. AND att.create_date &lt; #{cond.end}
  100. </if>
  101. </where>
  102. </select>
  103. <select id="infoById" resultMap="BaseResultMap" parameterType="cn.com.ty.lift.enterprise.oa.dto.AttendanceRequest">
  104. SELECT
  105. att.*,
  106. ui.name AS username
  107. FROM attendance att
  108. LEFT JOIN user_info ui ON att.user_id = ui.user_id
  109. <where>
  110. <if test="cond.id != null and cond.id > 0">
  111. AND att.id LIKE #{cond.id}
  112. </if>
  113. </where>
  114. </select>
  115. </mapper>