ObjKeyPblmRelDao.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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="cn.com.goldenwater.dcproj.dao.ObjKeyPblmRelDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.ObjKeyPblmRel" id="objKeyPblmRelResultMap">
  5. <result property="type" column="TYPE"/>
  6. <result property="proType" column="PRO_TYPE"/>
  7. <result property="reviOrg" column="REVI_ORG"/>
  8. <result property="pblmType" column="PBLM_TYPE"/>
  9. <result property="pblmPoint" column="PBLM_POINT"/>
  10. <result property="pblmAttach" column="PBLM_ATTACH"/>
  11. <result property="pblmSn" column="PBLM_SN"/>
  12. <result property="orgType" column="ORG_TYPE"/>
  13. <result property="pblmAttachName" column="PBLM_ATTACH_NAME"/>
  14. </resultMap>
  15. <sql id="table_columns">
  16. TYPE,
  17. PRO_TYPE,
  18. REVI_ORG,
  19. PBLM_TYPE,
  20. PBLM_POINT,
  21. PBLM_ATTACH,
  22. PBLM_SN,ORG_TYPE,PBLM_ATTACH_NAME
  23. </sql>
  24. <sql id="entity_properties">
  25. #{type},
  26. #{proType},
  27. #{reviOrg},
  28. #{pblmType},
  29. #{pblmPoint},
  30. #{pblmAttach},
  31. #{pblmSn},#{orgType},#{pblmAttachName}
  32. </sql>
  33. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  34. <sql id="page_where">
  35. <trim prefix="where" prefixOverrides="and | or ">
  36. <if test="proType != null and proType != ''">and PRO_TYPE = #{proType}</if>
  37. <if test="reviOrg != null and reviOrg != ''">and REVI_ORG = #{reviOrg}</if>
  38. <if test="pblmType != null and pblmType != ''">and PBLM_TYPE = #{pblmType}</if>
  39. <if test="pblmPoint != null and pblmPoint != ''">and PBLM_POINT = #{pblmPoint}</if>
  40. <if test="pblmAttach != null and pblmAttach != ''">and PBLM_ATTACH = #{pblmAttach}</if>
  41. <if test="pblmSn != null and pblmSn != ''">and PBLM_SN = #{pblmSn}</if>
  42. <if test="orgType != null and orgType != ''">and ORG_TYPE = #{orgType}</if>
  43. </trim>
  44. </sql>
  45. <select id="convertGroup" resultMap="objKeyPblmRelResultMap"
  46. parameterType="cn.com.goldenwater.dcproj.param.ObjKeyPblmRelParam">
  47. select
  48. pblm_type, pblm_point, l.pro_type, l.revi_org,
  49. LISTAGG(l.pblm_attach, ',') as pblm_attach,
  50. LISTAGG(l.pblm_attach_name, ',') as pblm_attach_name,
  51. LISTAGG(l.pblm_sn, ',') as pblm_sn
  52. from obj_key_pblm_rel l
  53. where l.pro_type=#{proType}
  54. <if test='ptype == "100"'>and PBLM_ATTACH not like '2-%'</if>
  55. <if test='ptype == "99"'>and PBLM_ATTACH like '2-%'</if>
  56. <if test="orgType != null and orgType != ''">and l.org_Type=#{orgType}</if>
  57. <if test="reviOrg != null and reviOrg != ''">and REVI_ORG = #{reviOrg}</if>
  58. <if test="pblmType != null and pblmType != ''">and pblm_Type = #{pblmType}</if>
  59. <if test="pblmPoint != null and pblmPoint != ''">and pblm_Point = #{pblmPoint}</if>
  60. group by l.pro_type,l.pblm_point, l.pblm_type,l.revi_org,l.pblm_attach,l.pblm_attach_name,l.pblm_sn
  61. </select>
  62. <select id="findOrgType" resultType="cn.com.goldenwater.dcproj.dto.BisInspKeyRegSecDicDto">
  63. select revi_org as dic_value, org_type as dic_key from obj_key_pblm_rel l where l.org_type is not null group by
  64. revi_org,org_type order by org_type
  65. </select>
  66. <select id="get" resultMap="objKeyPblmRelResultMap" parameterType="String">
  67. select
  68. <include refid="table_columns"/>
  69. from obj_key_pblm_rel where ID = #{id}
  70. </select>
  71. <select id="getBy" resultMap="objKeyPblmRelResultMap">
  72. select
  73. <include refid="table_columns"/>
  74. from obj_key_pblm_rel
  75. <include refid="page_where"/>
  76. </select>
  77. <select id="findAll" resultMap="objKeyPblmRelResultMap">
  78. select
  79. <include refid="table_columns"/>
  80. from obj_key_pblm_rel
  81. </select>
  82. <select id="findProType" resultMap="objKeyPblmRelResultMap" parameterType="java.lang.String">
  83. select revi_org, org_type from obj_key_pblm_rel l
  84. where l.pro_type=#{proType} group by revi_org,org_type
  85. </select>
  86. <select id="findList" resultMap="objKeyPblmRelResultMap">
  87. SELECT * FROM (
  88. select
  89. <include refid="table_columns"/>
  90. from obj_key_pblm_rel
  91. <include refid="page_where"/>
  92. ) A
  93. <where>
  94. <if test='ptype == "100"'>and PBLM_ATTACH not like '2-%'</if>
  95. <if test='ptype == "99"'>and PBLM_ATTACH like '2-%'</if>
  96. </where>
  97. </select>
  98. <select id="findPblmType" resultMap="objKeyPblmRelResultMap"
  99. parameterType="cn.com.goldenwater.dcproj.param.KeyRegParam">
  100. select distinct pblm_type
  101. from obj_key_pblm_rel l
  102. where
  103. l.pro_type=#{proType}
  104. <if test='ptype == "100"'>and PBLM_ATTACH not like '2-%'</if>
  105. <if test='ptype == "99"'>and PBLM_ATTACH like '2-%'</if>
  106. <if test="orgType != null and orgType != ''">
  107. and l.org_type=#{orgType}
  108. </if>
  109. <if test="reviOrg !=null and reviOrg!=''">
  110. and l.revi_Org=#{reviOrg}
  111. </if>
  112. </select>
  113. <select id="selectCount" resultType="int">
  114. select count(ID) from obj_key_pblm_rel
  115. <include refid="page_where"/>
  116. </select>
  117. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.ObjKeyPblmRel">
  118. insert into obj_key_pblm_rel(
  119. <include refid="table_columns"/>
  120. )
  121. values (
  122. <include refid="entity_properties"/>
  123. )
  124. </insert>
  125. <delete id="delete" parameterType="java.lang.String">
  126. delete from obj_key_pblm_rel where ID = #{id}
  127. </delete>
  128. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.ObjKeyPblmRel">
  129. delete from obj_key_pblm_rel
  130. <include refid="page_where"/>
  131. </delete>
  132. <update id="deleteInFlag" parameterType="java.lang.String">
  133. update obj_key_pblm_rel set flag_valid = 0 where ID = #{id}
  134. </update>
  135. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.ObjKeyPblmRel">
  136. update obj_key_pblm_rel
  137. <trim prefix="set" suffixOverrides=",">
  138. <if test="proType != null and proType != ''">PRO_TYPE = #{proType},</if>
  139. <if test="reviOrg != null and reviOrg != ''">REVI_ORG = #{reviOrg},</if>
  140. <if test="pblmType != null and pblmType != ''">PBLM_TYPE = #{pblmType},</if>
  141. <if test="pblmPoint != null and pblmPoint != ''">PBLM_POINT = #{pblmPoint},</if>
  142. <if test="pblmAttach != null and pblmAttach != ''">PBLM_ATTACH = #{pblmAttach},</if>
  143. <if test="orgType != null and orgType != ''">ORG_TYPE = #{orgType},</if>
  144. <if test="pblmSn != null and pblmSn != ''">PBLM_SN = #{pblmSn},</if>
  145. </trim>
  146. <where>ID = #{id}</where>
  147. </update>
  148. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.ObjKeyPblmRel">
  149. update obj_key_pblm_rel
  150. <trim prefix="set" suffixOverrides=",">
  151. <if test="proType != null and proType != ''">PRO_TYPE = #{proType},</if>
  152. <if test="reviOrg != null and reviOrg != ''">REVI_ORG = #{reviOrg},</if>
  153. <if test="pblmType != null and pblmType != ''">PBLM_TYPE = #{pblmType},</if>
  154. <if test="pblmPoint != null and pblmPoint != ''">PBLM_POINT = #{pblmPoint},</if>
  155. <if test="pblmAttach != null and pblmAttach != ''">PBLM_ATTACH = #{pblmAttach},</if>
  156. <if test="pblmSn != null and pblmSn != ''">PBLM_SN = #{pblmSn},</if>
  157. <if test="orgType != null and orgType != ''">ORG_TYPE = #{orgType},</if>
  158. </trim>
  159. <include refid="page_where"/>
  160. </update>
  161. <!-- 其他自定义SQL -->
  162. </mapper>