JyxConfigMapper.xml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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.jzg.mapper.JyxConfigMapper">
  6. <resultMap id="jyxConfigVo" type="com.jzg.commons.entity.vo.JyxConfigVo">
  7. <id column="id" property="id"/>
  8. <result column="product_type" property="productType"/>
  9. <result column="parent_id" property="parentId"/>
  10. <result column="product_name" property="productName"/>
  11. <result column="alias" property="alias"/>
  12. <result column="company" property="company"/>
  13. <result column="product_code" property="productCode"/>
  14. <result column="connection_method" property="connectionMethod"/>
  15. <result column="premium_setting" property="premiumSetting"/>
  16. <result column="jsCoverage" property="coverage"/>
  17. <result column="jsPremium" property="premium"/>
  18. <result column="system_code" property="systemCode"/>
  19. <result column="jcDelete" property="isDelete"/>
  20. <collection property="blameList" ofType="com.jzg.commons.entity.po.JyxBlame">
  21. <id column="blame_id" property="id"/>
  22. <result column="blame" property="blame"/>
  23. <result column="blame_code" property="blameCode"/>
  24. <result column="blame_coverage" property="blameCoverage"/>
  25. <result column="blame_premium" property="blamePremium"/>
  26. <result column="blame_system_code" property="systemCode"/>
  27. <result column="blame_jyx_config_id" property="jyxConfigId"/>
  28. </collection>
  29. <collection property="settingList" ofType="com.jzg.commons.entity.po.jyxSetting">
  30. <id column="setting_id" property="id"/>
  31. <result column="seats" property="seats"/>
  32. <result column="setting_coverage" property="coverage"/>
  33. <result column="setting_premium" property="premium"/>
  34. <result column="setting_system_code" property="systemCode"/>
  35. <result column="setting_jyx_config_id" property="jyxConfigId"/>
  36. </collection>
  37. </resultMap>
  38. <sql id="params">
  39. jc.`id`, jc.`product_type`,jc.`parent_id`,
  40. CASE WHEN jc.parent_id != '0' AND jc.parent_id IS NOT NULL AND jc1.product_name IS NOT NULL THEN CONCAT(jc1.product_name, '-', jc.product_name) ELSE jc.product_name END as product_name,
  41. jc.`alias`,jc.`company`, jc.`product_code`,jc.`connection_method`,jc.`premium_setting`, jc.`coverage` as jsCoverage, jc.`premium` as jsPremium, jc.`system_code`, jc.`is_delete` as isDelete
  42. </sql>
  43. <select id="jyxList" resultMap="jyxConfigVo">
  44. select
  45. <include refid="params"/> ,
  46. jb.id as blame_id,jb.blame,jb.blame_code,jb.blame_coverage,jb.blame_premium,jb.system_code as blame_system_code,jb.jyx_config_id as blame_jyx_config_id,
  47. js.id as setting_id,js.seats,js.coverage as setting_coverage,js.premium as setting_premium,js.system_code as setting_system_code,js.jyx_config_id as setting_jyx_config_id
  48. from jyx_config jc
  49. left join jyx_config jc1 on jc.parent_id = jc1.id AND jc1.is_delete = 0
  50. left join jyx_blame jb on jc.id = jb.jyx_config_id AND jb.is_delete = 0
  51. left join jyx_setting js on jc.id = js.jyx_config_id AND js.is_delete = 0
  52. <where>
  53. jc.is_delete = 0
  54. <if test="params != null and params != ''">
  55. and (jc.product_name like concat('%',#{params},'%') or jc.alias like concat('%',#{params},'%'))
  56. </if>
  57. <if test="seats != null and seats != ''">
  58. and js.seats = #{seats}
  59. </if>
  60. <if test="company != null and company != ''">
  61. and jc.company = #{company}
  62. </if>
  63. <if test="parentId == 0">
  64. and jc.parent_id = 0
  65. </if>
  66. <if test="parentId == null and parentId == ''">
  67. and jc.parent_id != 0
  68. </if>
  69. </where>
  70. order by jc.create_time desc
  71. </select>
  72. <select id="selectIds" resultMap="jyxConfigVo">
  73. select
  74. <include refid="params"/> ,
  75. jb.id as blame_id,jb.blame,jb.blame_code,jb.blame_coverage,jb.blame_premium,jb.system_code as blame_system_code,jb.jyx_config_id as blame_jyx_config_id,
  76. js.id as setting_id,js.seats,js.coverage as setting_coverage,js.premium as setting_premium,js.system_code as setting_system_code,js.jyx_config_id as setting_jyx_config_id
  77. from jyx_config jc
  78. left join jyx_blame jb on jc.id = jb.jyx_config_id AND jb.is_delete = 0
  79. left join jyx_setting js on jc.id = js.jyx_config_id AND js.is_delete = 0
  80. <where>
  81. jc.is_delete = 0
  82. <if test="ids != null and ids != ''">
  83. and jc.id in
  84. <foreach collection="ids" item="id" open="(" separator="," close=")">
  85. #{id}
  86. </foreach>
  87. </if>
  88. </where>
  89. order by jc.create_time desc
  90. </select>
  91. <select id="selectParentIds" resultMap="jyxConfigVo">
  92. select
  93. <include refid="params"/> ,
  94. jb.id as blame_id,jb.blame,jb.blame_code,jb.blame_coverage,jb.blame_premium,jb.system_code as blame_system_code,jb.jyx_config_id as blame_jyx_config_id,
  95. js.id as setting_id,js.seats,js.coverage as setting_coverage,js.premium as setting_premium,js.system_code as setting_system_code,js.jyx_config_id as setting_jyx_config_id
  96. from jyx_config jc
  97. left join jyx_blame jb on jc.id = jb.jyx_config_id AND jb.is_delete = 0
  98. left join jyx_setting js on jc.id = js.jyx_config_id AND js.is_delete = 0
  99. <where>
  100. jc.is_delete = 0
  101. <if test="ids != null and ids != ''">
  102. and jc.id in
  103. <foreach collection="ids" item="id" open="(" separator="," close=")">
  104. #{id}
  105. </foreach>
  106. </if>
  107. </where>
  108. order by jc.create_time desc
  109. </select>
  110. <select id="selectMainInsurance" resultType="com.jzg.commons.entity.vo.JyxConfigVo">
  111. select
  112. jc.`id`,
  113. jc.`product_type`,
  114. jc.`parent_id`,
  115. jc.`product_name`,
  116. jc.`alias`,
  117. jc.`company`,
  118. jc.`product_code`,
  119. jc.`connection_method`,
  120. jc.`premium_setting`,
  121. jc.`coverage` AS jsCoverage,
  122. jc.`premium` AS jsPremium,
  123. jc.`system_code`,
  124. jc.`is_delete` AS isDelete,
  125. jb.id AS blame_id,
  126. jb.blame,
  127. jb.blame_code,
  128. jb.blame_coverage,
  129. jb.blame_premium,
  130. jb.system_code AS blame_system_code,
  131. jb.jyx_config_id AS blame_jyx_config_id,
  132. js.id AS setting_id,
  133. js.seats,
  134. js.coverage AS setting_coverage,
  135. js.premium AS setting_premium,
  136. js.system_code AS setting_system_code,
  137. js.jyx_config_id AS setting_jyx_config_id
  138. from jyx_config jc
  139. left join jyx_blame jb on jc.id = jb.jyx_config_id AND jb.is_delete = 0
  140. left join jyx_setting js on jc.id = js.jyx_config_id AND js.is_delete = 0
  141. <where>
  142. jc.is_delete = 0 and jc.parent_id = 0
  143. <if test="company != null and company != ''">
  144. and jc.company = #{company}
  145. </if>
  146. </where>
  147. order by jc.create_time desc
  148. </select>
  149. </mapper>