da70c9747be00caabedc8efb94cdb721ad8cecc9.svn-base 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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.BisInspEfpRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspEfpRgstr" id="bisInspEfpRgstrResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="objCode" column="OBJ_CODE"/>
  8. <result property="name" column="NAME"/>
  9. <result property="type" column="TYPE"/>
  10. <result property="pro" column="PRO"/>
  11. <result property="bas" column="BAS"/>
  12. <result property="orgId" column="ORG_ID"/>
  13. <result property="note" column="NOTE"/>
  14. <result property="state" column="STATE"/>
  15. <result property="recPersId" column="REC_PERS_ID"/>
  16. <result property="recPers" column="REC_PERS"/>
  17. <result property="recPersTel" column="REC_PERS_TEL"/>
  18. <result property="intm" column="INTM"/>
  19. <result property="uptm" column="UPTM"/>
  20. <result property="planStat" column="PLAN_STAT"/>
  21. <result property="reasonStat" column="REASON_STAT"/>
  22. <result property="proName" column="PRO_NAME"/>
  23. <result property="basName" column="BAS_NAME"/>
  24. </resultMap>
  25. <sql id="table_columns">
  26. PRO_NAME,
  27. BAS_NAME,
  28. PLAN_STAT,
  29. REASON_STAT,
  30. ID,
  31. OBJ_ID,
  32. OBJ_CODE,
  33. NAME,
  34. TYPE,
  35. PRO,
  36. BAS,
  37. ORG_ID,
  38. NOTE,
  39. STATE,
  40. REC_PERS_ID,
  41. REC_PERS,
  42. REC_PERS_TEL,
  43. INTM,
  44. UPTM
  45. </sql>
  46. <sql id="entity_properties">
  47. #{proName},
  48. #{basName},
  49. #{planStat},
  50. #{reasonStat},
  51. #{id},
  52. #{objId},
  53. #{objCode},
  54. #{name},
  55. #{type},
  56. #{pro},
  57. #{bas},
  58. #{orgId},
  59. #{note},
  60. #{state},
  61. #{recPersId},
  62. #{recPers},
  63. #{recPersTel},
  64. #{intm},
  65. #{uptm}
  66. </sql>
  67. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  68. <sql id="page_where">
  69. <trim prefix="where" prefixOverrides="and | or ">
  70. <if test="proName != null and proName != ''">and PRO_NAME = #{proName}</if>
  71. <if test="basName != null and basName != ''">and BAS_NAME = #{basName}</if>
  72. <if test="planStat != null and planStat != ''">and PLAN_STAT = #{planStat}</if>
  73. <if test="reasonStat != null and reasonStat != ''">and REASON_STAT = #{reasonStat}</if>
  74. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  75. <if test="objCode != null and objCode != ''">and OBJ_CODE = #{objCode}</if>
  76. <if test="name != null and name != ''">and NAME = #{name}</if>
  77. <if test="type != null and type != ''">and TYPE = #{type}</if>
  78. <if test="pro != null and pro != ''">and PRO = #{pro}</if>
  79. <if test="bas != null and bas != ''">and BAS = #{bas}</if>
  80. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  81. <if test="note != null and note != ''">and NOTE = #{note}</if>
  82. <if test="state != null and state != ''">and STATE = #{state}</if>
  83. <if test="recPersId != null and recPersId != ''">and REC_PERS_ID = #{recPersId}</if>
  84. <if test="recPers != null and recPers != ''">and REC_PERS = #{recPers}</if>
  85. <if test="recPersTel != null and recPersTel != ''">and REC_PERS_TEL = #{recPersTel}</if>
  86. <if test="intm != null">and INTM = #{intm}</if>
  87. <if test="uptm != null">and UPTM = #{uptm}</if>
  88. </trim>
  89. </sql>
  90. <select id="get" resultMap="bisInspEfpRgstrResultMap" parameterType="String" >
  91. select <include refid="table_columns" /> from BIS_INSP_EFP_RGSTR where ID = #{id}
  92. </select>
  93. <select id="getBy" resultMap="bisInspEfpRgstrResultMap">
  94. select <include refid="table_columns" /> from BIS_INSP_EFP_RGSTR <include refid="page_where" />
  95. </select>
  96. <select id="findAll" resultMap="bisInspEfpRgstrResultMap">
  97. select <include refid="table_columns" /> from BIS_INSP_EFP_RGSTR
  98. </select>
  99. <select id="findList" resultMap="bisInspEfpRgstrResultMap">
  100. select <include refid="table_columns" /> from BIS_INSP_EFP_RGSTR <include refid="page_where" />
  101. </select>
  102. <select id="selectCount" resultType="int" >
  103. select count(ID) from BIS_INSP_EFP_RGSTR <include refid="page_where" />
  104. </select>
  105. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspEfpRgstr">
  106. insert into BIS_INSP_EFP_RGSTR( <include refid="table_columns" /> )
  107. values ( <include refid="entity_properties" /> )
  108. </insert>
  109. <delete id="delete" parameterType="java.lang.String">
  110. delete from BIS_INSP_EFP_RGSTR where ID = #{id}
  111. </delete>
  112. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspEfpRgstr">
  113. delete from BIS_INSP_EFP_RGSTR <include refid="page_where" />
  114. </delete>
  115. <update id="deleteInFlag" parameterType="java.lang.String">
  116. update BIS_INSP_EFP_RGSTR set DATA_STAT = '9' where ID = #{id}
  117. </update>
  118. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspEfpRgstr">
  119. update BIS_INSP_EFP_RGSTR
  120. <trim prefix="set" suffixOverrides=",">
  121. <if test="proName != null and proName != ''">PRO_NAME = #{proName},</if>
  122. <if test="basName != null and basName != ''">BAS_NAME = #{basName},</if>
  123. <if test="planStat != null and planStat != ''">PLAN_STAT = #{planStat},</if>
  124. <if test="reasonStat != null and reasonStat != ''">REASON_STAT = #{reasonStat},</if>
  125. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  126. <if test="objCode != null and objCode != ''">OBJ_CODE = #{objCode},</if>
  127. <if test="name != null and name != ''">NAME = #{name},</if>
  128. <if test="type != null and type != ''">TYPE = #{type},</if>
  129. <if test="pro != null and pro != ''">PRO = #{pro},</if>
  130. <if test="bas != null and bas != ''">BAS = #{bas},</if>
  131. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  132. <if test="note != null and note != ''">NOTE = #{note},</if>
  133. <if test="state != null and state != ''">STATE = #{state},</if>
  134. <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
  135. <if test="recPers != null and recPers != ''">REC_PERS = #{recPers},</if>
  136. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
  137. <if test="intm != null">INTM = #{intm},</if>
  138. <if test="uptm != null">UPTM = #{uptm},</if>
  139. </trim>
  140. <where>ID = #{id}</where>
  141. </update>
  142. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspEfpRgstr">
  143. update BIS_INSP_EFP_RGSTR
  144. <trim prefix="set" suffixOverrides=",">
  145. <if test="proName != null and proName != ''">PRO_NAME = #{proName},</if>
  146. <if test="basName != null and basName != ''">BAS_NAME = #{basName},</if>
  147. <if test="planStat != null and planStat != ''">PLAN_STAT = #{planStat},</if>
  148. <if test="reasonStat != null and reasonStat != ''">REASON_STAT = #{reasonStat},</if>
  149. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  150. <if test="objCode != null and objCode != ''">OBJ_CODE = #{objCode},</if>
  151. <if test="name != null and name != ''">NAME = #{name},</if>
  152. <if test="type != null and type != ''">TYPE = #{type},</if>
  153. <if test="pro != null and pro != ''">PRO = #{pro},</if>
  154. <if test="bas != null and bas != ''">BAS = #{bas},</if>
  155. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  156. <if test="note != null and note != ''">NOTE = #{note},</if>
  157. <if test="state != null and state != ''">STATE = #{state},</if>
  158. <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
  159. <if test="recPers != null and recPers != ''">REC_PERS = #{recPers},</if>
  160. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
  161. <if test="intm != null">INTM = #{intm},</if>
  162. <if test="uptm != null">UPTM = #{uptm},</if>
  163. </trim>
  164. <include refid="page_where" />
  165. </update>
  166. <!-- 其他自定义SQL -->
  167. <select id="findEfpList" parameterType="cn.com.goldenwater.dcproj.param.TypeParam"
  168. resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto">
  169. SELECT * FROM (
  170. select A.CODE,A.ID nodeId,
  171. A.NM,
  172. #{pType} PTYPE,
  173. A.OBJ_ID,B.ID ID,b.id as rgstrId,
  174. (case when b.State is null then '0' else b.state end)STATE
  175. ,B.INTM,b.pro as ad_name,b.type,b.PLAN_STAT,
  176. b.REASON_STAT,
  177. ia.pnm groupName
  178. from BIS_INSP_ALL_OBJ
  179. A LEFT JOIN BIS_INSP_EFP_RGSTR B ON A.OBJ_ID=B.OBJ_ID
  180. LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
  181. where A.ptype= #{pType}
  182. <if test="tabType =='2'.toString()">
  183. and ia.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  184. </if>
  185. <if test="tabType =='1'.toString()">
  186. and ia.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  187. </if>
  188. <if test="adCodes ==null or adCodes ==''">
  189. and
  190. REGEXP_LIKE(
  191. A.Id,'^('||
  192. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  193. <include refid="choseSql"/>
  194. )>0 then
  195. (SELECT LISTAGG(id, '|') as
  196. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  197. <include refid="choseSql"/> GROUP BY PERSID
  198. )
  199. else (select 'non' from dual) end)
  200. ||')')
  201. </if>
  202. ) A WHERE a.PTYPE=#{pType}
  203. <if test="efpType != null and efpType != ''">
  204. and a.type = #{efpType}
  205. </if>
  206. <if test="plnaId !=null and plnaId !=''">
  207. and a.nodeId like '${plnaId}%'
  208. </if>
  209. <if test="state !=null and state !=''">
  210. and STATE in (${state})
  211. </if>
  212. <if test="rsName !=null and rsName !=''">
  213. and a.nm like '%${rsName}%'
  214. </if>
  215. <if test="code !=null and code !=''">
  216. and a.code = #{code}
  217. </if>
  218. <if test="adName != null and adName != ''">and a.adName like '%${adName}%'</if>
  219. <if test="sttm != null and sttm != ''">and a.Intm&gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  220. <if test="entm != null and entm != ''">and a.Intm &lt; To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
  221. <if test="groupId != null and groupId != ''">and a.nodeId = #{groupId}</if>
  222. order by nodeId asc
  223. <if test="orderBy != null and orderBy != ''">
  224. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  225. </if>
  226. </select>
  227. <sql id="choseSql">
  228. <choose>
  229. <when test="province != null and province != ''">
  230. and AD_CODE LIKE '${province}%'
  231. </when>
  232. <otherwise>
  233. and AD_CODE is null
  234. </otherwise>
  235. </choose>
  236. </sql>
  237. <select id="getObjListNotInspGroupId" parameterType="String" resultType="cn.com.goldenwater.dcproj.model.AttEfpBase">
  238. select t.*
  239. from att_efp_base t
  240. where t.id not in (
  241. select CODE from BIS_INSP_ALL_OBJ B where id like concat(#{inspGroupId},'%') and B.obj_type=#{objType}
  242. <choose>
  243. <when test="province !=null and province !=''">
  244. and B.AD_CODE =#{province}
  245. </when>
  246. <otherwise>
  247. and B.AD_CODE is null
  248. </otherwise>
  249. </choose>
  250. )
  251. <if test="adName != null and adName != ''">and t.nm LIKE '%${adName}%'</if>
  252. <if test="adCode != null and adCode != ''">and t.AD_CODE LIKE '${adCode}%'</if>
  253. </select>
  254. <select id="getListByInspGroupIdObjType" parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam"
  255. resultType="cn.com.goldenwater.dcproj.model.AttEfpBase">
  256. select t.*,C.id groupId,C.PNM groupName,B.obj_id,'' as loc
  257. from ATT_efp_BASE t
  258. left join BIS_INSP_ALL_OBJ B
  259. on B.CODE = t.id
  260. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID
  261. and B.ptype = #{objType}
  262. left join BIS_Insp_Efp_RGSTR r on b.obj_id=r.obj_id
  263. where 1 = 1
  264. <if test='isAll == "0"'>and B.ID = #{inspGroupId}</if>
  265. <if test='isAll == "1"'>and B.ID LIKE '${inspGroupId}%'</if>
  266. <if test="adCode != null and adCode != ''">
  267. and t.AD_CODE like '${adCode}%'
  268. </if>
  269. <choose>
  270. <when test="province != null and province != ''">
  271. and B.AD_CODE LIKE '${province}%'
  272. </when>
  273. <otherwise>
  274. and B.AD_CODE is null
  275. </otherwise>
  276. </choose>
  277. </select>
  278. </mapper>