BisInspBidRgstrDao.xml 15 KB

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