IndicatorMapper.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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.ims.eval.dao.IndicatorMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.ims.eval.entity.Indicator">
  6. <id column="id" property="id" />
  7. <result column="indicator_name" property="indicatorName" />
  8. <result column="indicator_code" property="indicatorCode" />
  9. <result column="unit" property="unit" />
  10. <result column="indicator_type_id" property="indicatorTypeId" />
  11. <result column="coefficient" property="coefficient" />
  12. <result column="is_quantified" property="isQuantified" />
  13. <result column="is_additional" property="isAdditional" />
  14. <result column="is_child" property="isChild" />
  15. <result column="bin_section" property="binSection" />
  16. <result column="bin_stage" property="binStage" />
  17. <result column="dept_id" property="deptId" />
  18. <result column="company" property="company" />
  19. <result column="create_time" property="createTime" />
  20. <result column="update_time" property="updateTime" />
  21. <result column="create_by" property="createBy" />
  22. <result column="update_by" property="updateBy" />
  23. <result column="enable" property="enable" />
  24. <result column="remark" property="remark" />
  25. <result column="des" property="des" />
  26. <result column="order_num" property="orderNum" />
  27. </resultMap>
  28. <!-- 通用查询结果列 -->
  29. <sql id="Base_Column_List">
  30. id, indicator_name, indicator_code, unit, indicator_type_id, coefficient, is_quantified, is_additional, is_child, bin_section, bin_stage, dept_id, company, create_time, update_time, create_by, update_by, enable, remark, des, order_num
  31. </sql>
  32. <select id="selectByCode" resultType="com.ims.eval.entity.Indicator">
  33. SELECT
  34. *
  35. FROM
  36. indicator
  37. where indicator_code = #{code}
  38. </select>
  39. <select id="seleclistPage" resultType="com.ims.eval.entity.Indicator">
  40. SELECT
  41. i.*,t.type_name indicatorTypeName,
  42. b.stage_name binStageName,
  43. bs.section_name binSectionName
  44. FROM
  45. indicator i
  46. LEFT JOIN indicator_type t ON i.indicator_type_id = t.id
  47. LEFT JOIN bin_stage b ON i.bin_stage = b.id
  48. LEFT JOIN bin_section bs ON i.bin_section = bs.id
  49. <where>
  50. <if test="id !=null and id !=''">
  51. AND i.id = #{id}
  52. </if>
  53. <if test="indicatorName !=null and indicatorName !=''">
  54. AND i.indicator_name like CONCAT('%',#{indicatorName},'%')
  55. </if>
  56. <if test="indicatorCode !=null and indicatorCode !=''">
  57. AND i.indicator_code = #{indicatorCode}
  58. </if>
  59. <if test="binSection !=null and binSection !=''">
  60. AND i.bin_section = #{binSection}
  61. </if>
  62. <if test="binStage !=null and binStage !=''">
  63. AND i.bin_stage = #{binStage}
  64. </if>
  65. <if test="dept_id !=null and dept_id !=''">
  66. AND i.dept_id = #{dept}
  67. </if>
  68. <if test="company !=null and company !=''">
  69. AND i.company = #{company}
  70. </if>
  71. </where>
  72. order by i.order_num asc
  73. </select>
  74. <select id="selectListByIds" resultType="com.ims.eval.entity.dto.response.IndicatorResDTO">
  75. SELECT
  76. i.id id,
  77. i.is_quantified isQuantified,
  78. d.id indicatorDictionaryID,
  79. d.option_code optionCode,
  80. d.option_name optionName,
  81. d.child_code
  82. FROM
  83. INDICATOR i
  84. LEFT JOIN indicator_dictionary d ON i.ID = d.indicator_id
  85. <where>
  86. AND i.id in
  87. <foreach item="item" collection="indicatorIds" separator="," open="(" close=")" index="">'${item}'</foreach>
  88. </where>
  89. </select>
  90. <select id="selectById" resultType="com.ims.eval.entity.dto.request.IndicatorDTO">
  91. SELECT
  92. i.*,t.type_name indicatorTypeName,
  93. b.stage_name binStageName,
  94. bs.section_name binSectionName
  95. FROM
  96. indicator i
  97. LEFT JOIN indicator_type t ON i.indicator_type_id = t.id
  98. LEFT JOIN bin_stage b ON i.bin_stage = b.id
  99. LEFT JOIN bin_section bs ON i.bin_section = bs.id
  100. where i.id = #{id}
  101. </select>
  102. <select id="seleclistAll" resultType="com.ims.eval.entity.Indicator">
  103. SELECT
  104. i.*,t.type_name indicatorTypeName,
  105. b.stage_name binStageName,
  106. bs.section_name binSectionName,
  107. dd.key_name dept_idName
  108. FROM
  109. indicator i
  110. LEFT JOIN indicator_type t ON i.indicator_type_id = t.id
  111. LEFT JOIN bin_stage b ON i.bin_stage = b.id
  112. LEFT JOIN bin_section bs ON i.bin_section = bs.id
  113. inner join data_dictionary dd on dd.data_key = i.dept_id
  114. <where>
  115. <if test="id !=null and id !=''">
  116. AND i.id = #{id}
  117. </if>
  118. <if test="indicatorName !=null and indicatorName !=''">
  119. AND i.indicator_name like CONCAT('%',#{indicatorName},'%')
  120. </if>
  121. <if test="indicatorCode !=null and indicatorCode !=''">
  122. AND i.indicator_code = #{indicatorCode}
  123. </if>
  124. <if test="binSection !=null and binSection !=''">
  125. AND i.bin_section = #{binSection}
  126. </if>
  127. <if test="binStage !=null and binStage !=''">
  128. AND i.bin_stage = #{binStage}
  129. </if>
  130. <if test="dept_id !=null and dept_id !=''">
  131. AND i.dept_id = #{dept}
  132. </if>
  133. <if test="company !=null and company !=''">
  134. AND i.company = #{company}
  135. </if>
  136. </where>
  137. </select>
  138. </mapper>