InsPlySettleMapper.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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.ydtech.modules.fnc.dao.InsPlySettleMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.ydtech.modules.fnc.entity.InsPlySettle">
  6. <id column="settleno" property="settleno" />
  7. <result column="company_id" property="companyId" />
  8. <result column="company_name" property="companyName" />
  9. <result column="settle_month" property="settleMonth" />
  10. <result column="settle_batch" property="settleBatch" />
  11. <result column="commission_feevalue" property="commissionFeevalue" />
  12. <result column="other_feevalue" property="otherFeevalue" />
  13. <result column="all_fee_value" property="allFeeValue" />
  14. <result column="dept_id" property="deptId" />
  15. <result column="dept_name" property="deptName" />
  16. <result column="create_time" property="createTime" />
  17. <result column="operator" property="operator" />
  18. <result column="status" property="status" />
  19. </resultMap>
  20. <resultMap id="SettleReportDataMap" type="com.ydtech.modules.report.model.vo.InsPlySettleReportResVo">
  21. <result property="companyId" column="company_id" jdbcType="VARCHAR"/>
  22. <result property="settleMonth" column="settle_month" jdbcType="VARCHAR"/>
  23. <result property="commissionFeevalue" column="commission_feevalue" jdbcType="DECIMAL"/>
  24. <result property="otherFeevalue" column="other_feevalue" jdbcType="DECIMAL"/>
  25. <result property="allFeeValue" column="all_fee_value" jdbcType="DECIMAL"/>
  26. <result property="status" column="status" jdbcType="VARCHAR"/>
  27. </resultMap>
  28. <select id="getInsPlySettleReport" resultMap="SettleReportDataMap">
  29. <foreach collection="reportReqVo.groupInsCompanyArr" item="id"
  30. separator=" union all " >
  31. SELECT
  32. #{id} company_id,
  33. settle_month,
  34. #{reportReqVo.status} status,
  35. SUM(p.`commission_feevalue`) commission_feevalue,
  36. SUM(p.`other_feevalue`) other_feevalue,
  37. SUM(p.`all_fee_value`) all_fee_value
  38. FROM
  39. ins_ply_settle p WHERE
  40. p.company_id in (select id from esm_ins_company where FIND_IN_SET(id,get_child_list(#{id})))
  41. <if test="reportReqVo.status != null and reportReqVo.status != ''">
  42. and p.status = #{reportReqVo.status}
  43. </if>
  44. <if test="reportReqVo.settleMonth != null and reportReqVo.settleMonth != ''">
  45. and p.settle_month = #{reportReqVo.settleMonth}
  46. </if>
  47. <if test="reportReqVo.quoteStartDate != null and reportReqVo.quoteEndDate != null">
  48. and p.create_time between #{reportReqVo.quoteStartDate} AND #{reportReqVo.quoteEndDate}
  49. </if>
  50. GROUP BY p.`settle_month`
  51. </foreach>
  52. </select>
  53. <select id="getInsPlySettleReportCount" resultType="Long">
  54. select
  55. count(1)
  56. from (
  57. <foreach collection="reportReqVo.groupInsCompanyArr" item="id"
  58. separator=" union all " >
  59. SELECT
  60. #{id} company_id,
  61. settle_month,
  62. #{reportReqVo.status} status,
  63. SUM(p.`commission_feevalue`) commission_feevalue,
  64. SUM(p.`other_feevalue`) other_feevalue,
  65. SUM(p.`all_fee_value`) all_fee_value
  66. FROM
  67. ins_ply_settle p WHERE
  68. p.company_id in (select id from esm_ins_company where FIND_IN_SET(id,get_child_list(#{id})))
  69. <if test="reportReqVo.status != null and reportReqVo.status != ''">
  70. and p.status = #{reportReqVo.status}
  71. </if>
  72. <if test="reportReqVo.settleMonth != null and reportReqVo.settleMonth != ''">
  73. and p.settle_month = #{reportReqVo.settleMonth}
  74. </if>
  75. <if test="reportReqVo.quoteStartDate != null and reportReqVo.quoteEndDate != null">
  76. and p.create_time between #{reportReqVo.quoteStartDate} AND #{reportReqVo.quoteEndDate}
  77. </if>
  78. GROUP BY p.`settle_month`
  79. </foreach>
  80. ) as s
  81. </select>
  82. <resultMap id="InsPlySettleStatisticsListResMap" type="com.ydtech.modules.report.model.vo.InsPlySettleStatisticsListResVo">
  83. <id column="settleno" property="settleno" />
  84. <result column="company_name" property="companyName" />
  85. <result column="settle_month" property="settleMonth" />
  86. <result column="settle_batch" property="settleBatch" />
  87. <result column="commission_feevalue" property="commissionFeevalue" />
  88. <result column="other_feevalue" property="otherFeevalue" />
  89. <result column="all_fee_value" property="allFeeValue" />
  90. <result column="create_time" property="createTime" />
  91. <result column="operator" property="operator" />
  92. <result column="status" property="status" />
  93. </resultMap>
  94. <select id="getInsPlySettleReportList" resultMap="InsPlySettleStatisticsListResMap">
  95. SELECT
  96. p.settleno,
  97. (select name from esm_ins_company where id = p.company_id)company_name,
  98. p.settle_month,
  99. p.settle_batch,
  100. p.`commission_feevalue`,
  101. p.`other_feevalue`,
  102. p.`all_fee_value`,
  103. p.create_time,
  104. p.operator,
  105. p.status
  106. FROM
  107. ins_ply_settle p WHERE 1=1
  108. <if test="reportReqVo.companyId != null and reportReqVo.companyId != ''">
  109. and p.company_id = #{reportReqVo.companyId}
  110. </if>
  111. <if test="reportReqVo.status != null and reportReqVo.status != ''">
  112. and p.status = #{reportReqVo.status}
  113. </if>
  114. <if test="reportReqVo.settleMonth != null and reportReqVo.settleMonth != ''">
  115. and p.settle_month = #{reportReqVo.settleMonth}
  116. </if>
  117. <if test="reportReqVo.quoteStartDate != null and reportReqVo.quoteEndDate != null">
  118. and p.create_time between #{reportReqVo.quoteStartDate} AND #{reportReqVo.quoteEndDate}
  119. </if>
  120. </select>
  121. </mapper>