PtlSchemeMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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.scheme.dao.PtlSchemeMapper">
  4. <resultMap id="SchemeResultVoMap" type="com.ydtech.modules.scheme.entity.vo.SchemeResultVo">
  5. <id property="id" column="id" />
  6. <result property="companyId" column="company_id" />
  7. <result property="productId" column="product_id" />
  8. <result property="productName" column="product_name" />
  9. <result property="schemeName" column="scheme_name" />
  10. <result property="description" column="description" />
  11. <result property="kinds" column="kinds" typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
  12. <collection property="drivingIntentions" ofType="com.ydtech.modules.scheme.entity.po.PtlSchemeInsuranceDrivingIntention">
  13. <id property="id" column="id" />
  14. <result property="schemeId" column="scheme_id" />
  15. <result property="seatNum" column="seat_num" />
  16. <result property="drivingIntentionId" column="driving_intention_id" />
  17. <collection property="drivingIntentionInsurance" ofType="com.ydtech.modules.order.entity.InsDrivingIntentionInsurance">
  18. <id property="id" column="id" />
  19. <result property="apiType" column="api_type" />
  20. <result property="companyId" column="company_id" />
  21. <result property="projectName" column="project_name" />
  22. <result property="projectCode" column="project_code" />
  23. <result property="riskCode" column="risk_code" />
  24. <result property="sumAmount" column="sum_amount" />
  25. <result property="sumPremium" column="sum_premium" />
  26. <collection property="insDrivingIntentionInsuranceSon" ofType="com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceSon">
  27. <result property="drivingCodeId" column="driving_code_id"/>
  28. <result property="amount" column="amount" />
  29. <result property="code" column="code" />
  30. <result property="name" column="name" />
  31. <result property="premium" column="premium" />
  32. </collection>
  33. </collection>
  34. </collection>
  35. </resultMap>
  36. <select id="getAllCompany" resultType="com.ydtech.modules.esm.model.EsmInsCompany">
  37. SELECT
  38. eic.*
  39. FROM
  40. esm_ins_company eic,
  41. ptl_agreement pa
  42. WHERE
  43. eic.id = pa.insurance_company_id
  44. and
  45. pa.is_external = 0
  46. <if test="schemeQueryVo.companyName != null and schemeQueryVo.companyName != ''">
  47. and
  48. eic.name like concat('%',#{schemeQueryVo.companyName},'%')
  49. </if>
  50. GROUP BY
  51. eic.id
  52. </select>
  53. <select id="getSchemeList" resultType="com.ydtech.modules.scheme.entity.po.PtlScheme">
  54. SELECT
  55. ps.company_id,
  56. ps.product_id,
  57. ps.product_name
  58. FROM
  59. ptl_scheme ps
  60. WHERE
  61. 1=1
  62. and
  63. ps.company_id = #{schemeQueryVo.companyId}
  64. and
  65. ps.energy_type = #{schemeQueryVo.energyType}
  66. and
  67. ps.vehicle_type = #{schemeQueryVo.vehicleType}
  68. <if test="schemeQueryVo.carnature != null and schemeQueryVo.carnature != ''">
  69. and
  70. ps.carnature = #{schemeQueryVo.carnature}
  71. </if>
  72. GROUP BY
  73. ps.product_id,
  74. ps.product_name
  75. </select>
  76. <select id="getSchemeResultList" resultMap="SchemeResultVoMap">
  77. SELECT
  78. *
  79. FROM
  80. ptl_scheme ps
  81. LEFT JOIN
  82. ptl_scheme_insurance psi ON psi.scheme_id = ps.id
  83. LEFT JOIN
  84. ptl_scheme_insurance_driving_intention psidi ON psidi.scheme_id = ps.id
  85. LEFT JOIN
  86. ins_driving_intention_insurance idii ON psidi.driving_intention_id = idii.id
  87. LEFT JOIN
  88. ins_driving_intention_insurance_son idiis ON idii.project_code = idiis.driving_code_id
  89. WHERE
  90. ps.company_id = #{companyId}
  91. AND
  92. ps.product_id = #{productId}
  93. AND
  94. ps.energy_type = #{energyType}
  95. AND
  96. ps.vehicle_type = #{vehicleType}
  97. <if test="carnature != null and carnature != ''">
  98. AND
  99. ps.carnature = #{carnature}
  100. </if>
  101. </select>
  102. <select id="getSchemeRules" resultType="com.ydtech.modules.scheme.entity.po.PtlSchemeRules">
  103. SELECT
  104. ps.*
  105. FROM
  106. ptl_scheme_rules ps
  107. WHERE
  108. ps.company_id in
  109. <foreach item="item" collection="companyIds" open="(" separator="," close=")">
  110. #{item}
  111. </foreach>
  112. AND ps.product_id = #{productId}
  113. AND ps.energy_type = #{energyType}
  114. AND ps.vehicle_type = #{vehicleType}
  115. </select>
  116. <select id="allCompanyList" resultType="com.ydtech.modules.esm.model.EsmInsCompany">
  117. SELECT
  118. eic.*
  119. FROM
  120. esm_ins_company eic
  121. WHERE
  122. id IN (
  123. SELECT
  124. eic.id
  125. FROM
  126. ins_area_company iac
  127. LEFT JOIN esm_ins_company eic ON iac.company_id = eic.id
  128. WHERE
  129. iac.orderstatus = 3
  130. GROUP BY
  131. eic.id
  132. )
  133. </select>
  134. </mapper>