BisInspQymtenDao.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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.BisInspQymtenDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspQymten" id="bisInspQymtenResultMap">
  5. <result property="msrScore" column="MSR_SCORE"/>
  6. <result property="id" column="ID"/>
  7. <result property="objId" column="OBJ_ID"/>
  8. <result property="nm" column="NM"/>
  9. <result property="adCode" column="AD_CODE"/>
  10. <result property="adName" column="AD_NAME"/>
  11. <result property="state" column="STATE"/>
  12. <result property="msrState" column="MSR_STATE"/>
  13. <result property="persId" column="PERS_ID"/>
  14. <result property="intm" column="INTM"/>
  15. <result property="uptm" column="UPTM"/>
  16. <result property="note" column="NOTE"/>
  17. <result property="dataStat" column="DATA_STAT"/>
  18. </resultMap>
  19. <sql id="table_columns">
  20. MSR_SCORE,
  21. ID,
  22. OBJ_ID,
  23. NM,
  24. AD_CODE,
  25. AD_NAME,
  26. STATE,
  27. MSR_STATE,
  28. PERS_ID,
  29. INTM,
  30. UPTM,
  31. NOTE,
  32. DATA_STAT
  33. </sql>
  34. <sql id="entity_properties">
  35. #{msrScore},
  36. #{id},
  37. #{objId},
  38. #{nm},
  39. #{adCode},
  40. #{adName},
  41. #{state},
  42. #{msrState},
  43. #{persId},
  44. #{intm},
  45. #{uptm},
  46. #{note},
  47. #{dataStat}
  48. </sql>
  49. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  50. <sql id="page_where">
  51. <trim prefix="where" prefixOverrides="and | or ">
  52. <if test="msrScore != null and msrScore != ''">
  53. and MSR_SCORE = #{msrScore}
  54. </if>
  55. <if test="objId != null and objId != ''">
  56. and OBJ_ID = #{objId}
  57. </if>
  58. <if test="nm != null and nm != ''">
  59. and NM = #{nm}
  60. </if>
  61. <if test="adCode != null and adCode != ''">
  62. and AD_CODE = #{adCode}
  63. </if>
  64. <if test="adName != null and adName != ''">
  65. and AD_NAME = #{adName}
  66. </if>
  67. <if test="state != null and state != ''">
  68. and STATE = #{state}
  69. </if>
  70. <if test="msrState != null and msrState != ''">
  71. and MSR_STATE = #{msrState}
  72. </if>
  73. <if test="persId != null and persId != ''">
  74. and PERS_ID = #{persId}
  75. </if>
  76. <if test="intm != null">
  77. and INTM = #{intm}
  78. </if>
  79. <if test="uptm != null">
  80. and UPTM = #{uptm}
  81. </if>
  82. <if test="note != null and note != ''">
  83. and NOTE = #{note}
  84. </if>
  85. <if test="dataStat != null and dataStat != ''">
  86. and DATA_STAT = #{dataStat}
  87. </if>
  88. and DATA_STAT='0'
  89. </trim>
  90. </sql>
  91. <select id="get" resultMap="bisInspQymtenResultMap" parameterType="String">
  92. select
  93. <include refid="table_columns"/>
  94. from BIS_INSP_QYMTEN where ID = #{id}
  95. </select>
  96. <select id="getBy" resultMap="bisInspQymtenResultMap">
  97. select
  98. <include refid="table_columns"/>
  99. from BIS_INSP_QYMTEN
  100. <include refid="page_where"/>
  101. </select>
  102. <select id="findAll" resultMap="bisInspQymtenResultMap">
  103. select
  104. <include refid="table_columns"/>
  105. from BIS_INSP_QYMTEN
  106. </select>
  107. <select id="findList" resultMap="bisInspQymtenResultMap">
  108. select
  109. <include refid="table_columns"/>
  110. from BIS_INSP_QYMTEN
  111. <include refid="page_where"/>
  112. </select>
  113. <select id="selectCount" resultType="int">
  114. select count(ID) from BIS_INSP_QYMTEN
  115. <include refid="page_where"/>
  116. </select>
  117. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspQymten">
  118. insert into BIS_INSP_QYMTEN(
  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. update BIS_INSP_QYMTEN set DATA_STAT='9' where ID = #{id}
  127. </delete>
  128. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspQymten">
  129. update BIS_INSP_QYMTEN set DATA_STAT='9'
  130. <include refid="page_where"/>
  131. </delete>
  132. <update id="deleteInFlag" parameterType="java.lang.String">
  133. update BIS_INSP_QYMTEN set DATA_STAT = '9' where ID = #{id}
  134. </update>
  135. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspQymten">
  136. update BIS_INSP_QYMTEN
  137. <trim prefix="set" suffixOverrides=",">
  138. <if test="msrScore != null and msrScore != ''">MSR_SCORE
  139. = #{msrScore},
  140. </if>
  141. <if test="objId != null and objId != ''">OBJ_ID
  142. = #{objId},
  143. </if>
  144. <if test="nm != null and nm != ''">NM
  145. = #{nm},
  146. </if>
  147. <if test="adCode != null and adCode != ''">AD_CODE
  148. = #{adCode},
  149. </if>
  150. <if test="adName != null and adName != ''">AD_NAME
  151. = #{adName},
  152. </if>
  153. <if test="state != null and state != ''">STATE
  154. = #{state},
  155. </if>
  156. <if test="msrState != null and msrState != ''">MSR_STATE
  157. = #{msrState},
  158. </if>
  159. <if test="persId != null and persId != ''">PERS_ID
  160. = #{persId},
  161. </if>
  162. <if test="intm != null">INTM
  163. = #{intm},
  164. </if>
  165. <if test="uptm != null">UPTM
  166. = #{uptm},
  167. </if>
  168. <if test="note != null and note != ''">NOTE
  169. = #{note},
  170. </if>
  171. <if test="dataStat != null and dataStat != ''">DATA_STAT
  172. = #{dataStat},
  173. </if>
  174. </trim>
  175. <where>ID = #{id}</where>
  176. </update>
  177. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspQymten">
  178. update BIS_INSP_QYMTEN
  179. <trim prefix="set" suffixOverrides=",">
  180. <if test="msrScore != null and msrScore != ''">MSR_SCORE
  181. = #{msrScore},
  182. </if>
  183. <if test="objId != null and objId != ''">OBJ_ID
  184. = #{objId},
  185. </if>
  186. <if test="nm != null and nm != ''">NM
  187. = #{nm},
  188. </if>
  189. <if test="adCode != null and adCode != ''">AD_CODE
  190. = #{adCode},
  191. </if>
  192. <if test="adName != null and adName != ''">AD_NAME
  193. = #{adName},
  194. </if>
  195. <if test="state != null and state != ''">STATE
  196. = #{state},
  197. </if>
  198. <if test="msrState != null and msrState != ''">MSR_STATE
  199. = #{msrState},
  200. </if>
  201. <if test="persId != null and persId != ''">PERS_ID
  202. = #{persId},
  203. </if>
  204. <if test="intm != null">INTM
  205. = #{intm},
  206. </if>
  207. <if test="uptm != null">UPTM
  208. = #{uptm},
  209. </if>
  210. <if test="note != null and note != ''">NOTE
  211. = #{note},
  212. </if>
  213. <if test="dataStat != null and dataStat != ''">DATA_STAT
  214. = #{dataStat},
  215. </if>
  216. </trim>
  217. <include refid="page_where"/>
  218. </update>
  219. <!-- 其他自定义SQL -->
  220. <select id="findQymtenPage" resultType="cn.com.goldenwater.dcproj.dto.BisInspQymtenDto">
  221. SELECT * FROM (
  222. select
  223. A.CODE, A.CODE as baseId, A.ID nodeId,
  224. <!--A.NM, nm的值换成AD_NAME-->
  225. A.ptype,
  226. ia.pnm groupName, aw.AD_FULL_NAME,
  227. B.ID, B.id as rgstrId,
  228. (case when b.STATE is null then '0' else b.state end) STATE,
  229. B.OBJ_ID,
  230. B.AD_CODE,
  231. B.AD_NAME,
  232. B.AD_NAME AS NM,
  233. B.MSR_STATE,
  234. B.PERS_ID,
  235. B.INTM,
  236. B.UPTM,
  237. B.NOTE,
  238. B.DATA_STAT,
  239. B.MSR_SCORE
  240. from BIS_INSP_ALL_OBJ A
  241. JOIN BIS_INSP_QYMTEN B ON A.OBJ_ID=B.OBJ_ID
  242. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  243. LEFT JOIN ATT_AD_BASE AW ON B.AD_CODE = AW.AD_CODE
  244. WHERE A.ptype = #{pType}
  245. <if test="adCodes == null or adCodes == ''">
  246. <choose>
  247. <when test='isAll == "1"'></when>
  248. <otherwise>
  249. and
  250. A.Id in(
  251. select distinct id from(
  252. SELECT P.id FROM BIS_INSP_ALL P START WITH P.PID IN (SELECT id FROM BIS_INSP_ALL_RLATION A
  253. WHERE A.PERSID = #{presId} and TYPE = #{pType} and length(id) in (3,6,9))
  254. CONNECT BY P.PID = PRIOR P.ID
  255. union all
  256. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  257. WHERE A.PERSID =#{presId} and TYPE = #{pType} and length(id)=12 )
  258. )
  259. )
  260. </otherwise>
  261. </choose>
  262. </if>
  263. <if test="adCodes !=null and adCodes != ''">
  264. and
  265. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  266. b.ad_code like concat('${item}','%')
  267. </foreach>
  268. </if>
  269. <if test="province != null and province != ''">and B.AD_CODE LIKE '%' || #{province} || '%' </if>
  270. <if test="tabType =='2'.toString()">
  271. AND IA.ENTM &lt; TO_DATE(#{nowTime},'yyyy-MM-dd')+1
  272. </if>
  273. <if test="tabType =='1'.toString()">
  274. AND IA.ENTM &gt;= TO_DATE(#{nowTime},'yyyy-MM-dd')
  275. </if>
  276. ) A WHERE a.PTYPE=#{pType}
  277. <if test="id !=null and id !=''">and a.nodeId like '${id}%'</if>
  278. <if test="plnaId !=null and plnaId !=''">and a.nodeId like '${plnaId}%'</if>
  279. <if test="state !=null and state !=''">and STATE in (${state})</if>
  280. <if test="rsName !=null and rsName !=''">and a.nm like '%${rsName}%'</if>
  281. <if test="nm !=null and nm !=''">and a.nm like '%${nm}%'</if>
  282. <if test="code !=null and code !=''">and a.code = #{code}</if>
  283. <if test="adName != null and adName != ''">and a.AD_FULL_NAME like '%${adName}%'</if>
  284. <if test="sttm != null and sttm != ''">and a.Intm&gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  285. <if test="entm != null and entm != ''">and a.Intm &lt; To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
  286. <if test="groupId != null and groupId != ''">and a.nodeId = #{groupId}</if>
  287. <if test="groupIds != null and groupIds.length &gt; 0">
  288. <foreach collection="groupIds" index="index" item="gId" separator=" OR " open="and (" close=")">
  289. a.nodeId LIKE '${gId}%'
  290. </foreach>
  291. </if>
  292. order by nodeId asc
  293. <if test="orderBy != null and orderBy != ''">
  294. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  295. </if>
  296. </select>
  297. </mapper>