InsAreaCompanyMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ydtech.modules.order.dao.InsAreaCompanyMapper">
  6. <resultMap id="BaseResultMap" type="com.ydtech.modules.order.entity.InsAreaCompany">
  7. <id property="id" column="id" jdbcType="VARCHAR"/>
  8. <result property="reqtxt" column="reqtxt" javaType="com.alibaba.fastjson.JSONObject"
  9. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  10. <result property="reptxt" column="reptxt" javaType="com.alibaba.fastjson.JSONObject"
  11. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  12. <result property="riskinfo" column="riskinfo" javaType="com.alibaba.fastjson.JSONArray"
  13. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  14. <result property="kindinfo" column="kindinfo" javaType="com.alibaba.fastjson.JSONArray"
  15. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  16. <result property="accidentInfo" column="accident_info" javaType="com.alibaba.fastjson.JSONArray"
  17. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  18. <result property="taxArrears" column="tax_arrears" javaType="com.alibaba.fastjson.JSONArray"
  19. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  20. <result property="crossInsurance" column="cross_insurance" javaType="com.alibaba.fastjson.JSONArray"
  21. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  22. <result property="orderno" column="orderno" jdbcType="VARCHAR"/>
  23. <result property="agreementId" column="agreement_id" jdbcType="BIGINT"/>
  24. <result property="apiType" column="api_type" jdbcType="TINYINT"/>
  25. <result property="orderstatus" column="orderstatus" jdbcType="VARCHAR"/>
  26. <result property="companyId" column="company_id" jdbcType="VARCHAR"/>
  27. <result property="inscompany" column="inscompany" jdbcType="VARCHAR"/>
  28. <result property="jqapplyno" column="jqapplyno" jdbcType="VARCHAR"/>
  29. <result property="jqpolicyno" column="jqpolicyno" jdbcType="VARCHAR"/>
  30. <result property="syapplyno" column="syapplyno" jdbcType="VARCHAR"/>
  31. <result property="sypolicyno" column="sypolicyno" jdbcType="VARCHAR"/>
  32. <result property="jqpremium" column="jqpremium" jdbcType="DECIMAL"/>
  33. <result property="sypremium" column="sypremium" jdbcType="DECIMAL"/>
  34. <result property="jypremium" column="jypremium" jdbcType="DECIMAL"/>
  35. <result property="sumpremium" column="sumpremium" jdbcType="DECIMAL"/>
  36. <result property="taxamount" column="taxamount" jdbcType="DECIMAL"/>
  37. <result property="jqdiscountrate" column="jqdiscountrate" jdbcType="DOUBLE"/>
  38. <result property="sydiscountrate" column="sydiscountrate" jdbcType="DOUBLE"/>
  39. <result property="feerate" column="feerate" jdbcType="DOUBLE"/>
  40. <result property="disrate" column="disrate" jdbcType="DOUBLE"/>
  41. <result property="auditid" column="auditid" jdbcType="VARCHAR"/>
  42. <result property="auditname" column="auditname" jdbcType="VARCHAR"/>
  43. <result property="audittime" column="audittime" jdbcType="TIMESTAMP"/>
  44. <result property="auditopinion" column="auditopinion" jdbcType="VARCHAR"/>
  45. <result property="jqappoint" column="jqappoint" jdbcType="VARCHAR"/>
  46. <result property="syappoint" column="syappoint" jdbcType="VARCHAR"/>
  47. <result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
  48. <result property="payDate" column="pay_date" jdbcType="TIMESTAMP"/>
  49. <result property="paymentLink" column="payment_link" jdbcType="VARCHAR"/>
  50. <result property="insOrderNo" column="ins_order_no" jdbcType="VARCHAR"/>
  51. <result property="attributionId" column="attribution_id" jdbcType="VARCHAR"/>
  52. <result property="jqStartDate" column="jq_start_date" jdbcType="VARCHAR"/>
  53. <result property="jqEndDate" column="jq_end_date" jdbcType="VARCHAR"/>
  54. <result property="syStartDate" column="sy_start_date" jdbcType="VARCHAR"/>
  55. <result property="syEndDate" column="sy_end_date" jdbcType="VARCHAR"/>
  56. <result property="accidentStrInfo" column="accident_str_info" jdbcType="VARCHAR"/>
  57. <result property="score" column="score" jdbcType="VARCHAR"/>
  58. <result property="jqScore" column="jq_score" jdbcType="VARCHAR"/>
  59. <result property="syScore" column="sy_score" jdbcType="VARCHAR"/>
  60. <result property="lossRation" column="loss_ration" jdbcType="DOUBLE"/>
  61. <result property="jqLossRation" column="jq_loss_ration" jdbcType="DOUBLE"/>
  62. <result property="syLossRation" column="sy_loss_ration" jdbcType="DOUBLE"/>
  63. <result property="totalAdjustRate" column="total_adjust_rate" jdbcType="DOUBLE"/>
  64. <result property="jqAdjustRate" column="jq_adjust_rate" jdbcType="DOUBLE"/>
  65. <result property="syAdjustRate" column="sy_adjust_rate" jdbcType="DOUBLE"/>
  66. <result property="insideOrderStatus" column="inside_order_status" jdbcType="TINYINT"/>
  67. <result property="insidePayTime" column="inside_pay_time" jdbcType="TIMESTAMP"/>
  68. <result property="signingTime" column="signing_time" jdbcType="TIMESTAMP"/>
  69. </resultMap>
  70. <resultMap id="InsAreaCompanyQueryDto" type="com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto"
  71. extends="BaseResultMap">
  72. <result property="agreementName" column="agreement_name" jdbcType="VARCHAR"/>
  73. </resultMap>
  74. <sql id="Base_Column_List">
  75. id,orderno,inscompany,
  76. reqtxt,reptxt,jqapplyno,
  77. jqpolicyno,syapplyno,sypolicyno,
  78. riskinfo,kindinfo,jqpremium,
  79. sypremium,taxamount,sumpremium,
  80. jqdiscountrate,sydiscountrate,feerate,
  81. disrate,auditid,auditname,
  82. audittime,auditopinion,jqappoint,
  83. syappoint,createtime,payment_link
  84. </sql>
  85. <select id="selectByOrderNo" resultMap="InsAreaCompanyQueryDto">
  86. SELECT iac.*, pa.agreement_name
  87. FROM ins_area_company as iac
  88. left join ptl_agreement as pa on pa.id = iac.agreement_id
  89. INNER JOIN (SELECT company_id, max(createtime) AS max_createtime
  90. FROM ins_area_company
  91. WHERE orderno = #{orderNo}
  92. GROUP BY company_id) t ON t.company_id = iac.company_id
  93. AND t.max_createtime = iac.createtime
  94. WHERE iac.orderno = #{orderNo}
  95. </select>
  96. <select id="selectAcceptInsurance" resultMap="InsAreaCompanyQueryDto">
  97. SELECT iac.*, pa.agreement_name
  98. FROM ins_area_company as iac
  99. left join ptl_agreement as pa on pa.id = iac.agreement_id
  100. WHERE iac.orderstatus = 3 and orderno = #{orderNo};
  101. </select>
  102. <select id="queryLatestStatus" resultType="java.lang.String">
  103. SELECT iac.orderstatus
  104. FROM ins_area_company as iac
  105. INNER JOIN (SELECT company_id, max(createtime) AS max_createtime
  106. FROM ins_area_company
  107. WHERE orderno = #{orderNo}
  108. GROUP BY company_id) t ON t.company_id = iac.company_id
  109. AND t.max_createtime = iac.createtime
  110. WHERE iac.orderno = #{orderNo}
  111. ORDER BY orderstatus DESC
  112. LIMIT 1
  113. </select>
  114. <select id="getorDerIds" resultType="com.ydtech.modules.order.entity.InsAreaCompany">
  115. SELECT
  116. a.id as "id" ,
  117. a.orderno as "orderno"
  118. FROM
  119. ins_area_company a
  120. LEFT JOIN ins_fee_order_new b ON a.id =b.ins_order_no
  121. WHERE
  122. a.orderstatus = '3' or a.orderstatus = '2'
  123. and b.id is not null
  124. </select>
  125. <select id="getPendingAuditOrders" resultType="com.ydtech.modules.order.entity.InsOrders">
  126. SELECT
  127. *
  128. FROM
  129. ins_orders
  130. WHERE
  131. orderno IN (
  132. SELECT
  133. orderno
  134. FROM
  135. ins_area_company
  136. WHERE
  137. id IN ( SELECT ins_order_no FROM ins_fee_order_new WHERE id NOT IN ( SELECT ins_order_no FROM ins_fee_audit ) )
  138. AND orderstatus = 3
  139. )
  140. AND
  141. orderstatus= 3
  142. <if test="params.orderNo != null and params.orderNo != ''">
  143. AND orderno = #{params.orderNo}
  144. </if>
  145. <if test="params.licenseNo != null and params.licenseNo != ''">
  146. AND licenseno = #{params.licenseNo}
  147. </if>
  148. <if test="params.frameNo != null and params.frameNo != ''">
  149. AND frameno = #{params.frameNo}
  150. </if>
  151. <if test="params.insuredname != null and params.insuredname != ''">
  152. AND insuredname = #{params.insuredname}
  153. </if>
  154. <if test="params.startDate != null and params.startDate != ''">
  155. BETWEEN createtime = #{params.startDate} and #{params.endDate}
  156. </if>
  157. </select>
  158. <select id="getAlreadyAuditOrders" resultType="com.ydtech.modules.order.entity.InsOrders">
  159. SELECT
  160. *
  161. FROM
  162. ins_orders
  163. WHERE
  164. orderno IN (
  165. SELECT
  166. orderno
  167. FROM
  168. ins_area_company
  169. WHERE
  170. id IN ( SELECT ifon.ins_order_no FROM ins_fee_order_new ifon RIGHT JOIN ins_fee_audit ifa ON ifon.ins_order_no = ifa.ins_order_no ))
  171. AND
  172. orderstatus = 3
  173. <if test="params.orderNo != null and params.orderNo != ''">
  174. AND orderno = #{params.orderNo}
  175. </if>
  176. <if test="params.licenseNo != null and params.licenseNo != ''">
  177. AND licenseno = #{params.licenseNo}
  178. </if>
  179. <if test="params.frameNo != null and params.frameNo != ''">
  180. AND frameno = #{params.frameNo}
  181. </if>
  182. <if test="params.insuredname != null and params.insuredname != ''">
  183. AND insuredname = #{params.insuredname}
  184. </if>
  185. <if test="params.startDate != null and params.startDate != ''">
  186. BETWEEN createtime = #{params.startDate} and #{params.endDate}
  187. </if>
  188. </select>
  189. </mapper>