AttendanceMapper.xml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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="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. </resultMap>
  19. <!--根据条件分页查询-->
  20. <select id="pageByCondition" resultMap="BaseResultMap" parameterType="cn.com.ty.lift.enterprise.oa.dto.AttendanceRequest">
  21. SELECT
  22. att.*,
  23. ui.name AS username
  24. FROM attendance att
  25. LEFT JOIN user_info ui ON att.user_id = ui.user_id
  26. <where>
  27. <if test="cond.username != null and cond.username != ''">
  28. AND ui.name LIKE concat('%',#{cond.username},'%')
  29. </if>
  30. <if test="cond.mtCompanyId != null and cond.mtCompanyId > 0">
  31. AND att.mt_company_id = #{cond.mtCompanyId}
  32. </if>
  33. <if test="cond.begin != null">
  34. AND date(att.create_date) &gt;= #{cond.begin}
  35. </if>
  36. <if test="cond.end != null">
  37. AND date(att.create_date) &lt;= #{cond.end}
  38. </if>
  39. </where>
  40. </select>
  41. <select id="pageByUser" resultMap="BaseResultMap" parameterType="cn.com.ty.lift.enterprise.oa.dto.AttendanceRequest">
  42. SELECT
  43. att.*,
  44. ui.name AS username
  45. FROM attendance att
  46. LEFT JOIN user_info ui ON att.user_id = ui.user_id
  47. <where>
  48. <if test="cond.userId != null">
  49. AND ui.user_id LIKE #{cond.userId}
  50. </if>
  51. <if test="cond.begin != null">
  52. AND att.create_date &gt; #{cond.begin}
  53. </if>
  54. <if test="cond.end != null">
  55. AND att.create_date &lt; #{cond.end}
  56. </if>
  57. </where>
  58. </select>
  59. <select id="findByIdWithInfo" resultMap="BaseResultMap" parameterType="cn.com.ty.lift.enterprise.oa.dto.AttendanceRequest">
  60. SELECT
  61. att.*,
  62. ui.name AS username
  63. FROM attendance att
  64. LEFT JOIN user_info ui ON att.user_id = ui.user_id
  65. <where>
  66. <if test="cond.id != null and cond.id > 0">
  67. AND att.id LIKE #{cond.id}
  68. </if>
  69. </where>
  70. </select>
  71. </mapper>