KlRegulationBaseMapper.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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.diagbot.mapper.KlRegulationBaseMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.diagbot.entity.KlRegulationBase">
  6. <id column="id" property="id" />
  7. <result column="is_deleted" property="isDeleted" />
  8. <result column="gmt_create" property="gmtCreate" />
  9. <result column="gmt_modified" property="gmtModified" />
  10. <result column="creator" property="creator" />
  11. <result column="modifier" property="modifier" />
  12. <result column="concept_id" property="conceptId" />
  13. <result column="description" property="description" />
  14. <result column="type" property="type" />
  15. <result column="min_operator" property="minOperator" />
  16. <result column="min_value" property="minValue" />
  17. <result column="min_unit" property="minUnit" />
  18. <result column="max_operator" property="maxOperator" />
  19. <result column="max_value" property="maxValue" />
  20. <result column="max_unit" property="maxUnit" />
  21. <result column="eq_operator" property="eqOperator" />
  22. <result column="eq_value" property="eqValue" />
  23. <result column="eq_unit" property="eqUnit" />
  24. </resultMap>
  25. <select id="getAllBase" resultType="com.diagbot.dto.BaseRegulationDTO">
  26. SELECT DISTINCT
  27. CONCAT_WS(
  28. "_",
  29. t1.concept_id,
  30. t1.type,
  31. t1.max_operator,
  32. t1.max_value,
  33. t1.max_unit,
  34. t1.min_operator,
  35. t1.min_value,
  36. t1.min_unit,
  37. t1.eq_operator,
  38. t1.eq_value,
  39. t1.eq_unit
  40. ) AS baseKey,
  41. GROUP_CONCAT(t1.id) AS ids,
  42. IFNULL(t2.lib_name, "") AS baseLibName,
  43. IFNULL(t2.lib_type, 0) AS baseLibType,
  44. t1.concept_id,
  45. t1.type AS baseType,
  46. t1.max_operator AS baseMaxOperator,
  47. t1.max_value AS baseMaxValue,
  48. t1.max_unit AS baseMaxUnit,
  49. t1.min_operator AS baseMinOperator,
  50. t1.min_value AS baseMinValue,
  51. t1.min_unit AS baseMinUnit,
  52. t1.eq_operator AS baseEqOperator,
  53. t1.eq_value AS baseEqValue,
  54. t1.eq_unit AS baseEqUnit
  55. FROM
  56. kl_regulation_base t1
  57. LEFT JOIN kl_concept t2 ON t1.concept_id = t2.id
  58. AND t2.is_deleted = "N"
  59. AND t2.`status` = 1
  60. WHERE
  61. t1.is_deleted = "N"
  62. AND t1.`status` = 1
  63. GROUP BY
  64. t1.concept_id,
  65. t1.type,
  66. t1.max_operator,
  67. t1.max_value,
  68. t1.max_unit,
  69. t1.min_operator,
  70. t1.min_value,
  71. t1.min_unit,
  72. t1.eq_operator,
  73. t1.eq_value,
  74. t1.eq_unit
  75. </select>
  76. <select id="getSelectBase" resultType="com.diagbot.dto.BaseRegulationDTO">
  77. SELECT DISTINCT
  78. CONCAT_WS(
  79. "_",
  80. t1.concept_id,
  81. t1.type,
  82. t1.max_operator,
  83. t1.max_value,
  84. t1.max_unit,
  85. t1.min_operator,
  86. t1.min_value,
  87. t1.min_unit,
  88. t1.eq_operator,
  89. t1.eq_value,
  90. t1.eq_unit
  91. ) AS baseKey,
  92. GROUP_CONCAT(t1.id) AS ids,
  93. IFNULL(t2.lib_name, "") AS baseLibName,
  94. IFNULL(t2.lib_type, 0) AS baseLibType,
  95. t1.concept_id,
  96. t1.type AS baseType,
  97. t1.max_operator AS baseMaxOperator,
  98. t1.max_value AS baseMaxValue,
  99. t1.max_unit AS baseMaxUnit,
  100. t1.min_operator AS baseMinOperator,
  101. t1.min_value AS baseMinValue,
  102. t1.min_unit AS baseMinUnit,
  103. t1.eq_operator AS baseEqOperator,
  104. t1.eq_value AS baseEqValue,
  105. t1.eq_unit AS baseEqUnit
  106. FROM
  107. kl_regulation_base t1
  108. LEFT JOIN kl_concept t2 ON t1.concept_id = t2.id
  109. AND t2.is_deleted = "N"
  110. AND t2.`status` = 1
  111. WHERE
  112. t1.is_deleted = "N"
  113. AND t1.`status` = 1
  114. AND t1.id in
  115. (
  116. SELECT
  117. b.regulation_base_id
  118. FROM
  119. `kl_regulation` a,
  120. kl_regulation_condition b
  121. WHERE
  122. a.id = b.regulation_id
  123. <if test="list != null and list.size > 0">
  124. and a.`code` in
  125. <foreach item="code" collection="list" open="(" separator="," close=")">
  126. #{code}
  127. </foreach>
  128. </if>
  129. AND a.`status` = 1
  130. AND b.condition_type = 1
  131. )
  132. GROUP BY
  133. t1.concept_id,
  134. t1.type,
  135. t1.max_operator,
  136. t1.max_value,
  137. t1.max_unit,
  138. t1.min_operator,
  139. t1.min_value,
  140. t1.min_unit,
  141. t1.eq_operator,
  142. t1.eq_value,
  143. t1.eq_unit
  144. </select>
  145. </mapper>