2a1ab7242aee6cb283bb38fdaeaf3dc6bde231c2.svn-base 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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.BisInspMtprggdDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspMtprggd" id="bisInspMtprggdResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="unitName" column="UNIT_NAME"/>
  7. <result property="year" column="YEAR"/>
  8. <result property="mnth" column="MNTH"/>
  9. <result property="idx" column="IDX"/>
  10. <result property="pname" column="PNAME"/>
  11. <result property="ptype" column="PTYPE"/>
  12. <result property="tm" column="TM"/>
  13. <result property="prjSize" column="PRJ_SIZE"/>
  14. <result property="depSize" column="DEP_SIZE"/>
  15. <result property="chkSize" column="CHK_SIZE"/>
  16. <result property="leadSize" column="LEAD_SIZE"/>
  17. <result property="chkDaySize" column="CHK_DAY_SIZE"/>
  18. <result property="feedBackSize" column="FEED_BACK_SIZE"/>
  19. <result property="pblmSize" column="PBLM_SIZE"/>
  20. <result property="mendSize" column="MEND_SIZE"/>
  21. <result property="mendCmpSize" column="MEND_CMP_SIZE"/>
  22. <result property="mendCmpTatSize" column="MEND_CMP_TAT_SIZE"/>
  23. <result property="mendCmpRatio" column="MEND_CMP_RATIO"/>
  24. <result property="accuntDep" column="ACCUNT_DEP"/>
  25. <result property="accuntText" column="ACCUNT_TEXT"/>
  26. <result property="acuntTm" column="ACUNT_TM"/>
  27. <result property="accuntNote" column="ACCUNT_NOTE"/>
  28. <result property="persId" column="PERS_ID"/>
  29. <result property="intm" column="INTM"/>
  30. <result property="uptm" column="UPTM"/>
  31. <result property="dataStat" column="DATA_STAT"/>
  32. <result property="adCode" column="AD_CODE"/>
  33. <result property="chkYearId" column="CHK_YEAR_ID"/>
  34. <result property="em" column="EM"/>
  35. </resultMap>
  36. <sql id="table_columns">
  37. ID,
  38. CHK_YEAR_ID,
  39. UNIT_NAME,
  40. YEAR,
  41. MNTH,
  42. IDX,
  43. PNAME,
  44. PTYPE,
  45. TM,
  46. PRJ_SIZE,
  47. DEP_SIZE,
  48. CHK_SIZE,
  49. LEAD_SIZE,
  50. CHK_DAY_SIZE,
  51. FEED_BACK_SIZE,
  52. PBLM_SIZE,
  53. MEND_SIZE,
  54. MEND_CMP_SIZE,
  55. MEND_CMP_TAT_SIZE,
  56. MEND_CMP_RATIO,
  57. ACCUNT_DEP,
  58. ACCUNT_TEXT,
  59. ACUNT_TM,
  60. ACCUNT_NOTE,
  61. PERS_ID,
  62. INTM,
  63. UPTM,
  64. DATA_STAT,
  65. AD_CODE,
  66. EM
  67. </sql>
  68. <sql id="entity_properties">
  69. #{id},
  70. #{chkYearId},
  71. #{unitName},
  72. #{year},
  73. #{mnth},
  74. #{idx},
  75. #{pname},
  76. #{ptype},
  77. #{tm},
  78. #{prjSize},
  79. #{depSize},
  80. #{chkSize},
  81. #{leadSize},
  82. #{chkDaySize},
  83. #{feedBackSize},
  84. #{pblmSize},
  85. #{mendSize},
  86. #{mendCmpSize},
  87. #{mendCmpTatSize},
  88. #{mendCmpRatio},
  89. #{accuntDep},
  90. #{accuntText},
  91. #{acuntTm},
  92. #{accuntNote},
  93. #{persId},
  94. #{intm},
  95. #{uptm},
  96. #{dataStat},
  97. #{adCode},
  98. #{em}
  99. </sql>
  100. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  101. <sql id="page_where">
  102. <trim prefix="where" prefixOverrides="and | or ">
  103. <if test="unitName != null and unitName != ''">and UNIT_NAME = #{unitName}</if>
  104. <if test="year != null and year != ''">and YEAR = #{year}</if>
  105. <if test="mnth != null and mnth != ''">and MNTH = #{mnth}</if>
  106. <if test="idx != null and idx != ''">and IDX = #{idx}</if>
  107. <if test="pname != null and pname != ''">and PNAME = #{pname}</if>
  108. <if test="ptype != null and ptype != ''">and PTYPE = #{ptype}</if>
  109. <if test="tm != null">TM = #{tm}</if>
  110. <if test="em != null">EM = #{em}</if>
  111. <if test="prjSize != null and prjSize != ''">and PRJ_SIZE = #{prjSize}</if>
  112. <if test="depSize != null and depSize != ''">and DEP_SIZE = #{depSize}</if>
  113. <if test="chkSize != null and chkSize != ''">and CHK_SIZE = #{chkSize}</if>
  114. <if test="leadSize != null and leadSize != ''">and LEAD_SIZE = #{leadSize}</if>
  115. <if test="chkDaySize != null and chkDaySize != ''">and CHK_DAY_SIZE = #{chkDaySize}</if>
  116. <if test="feedBackSize != null and feedBackSize != ''">and FEED_BACK_SIZE = #{feedBackSize}</if>
  117. <if test="pblmSize != null and pblmSize != ''">and PBLM_SIZE = #{pblmSize}</if>
  118. <if test="mendSize != null and mendSize != ''">and MEND_SIZE = #{mendSize}</if>
  119. <if test="mendCmpSize != null and mendCmpSize != ''">and MEND_CMP_SIZE = #{mendCmpSize}</if>
  120. <if test="mendCmpTatSize != null and mendCmpTatSize != ''">and MEND_CMP_TAT_SIZE = #{mendCmpTatSize}</if>
  121. <if test="mendCmpRatio != null and mendCmpRatio != ''">and MEND_CMP_RATIO = #{mendCmpRatio}</if>
  122. <if test="accuntDep != null and accuntDep != ''">and ACCUNT_DEP = #{accuntDep}</if>
  123. <if test="accuntText != null and accuntText != ''">and ACCUNT_TEXT = #{accuntText}</if>
  124. <if test="acuntTm != null">and ACUNT_TM = #{acuntTm}</if>
  125. <if test="accuntNote != null and accuntNote != ''">and ACCUNT_NOTE = #{accuntNote}</if>
  126. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  127. <if test="intm != null">and INTM = #{intm}</if>
  128. <if test="uptm != null">and UPTM = #{uptm}</if>
  129. <if test="adCode != null and adCode != ''">and AD_CODE LIKE '${adCode}%'</if>
  130. and DATA_STAT = '0'
  131. and CHK_YEAR_ID = #{chkYearId}
  132. </trim>
  133. </sql>
  134. <select id="get" resultMap="bisInspMtprggdResultMap" parameterType="String" >
  135. select <include refid="table_columns" /> from BIS_INSP_MTPRGGD where ID = #{id}
  136. </select>
  137. <select id="getBy" resultMap="bisInspMtprggdResultMap">
  138. select <include refid="table_columns" /> from BIS_INSP_MTPRGGD <include refid="page_where" />
  139. </select>
  140. <select id="findAll" resultMap="bisInspMtprggdResultMap">
  141. select <include refid="table_columns" /> from BIS_INSP_MTPRGGD
  142. </select>
  143. <select id="findList" resultMap="bisInspMtprggdResultMap">
  144. select <include refid="table_columns" /> from BIS_INSP_MTPRGGD <include refid="page_where" />
  145. </select>
  146. <select id="findListByMonth" resultMap="bisInspMtprggdResultMap">
  147. select <include refid="table_columns" /> from BIS_INSP_MTPRGGD where 1=1
  148. <if test="adCode != null and adCode != ''">and AD_CODE LIKE '${adCode}%'</if>
  149. <if test="sttm != null and sttm != ''">and CONCAT(CONCAT(year,'-'),(case when mnth>9 then cast(mnth as char) else concat('0', cast(mnth as char) ) end)) &gt;= #{sttm}</if>
  150. <if test="entm != null and entm != ''">and CONCAT(CONCAT(year,'-'),(case when mnth>9 then cast(mnth as char) else concat('0', cast(mnth as char) ) end)) &lt;= #{entm}</if>
  151. and DATA_STAT = '0'
  152. </select>
  153. <select id="selectCount" resultType="int" >
  154. select count(ID) from BIS_INSP_MTPRGGD <include refid="page_where" />
  155. </select>
  156. <select id="getMonthRefrom" resultType="java.util.Map" parameterType="java.util.Map">
  157. SELECT * FROM (SELECT
  158. BA. ID ID,
  159. BA.PNM groupName,
  160. (SELECT CODE FROM ATT_INSP_TYPE WHERE substr(BA.ID,0,3)= CODE) OBJTYPE,
  161. (SELECT NAME FROM ATT_INSP_TYPE WHERE substr(BA.ID,0,3)= CODE) OBJNAME,
  162. to_char(BA.STTM,'yyyy-mm-dd') sttm,
  163. to_char(BA.ENTM,'yyyy-mm-dd') entm,
  164. BIA1.PNM BATCH,
  165. BIA1.CHK_FORM chkForm,
  166. BIA1.LEAD_DEP leadDep,
  167. BIA1.PROVINCE province,
  168. (
  169. SELECT
  170. listagg (ad_name, ',') WITHIN GROUP (ORDER BY ID) AS chkArea
  171. FROM
  172. BIS_INSP_SEL_AREA
  173. WHERE
  174. ID = BA. ID
  175. GROUP BY
  176. ID
  177. ) chkArea,
  178. (
  179. SELECT
  180. COUNT (1)
  181. FROM
  182. BIS_INSP_ALL_OBJ
  183. WHERE
  184. ID = BA. ID
  185. ) COUNT,
  186. (SELECT
  187. listagg (pers_name, ',') WITHIN GROUP (ORDER BY ID) AS persName
  188. FROM (SELECT
  189. id,pers_name
  190. FROM
  191. BIS_INSP_ALL_RLATION b
  192. LEFT JOIN BIS_INSP_ALL_RLATION_PERS A ON A .guid = b.PERSID
  193. WHERE
  194. b.pertype = '1' AND length(b.id)=12) where ID = BA. ID
  195. GROUP BY
  196. ID) persName,
  197. (SELECT
  198. listagg (mobilenumb, ',') WITHIN GROUP (ORDER BY ID) AS mobilenumb
  199. FROM (SELECT
  200. id,mobilenumb
  201. FROM
  202. BIS_INSP_ALL_RLATION b
  203. LEFT JOIN BIS_INSP_ALL_RLATION_PERS A ON A .guid = b.PERSID
  204. WHERE
  205. b.pertype = '1' AND length(b.id)=12) where ID = BA. ID
  206. GROUP BY
  207. ID) mobilenumb
  208. FROM
  209. (
  210. SELECT
  211. BIA. ID,
  212. BIA.PID,
  213. BIA.PNM,
  214. BIA.STTM,
  215. BIA.ENTM
  216. FROM
  217. (
  218. SELECT
  219. ID
  220. FROM
  221. BIS_INSP_ALL
  222. where length(ID)=12
  223. GROUP BY
  224. ID
  225. ) NG
  226. LEFT JOIN BIS_INSP_ALL BIA ON NG. ID = BIA. ID
  227. ) BA
  228. LEFT JOIN BIS_INSP_ALL BIA1 ON BA.PID = BIA1. ID
  229. WHERE
  230. BA. ID IS NOT NULL
  231. ORDER BY
  232. BA. ID) WHERE 1=1
  233. <if test="sttm!=null and sttm!='' and entm!=null and entm!=''">
  234. and substr(STTM,0,7) &gt;= #{sttm}
  235. and substr(ENTM,0,7) &lt;= #{entm}
  236. </if>
  237. <if test="objTypes != null and objTypes != ''">
  238. and OBJTYPE in
  239. <foreach collection="objTypes.split(',')" item="item" index="index" open="(" separator="," close=")" >
  240. #{item}
  241. </foreach>
  242. </if>
  243. <if test="groupName!=null and groupName!=''">
  244. and GROUPNAME LIKE '%${groupName}%'
  245. </if>
  246. <if test="chkArea!=null and chkArea!=''">
  247. and CHKAREA LIKE '%${chkArea}%'
  248. </if>
  249. <if test="adCode!=null and adCode!=''">
  250. and PROVINCE LIKE '${adCode}%'
  251. </if>
  252. order by STTM DESC
  253. </select>
  254. <select id="getObjNames" resultType="java.util.Map" parameterType="java.lang.String">
  255. select ID id,NM nm FROM BIS_INSP_ALL_OBJ WHERE ID = #{id}
  256. </select>
  257. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspMtprggd">
  258. insert into BIS_INSP_MTPRGGD( <include refid="table_columns" /> )
  259. values ( <include refid="entity_properties" /> )
  260. </insert>
  261. <delete id="delete" parameterType="java.lang.String">
  262. update BIS_INSP_MTPRGGD set DATA_STAT='9' where ID = #{id}
  263. </delete>
  264. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspMtprggd">
  265. delete from BIS_INSP_MTPRGGD <include refid="page_where" />
  266. </delete>
  267. <update id="deleteInFlag" parameterType="java.lang.String">
  268. update BIS_INSP_MTPRGGD set flag_valid = 0 where ID = #{id}
  269. </update>
  270. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspMtprggd">
  271. update BIS_INSP_MTPRGGD
  272. <trim prefix="set" suffixOverrides=",">
  273. <if test="unitName != null and unitName != ''">UNIT_NAME = #{unitName},</if>
  274. <if test="year != null and year != ''">YEAR = #{year},</if>
  275. <if test="mnth != null and mnth != ''">MNTH = #{mnth},</if>
  276. <if test="idx != null and idx != ''">IDX = #{idx},</if>
  277. <if test="pname != null and pname != ''">PNAME = #{pname},</if>
  278. <if test="ptype != null and ptype != ''">PTYPE = #{ptype},</if>
  279. <if test="tm != null">TM = #{tm},</if>
  280. <if test="em != null">EM = #{em},</if>
  281. <if test="prjSize != null and prjSize != ''">PRJ_SIZE = #{prjSize},</if>
  282. <if test="depSize != null and depSize != ''">DEP_SIZE = #{depSize},</if>
  283. <if test="chkSize != null and chkSize != ''">CHK_SIZE = #{chkSize},</if>
  284. <if test="leadSize != null and leadSize != ''">LEAD_SIZE = #{leadSize},</if>
  285. <if test="chkDaySize != null and chkDaySize != ''">CHK_DAY_SIZE = #{chkDaySize},</if>
  286. <if test="feedBackSize != null and feedBackSize != ''">FEED_BACK_SIZE = #{feedBackSize},</if>
  287. <if test="pblmSize != null and pblmSize != ''">PBLM_SIZE = #{pblmSize},</if>
  288. <if test="mendSize != null and mendSize != ''">MEND_SIZE = #{mendSize},</if>
  289. <if test="mendCmpSize != null and mendCmpSize != ''">MEND_CMP_SIZE = #{mendCmpSize},</if>
  290. <if test="mendCmpTatSize != null and mendCmpTatSize != ''">MEND_CMP_TAT_SIZE = #{mendCmpTatSize},</if>
  291. <if test="mendCmpRatio != null and mendCmpRatio != ''">MEND_CMP_RATIO = #{mendCmpRatio},</if>
  292. <if test="accuntDep != null and accuntDep != ''">ACCUNT_DEP = #{accuntDep},</if>
  293. <if test="accuntText != null and accuntText != ''">ACCUNT_TEXT = #{accuntText},</if>
  294. <if test="acuntTm != null">ACUNT_TM = #{acuntTm},</if>
  295. <if test="accuntNote != null and accuntNote != ''">ACCUNT_NOTE = #{accuntNote},</if>
  296. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  297. <if test="intm != null">INTM = #{intm},</if>
  298. <if test="uptm != null">UPTM = #{uptm},</if>
  299. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  300. </trim>
  301. <where>ID = #{id}</where>
  302. </update>
  303. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspMtprggd">
  304. update BIS_INSP_MTPRGGD
  305. <trim prefix="set" suffixOverrides=",">
  306. <if test="unitName != null and unitName != ''">UNIT_NAME = #{unitName},</if>
  307. <if test="year != null and year != ''">YEAR = #{year},</if>
  308. <if test="mnth != null and mnth != ''">MNTH = #{mnth},</if>
  309. <if test="idx != null and idx != ''">IDX = #{idx},</if>
  310. <if test="pname != null and pname != ''">PNAME = #{pname},</if>
  311. <if test="ptype != null and ptype != ''">PTYPE = #{ptype},</if>
  312. <if test="tm != null">TM = #{tm},</if>
  313. <if test="em != null">EM = #{em},</if>
  314. <if test="prjSize != null and prjSize != ''">PRJ_SIZE = #{prjSize},</if>
  315. <if test="depSize != null and depSize != ''">DEP_SIZE = #{depSize},</if>
  316. <if test="chkSize != null and chkSize != ''">CHK_SIZE = #{chkSize},</if>
  317. <if test="leadSize != null and leadSize != ''">LEAD_SIZE = #{leadSize},</if>
  318. <if test="chkDaySize != null and chkDaySize != ''">CHK_DAY_SIZE = #{chkDaySize},</if>
  319. <if test="feedBackSize != null and feedBackSize != ''">FEED_BACK_SIZE = #{feedBackSize},</if>
  320. <if test="pblmSize != null and pblmSize != ''">PBLM_SIZE = #{pblmSize},</if>
  321. <if test="mendSize != null and mendSize != ''">MEND_SIZE = #{mendSize},</if>
  322. <if test="mendCmpSize != null and mendCmpSize != ''">MEND_CMP_SIZE = #{mendCmpSize},</if>
  323. <if test="mendCmpTatSize != null and mendCmpTatSize != ''">MEND_CMP_TAT_SIZE = #{mendCmpTatSize},</if>
  324. <if test="mendCmpRatio != null and mendCmpRatio != ''">MEND_CMP_RATIO = #{mendCmpRatio},</if>
  325. <if test="accuntDep != null and accuntDep != ''">ACCUNT_DEP = #{accuntDep},</if>
  326. <if test="accuntText != null and accuntText != ''">ACCUNT_TEXT = #{accuntText},</if>
  327. <if test="acuntTm != null">ACUNT_TM = #{acuntTm},</if>
  328. <if test="accuntNote != null and accuntNote != ''">ACCUNT_NOTE = #{accuntNote},</if>
  329. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  330. <if test="intm != null">INTM = #{intm},</if>
  331. <if test="uptm != null">UPTM = #{uptm},</if>
  332. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  333. </trim>
  334. <include refid="page_where" />
  335. </update>
  336. <!-- 其他自定义SQL -->
  337. </mapper>