ResultRuleMapper.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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.ResultRuleMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.diagbot.entity.ResultRule">
  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="result_id" property="resultId" />
  13. <result column="rule_order_no" property="ruleOrderNo" />
  14. <result column="rule_type" property="ruleType" />
  15. <result column="rule_id" property="ruleId" />
  16. <result column="rule_lib_type" property="ruleLibType" />
  17. <result column="rule_lib_type_name" property="ruleLibTypeName" />
  18. <result column="rule_lib_name" property="ruleLibName" />
  19. <result column="rule_his_name" property="ruleHisName" />
  20. <result column="rule_his_detail_name" property="ruleHisDetailName" />
  21. <result column="has_sub_cond" property="hasSubCond" />
  22. <result column="rule_base_id" property="ruleBaseId" />
  23. <result column="group_type" property="groupType" />
  24. <result column="rule_base_type" property="ruleBaseType" />
  25. <result column="rule_base_lib_type" property="ruleBaseLibType" />
  26. <result column="rule_base_lib_type_name" property="ruleBaseLibTypeName" />
  27. <result column="rule_base_lib_name" property="ruleBaseLibName" />
  28. <result column="rule_base_his_name" property="ruleBaseHisName" />
  29. <result column="rule_base_his_detail_name" property="ruleBaseHisDetailName" />
  30. <result column="rule_base_max_value" property="ruleBaseMaxValue" />
  31. <result column="rule_base_min_value" property="ruleBaseMinValue" />
  32. <result column="rule_base_unit" property="ruleBaseUnit" />
  33. <result column="rule_base_input_value" property="ruleBaseInputValue" />
  34. <result column="reference_value" property="referenceValue" />
  35. <result column="output" property="output" />
  36. <result column="expected_output" property="expectedOutput" />
  37. <result column="success" property="success" />
  38. <result column="message" property="message" />
  39. <result column="input_params" property="inputParams" />
  40. <result column="output_params" property="outputParams" />
  41. <result column="rule_msg" property="ruleMsg" />
  42. </resultMap>
  43. <select id="getPage" resultType="com.diagbot.dto.ResultRulePageDTO">
  44. SELECT t.*
  45. FROM
  46. (SELECT
  47. a.gmt_modified AS gmtModified,
  48. a.modifier AS modifier,
  49. a.result_id AS resultId,
  50. a.rule_order_no AS ruleOrderNo,
  51. a.rule_type AS ruleType,
  52. a.rule_id AS ruleId,
  53. a.rule_lib_type AS ruleLibType,
  54. a.rule_lib_type_name AS ruleLibTypeName,
  55. a.rule_lib_name AS ruleLibName,
  56. a.rule_his_name AS ruleHisName,
  57. a.rule_his_detail_name AS ruleHisDetailName,
  58. a.group_type AS groupType,
  59. a.output AS output,
  60. a.expected_output AS expectedOutput,
  61. a.success AS success,
  62. a.message AS message,
  63. group_concat(id) as ids,
  64. group_concat(a.rule_base_lib_type) as ruleBaseLibTypes,
  65. group_concat(a.rule_base_lib_name) as ruleBaseLibNames
  66. FROM
  67. test_result_rule a
  68. WHERE
  69. a.is_deleted = 'N'
  70. <if test="resultRulePageVO.success != null">
  71. and a.success = #{resultRulePageVO.success}
  72. </if>
  73. <if test="resultRulePageVO.resultId != null">
  74. and a.result_id = #{resultRulePageVO.resultId}
  75. </if>
  76. GROUP BY
  77. a.result_id,
  78. a.rule_order_no
  79. ORDER BY
  80. a.result_id,
  81. a.rule_order_no) t
  82. WHERE 1 = 1
  83. <if test="resultRulePageVO.success != null and resultRulePageVO.success == 0">
  84. and t.message not like concat('%', '映射', '%')
  85. </if>
  86. <if test="resultRulePageVO.ruleLibType != null">
  87. and t.ruleLibType = #{resultRulePageVO.ruleLibType}
  88. </if>
  89. <if test="resultRulePageVO.ruleLibName != null and resultRulePageVO.ruleLibName != ''">
  90. and t.ruleLibName like concat('%', #{resultRulePageVO.ruleLibName}, '%')
  91. </if>
  92. <if test="resultRulePageVO.ruleBaseLibType != null">
  93. and t.ruleBaseLibTypes is not null
  94. and find_in_set( #{resultRulePageVO.ruleBaseLibType},t.ruleBaseLibTypes )>0
  95. </if>
  96. <if test="resultRulePageVO.ruleBaseLibName != null and resultRulePageVO.ruleBaseLibName != ''">
  97. and t.ruleBaseLibName like concat('%', #{resultRulePageVO.ruleBaseLibName}, '%')
  98. </if>
  99. <if test="resultRulePageVO.message != null and resultRulePageVO.message != ''">
  100. and t.message like concat('%', #{resultRulePageVO.message}, '%')
  101. </if>
  102. </select>
  103. </mapper>