BizHousingFundConfirmDetailMapper.xml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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.ezhizao.project.business.housingFund.mapper.BizHousingFundConfirmDetailMapper">
  4. <!-- 基础的返回map 多表复杂的 自行组合 -->
  5. <resultMap id="BaseResultMap" type="cn.ezhizao.project.business.housingFund.domain.BizHousingFundConfirmDetail">
  6. <id column="id" jdbcType="BIGINT" property="id"/>
  7. <collection property="details" select="getEmployees" column="id" />
  8. </resultMap>
  9. <resultMap id="EmployeeResult" type="cn.ezhizao.project.business.housingFund.domain.BizHousingFundConfirmDetailEmployee">
  10. <id column="id" jdbcType="INTEGER" property="id"/>
  11. </resultMap>
  12. <select id="getEmployees" resultMap="EmployeeResult">
  13. select *
  14. from biz_housing_fund_confirm_detail_employee
  15. where housing_fund_confirm_detail_id = #{id}
  16. </select>
  17. <!--带条件的List查询-->
  18. <select id="getList" resultMap="BaseResultMap">
  19. <include refid="getListSql"/>
  20. </select>
  21. <!--带条件的List查询 数据总条数-->
  22. <select id="getTotal" resultType="java.lang.Integer">
  23. SELECT COUNT(1) FROM (<include refid="getListSql"/>) AS C
  24. </select>
  25. <sql id="getListSql">
  26. SELECT t1.*, t2.name as company_name, t2.is_first_housing_fund
  27. , t2.is_pay_on_window, t2.housing_fund_password
  28. , t2.housing_fund_unit_account, t2.housing_fund_deduction_password
  29. FROM biz_housing_fund_confirm_detail t1 left join biz_company t2 on t2.id = t1.company_id
  30. <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
  31. t1.deleted = 0 AND
  32. <if test="id != null ">
  33. t1.id = #{id} AND
  34. </if>
  35. <if test="housingFundConfirmId != null ">
  36. t1.housing_fund_confirm_id = #{housingFundConfirmId} AND
  37. </if>
  38. <if test="companyId != null ">
  39. t1.company_id = #{companyId} AND
  40. </if>
  41. <if test="year != null and year != '' ">
  42. t1.year = #{year} AND
  43. </if>
  44. <if test="month != null and month != '' ">
  45. t1.month = #{month} AND
  46. </if>
  47. <if test="status != null ">
  48. t1.status = #{status} AND
  49. </if>
  50. <if test="content != null and content != '' ">
  51. t1.content = #{content} AND
  52. </if>
  53. <if test="verifyContent != null and verifyContent != '' ">
  54. t1.verify_content = #{verifyContent} AND
  55. </if>
  56. <if test="startMonth != null and endMonth != null">
  57. STR_TO_DATE(concat(t1.year, '-', t1.month, '-01'), '%Y-%m-%d') between #{startMonth} and #{endMonth} AND
  58. </if>
  59. </trim>
  60. </sql>
  61. </mapper>