BisInspFundRgstrDao.xml 15 KB

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