InsPlyIncomeMapper.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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.InsPlyIncomeMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.ydtech.modules.fnc.entity.InsPlyIncome">
  6. <id column="orderno" property="orderno" />
  7. <id column="policyno" property="policyno" />
  8. <result column="dept_id" property="deptId" />
  9. <result column="dept_name" property="deptName" />
  10. <result column="riskcode" property="riskcode" />
  11. <result column="pay_date" property="payDate" />
  12. <result column="company_id" property="companyId" />
  13. <result column="company_name" property="companyName" />
  14. <result column="agreement_id" property="agreementId" />
  15. <result column="licenseno" property="licenseno" />
  16. <result column="taxamount" property="taxamount" />
  17. <result column="no_tax_premium" property="noTaxPremium" />
  18. <result column="commission_feerate" property="commissionFeerate" />
  19. <result column="other_feerate" property="otherFeerate" />
  20. <result column="commission_feevalue" property="commissionFeevalue" />
  21. <result column="other_feevalue" property="otherFeevalue" />
  22. <result column="all_fee_value" property="allFeeValue" />
  23. <result column="final_fee_value" property="finalFeeValue" />
  24. <result column="doing_fee_value" property="doingFeeValue" />
  25. <result column="create_time" property="createTime" />
  26. <result column="voucher_number" property="voucherNumber"/>
  27. <result column="contract_id" property="contractId"/>
  28. <result column="contract_file_id" property="contractFileId"/>
  29. <result column="handling_fees_status" property="handlingFeesStatus"/>
  30. <result column="documentary_fees_status" property="documentaryFeesStatus"/>
  31. <result column="no_policyno" property="noPolicyno"/>
  32. <result column="sy_policyno" property="syPolicyno"/>
  33. </resultMap>
  34. <select id="queryNew" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  35. select
  36. a.orderno as "orderno",
  37. a.policyno as "policyno",
  38. a.dept_id as "deptId",
  39. a.riskcode as "riskcode",
  40. a.pay_date as "payDate",
  41. a.signdate as "signdate",
  42. a.company_id as "companyId",
  43. a.agreement_id as "agreementId",
  44. a.licenseno as "licenseno",
  45. a.taxamount as "taxamount",
  46. a.no_tax_premium as "noTaxPremium",
  47. a.commission_feerate as "commissionFeerate",
  48. a.other_feerate as "otherFeerate",
  49. a.commission_feevalue as "commissionFeevalue",
  50. a.other_feevalue as "otherFeevalue",
  51. a.all_fee_value as "allFeeValue",
  52. a.final_fee_value as "finalFeeValue",
  53. a.doing_fee_value as "doingFeeValue",
  54. a.voucher_number as "voucherNumber",
  55. a.contract_id as "contractId",
  56. a.contract_file_id as "contractFileId",
  57. a.handling_fees_status as "handlingFeesStatus",
  58. a.no_policyno as "noPolicyno",
  59. a.sy_policyno as "syPolicyno",
  60. a.documentary_fees_status as "documentaryFeesStatus",
  61. a.create_time as "createTime"
  62. from ins_ply_income a
  63. LEFT JOIN ptl_agreement pa on a.agreement_id = pa.id
  64. <where>
  65. <if test="startDate !=null and startDate!='' and endDate !=null and endDate !=''">
  66. and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
  67. </if>
  68. <if test="agreementType !=null and agreementType !=''">
  69. and pa.agreement_type =#{agreementType}
  70. </if>
  71. <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
  72. and a.handling_fees_status =#{handlingFeesStatus}
  73. </if>
  74. <if test="documentaryFeesStatus !=null and documentaryFeesStatus !=''">
  75. and a.documentary_fees_status =#{documentaryFeesStatus}
  76. </if>
  77. </where>
  78. </select>
  79. <select id="totalQuery" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  80. select
  81. sum(a.other_feevalue) as "totAmount",
  82. GROUP_CONCAT(orderno) as "ids",
  83. count(1) as "totalorders"
  84. from ins_ply_income a
  85. LEFT JOIN ptl_agreement pa on a.agreement_id = pa.id
  86. <where>
  87. <if test="startDate !=null and startDate!='' and endDate !=null and endDate !=''">
  88. and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
  89. </if>
  90. <if test="agreementtype !=null and agreementtype !=''">
  91. and pa.agreement_type =#{agreementtype}
  92. </if>
  93. <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
  94. and a.handling_fees_status =#{handlingFeesStatus}
  95. </if>
  96. <if test="documentaryFeesStatus !=null and documentaryFeesStatus !=''">
  97. and a.documentary_fees_status =#{documentaryFeesStatus}
  98. </if>
  99. </where>
  100. </select>
  101. <update id="uopdateByOrderno" parameterType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  102. update ins_ply_income
  103. <set>
  104. <if test="contractId != null">
  105. contract_id = #{contractId},
  106. </if>
  107. <if test="voucherNumber != null">
  108. voucher_number = #{voucherNumber},
  109. </if>
  110. <if test="contractFileId != null">
  111. contract_file_id = #{contractFileId},
  112. </if>
  113. <if test="handlingFeesStatus != null">
  114. handling_fees_status = #{handlingFeesStatus},
  115. </if>
  116. <if test="documentaryFeesStatus != null">
  117. documentary_fees_status = #{documentaryFeesStatus},
  118. </if>
  119. </set>
  120. where orderno =#{orderno}
  121. </update>
  122. </mapper>