PrjProjectDao.xml 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  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="com.liang.dao.PrjProjectDao">
  4. <resultMap type="com.liang.entity.PrjProject" id="PrjProjectMap">
  5. <result property="id" column="ID" jdbcType="INTEGER"/>
  6. <result property="zwmc" column="ZWMC" jdbcType="VARCHAR"/>
  7. <result property="xkfl1" column="XKFL1" jdbcType="VARCHAR"/>
  8. <result property="xkfl2" column="XKFL2" jdbcType="VARCHAR"/>
  9. <result property="xkfl3" column="XKFL3" jdbcType="VARCHAR"/>
  10. <result property="sfgjmmjsxm" column="SFGJMMJSXM" jdbcType="VARCHAR"/>
  11. <result property="ssgmjjhy" column="SSGMJJHY" jdbcType="VARCHAR"/>
  12. <result property="qs" column="QS" jdbcType="TIMESTAMP"/>
  13. <result property="wc" column="WC" jdbcType="TIMESTAMP"/>
  14. <result property="cjrq" column="CJRQ" jdbcType="TIMESTAMP"/>
  15. <result property="xmlx" column="XMLX" jdbcType="VARCHAR"/>
  16. <result property="ywmc" column="YWMC" jdbcType="VARCHAR"/>
  17. <result property="xmmb" column="XMMB" jdbcType="VARCHAR"/>
  18. <result property="qy" column="QY" jdbcType="VARCHAR"/>
  19. <result property="zrs" column="ZRS" jdbcType="INTEGER"/>
  20. <result property="gjzc" column="GJZC" jdbcType="INTEGER"/>
  21. <result property="zjzc" column="ZJZC" jdbcType="INTEGER"/>
  22. <result property="cjzc" column="CJZC" jdbcType="INTEGER"/>
  23. <result property="yjs" column="YJS" jdbcType="INTEGER"/>
  24. <result property="txsm" column="TXSM" jdbcType="VARCHAR"/>
  25. <result property="yjnrjkhzb" column="YJNRJKHZB" jdbcType="VARCHAR"/>
  26. <result property="ygwtsm" column="YGWTSM" jdbcType="VARCHAR"/>
  27. <result property="cjr" column="CJR" jdbcType="INTEGER"/>
  28. <result property="tdi432" column="tdi432" jdbcType="VARCHAR"/>
  29. <result property="sfkybg" column="SFKYBG" jdbcType="VARCHAR"/>
  30. <result property="bm" column="BM" jdbcType="INTEGER"/>
  31. <result property="bm2" column="BM2" jdbcType="VARCHAR"/>
  32. <result property="sfkybg2" column="SFKYBG2" jdbcType="VARCHAR"/>
  33. <result property="fj" column="FJ" jdbcType="VARCHAR"/>
  34. <result property="ssbm" column="SSBM" jdbcType="INTEGER"/>
  35. <result property="erpbh" column="ERPBH" jdbcType="VARCHAR"/>
  36. <result property="spzt" column="SPZT" jdbcType="VARCHAR"/>
  37. <result property="fyly" column="FYLY" jdbcType="VARCHAR"/>
  38. <result property="dkyfzr" column="DKYFZR" jdbcType="VARCHAR"/>
  39. <result property="fj2" column="FJ2" jdbcType="VARCHAR"/>
  40. </resultMap>
  41. <resultMap type="com.liang.entity.FeeManagemant" id="FeeManagementMap">
  42. <result property="id" column="ID" jdbcType="INTEGER"/>
  43. <result property="zwmc" column="ZWMC" jdbcType="VARCHAR"/>
  44. <result property="erpbh" column="ERPBH" jdbcType="VARCHAR"/>
  45. <result property="xmlx" column="XMLX" jdbcType="VARCHAR"/>
  46. <result property="xmlxmc" column="XMLXMC" jdbcType="VARCHAR"/>
  47. <result property="xmfzrxm" column="XMFZRXM" jdbcType="VARCHAR"/>
  48. <result property="ssbmmc" column="SSBMMC" jdbcType="VARCHAR"/>
  49. <result property="nf" column="NF" jdbcType="VARCHAR"/>
  50. <result property="ysje" column="YSJE" jdbcType="NUMERIC"/>
  51. <result property="xmz" column="XMZ" jdbcType="NUMERIC"/>
  52. <result property="sqje" column="SQJE" jdbcType="NUMERIC"/>
  53. <result property="bzje" column="BZJE" jdbcType="NUMERIC"/>
  54. <result property="byj" column="BYJ" jdbcType="NUMERIC"/>
  55. <result property="byjsqje" column="BYJSQJE" jdbcType="NUMERIC"/>
  56. <result property="byjbzje" column="BYJBZJE" jdbcType="NUMERIC"/>
  57. <result property="ye" column="YE" jdbcType="NUMERIC"/>
  58. <result property="byjye" column="BYJYE" jdbcType="NUMERIC"/>
  59. <result property="rzbfb" column="RZBFB" jdbcType="NUMERIC"/>
  60. </resultMap>
  61. <!--查询单个-->
  62. <select id="queryById" resultMap="PrjProjectMap">
  63. select p.*, e.name as SSGMJJHYMC, t.XMLXMC, s1.name as XKFLMC1, s2.name as XKFLMC2, s3.name as XKFLMC3,
  64. d.dept_name as SSBMMC, k.MC as KYBGMC, b.YSJE,
  65. (select TOP 1 RY from prj_Member where XM = p.ID and XMJS = 1) as XMFZR,
  66. (select TOP 1 RYXM from prj_Member where XM = p.ID and XMJS = 1) as XMFZRXM,
  67. (SELECT STUFF((SELECT ','+XM from (select xm from base_Person
  68. where id in (select dkyfzrid from
  69. (select DISTINCT zwmc,SUBSTRING(dkyfzr, number,CHARINDEX(',',dkyfzr+',',number)-number) as dkyfzrid
  70. from prj_Project WITH(nolock) ,master..spt_values with(nolock) where number >= 1 and len(DKYFZR) > number
  71. and SUBSTRING(','+DKYFZR,number,1)=',' and id = #{id}) t)) B for xml path('')),1,1,'')) as DKYFZRXM
  72. from prj_Project p left join base_EconomicSector e on e.id = p.SSGMJJHY
  73. left join base_ProjectType t on t.XMLX = p.XMLX
  74. left join base_SubjectName s1 on s1.id = p.XKFL1
  75. left join base_SubjectName s2 on s2.id = p.XKFL2
  76. left join base_SubjectName s3 on s3.id = p.XKFL3
  77. left join sys_dept_info d on d.dept_id = p.SSBM
  78. left join sta_FeasibilityReport k on k.ID = p.BM
  79. left join prj_Budget b on b.XM = p.ID and b.FJ = ''
  80. where p.ID = #{id}
  81. </select>
  82. <!--查询指定行数据-->
  83. <select id="queryAllByLimit" resultMap="PrjProjectMap">
  84. select
  85. ID, ZWMC, XKFL1, XKFL2, XKFL3, SFGJMMJSXM, SSGMJJHY, QS, WC, CJRQ, XMLX, YWMC, XMMB, QY, ZRS, GJZC, ZJZC, CJZC, YJS, TXSM, YJNRJKHZB, YGWTSM, CJR, tdi432, SFKYBG, BM, BM2, SFKYBG2, FJ, SSBM, ERPBH, SPZT, FYLY, DKYFZR, FJ2
  86. from prj_Project
  87. <where>
  88. <if test="id != null">
  89. and ID = #{id}
  90. </if>
  91. <if test="zwmc != null and zwmc != ''">
  92. and ZWMC = #{zwmc}
  93. </if>
  94. <if test="xkfl1 != null and xkfl1 != ''">
  95. and XKFL1 = #{xkfl1}
  96. </if>
  97. <if test="xkfl2 != null and xkfl2 != ''">
  98. and XKFL2 = #{xkfl2}
  99. </if>
  100. <if test="xkfl3 != null and xkfl3 != ''">
  101. and XKFL3 = #{xkfl3}
  102. </if>
  103. <if test="sfgjmmjsxm != null and sfgjmmjsxm != ''">
  104. and SFGJMMJSXM = #{sfgjmmjsxm}
  105. </if>
  106. <if test="ssgmjjhy != null and ssgmjjhy != ''">
  107. and SSGMJJHY = #{ssgmjjhy}
  108. </if>
  109. <if test="qs != null">
  110. and QS = #{qs}
  111. </if>
  112. <if test="wc != null">
  113. and WC = #{wc}
  114. </if>
  115. <if test="cjrq != null">
  116. and CJRQ = #{cjrq}
  117. </if>
  118. <if test="xmlx != null and xmlx != ''">
  119. and XMLX = #{xmlx}
  120. </if>
  121. <if test="ywmc != null and ywmc != ''">
  122. and YWMC = #{ywmc}
  123. </if>
  124. <if test="xmmb != null and xmmb != ''">
  125. and XMMB = #{xmmb}
  126. </if>
  127. <if test="qy != null and qy != ''">
  128. and QY = #{qy}
  129. </if>
  130. <if test="zrs != null">
  131. and ZRS = #{zrs}
  132. </if>
  133. <if test="gjzc != null">
  134. and GJZC = #{gjzc}
  135. </if>
  136. <if test="zjzc != null">
  137. and ZJZC = #{zjzc}
  138. </if>
  139. <if test="cjzc != null">
  140. and CJZC = #{cjzc}
  141. </if>
  142. <if test="yjs != null">
  143. and YJS = #{yjs}
  144. </if>
  145. <if test="txsm != null and txsm != ''">
  146. and TXSM = #{txsm}
  147. </if>
  148. <if test="yjnrjkhzb != null and yjnrjkhzb != ''">
  149. and YJNRJKHZB = #{yjnrjkhzb}
  150. </if>
  151. <if test="ygwtsm != null and ygwtsm != ''">
  152. and YGWTSM = #{ygwtsm}
  153. </if>
  154. <if test="cjr != null">
  155. and CJR = #{cjr}
  156. </if>
  157. <if test="tdi432 != null and tdi432 != ''">
  158. and tdi432 = #{tdi432}
  159. </if>
  160. <if test="sfkybg != null and sfkybg != ''">
  161. and SFKYBG = #{sfkybg}
  162. </if>
  163. <if test="bm != null">
  164. and BM = #{bm}
  165. </if>
  166. <if test="bm2 != null and bm2 != ''">
  167. and BM2 = #{bm2}
  168. </if>
  169. <if test="sfkybg2 != null and sfkybg2 != ''">
  170. and SFKYBG2 = #{sfkybg2}
  171. </if>
  172. <if test="fj != null and fj != ''">
  173. and FJ = #{fj}
  174. </if>
  175. <if test="ssbm != null">
  176. and SSBM = #{ssbm}
  177. </if>
  178. <if test="erpbh != null and erpbh != ''">
  179. and ERPBH = #{erpbh}
  180. </if>
  181. <if test="spzt != null and spzt != ''">
  182. and SPZT = #{spzt}
  183. </if>
  184. <if test="fyly != null and fyly != ''">
  185. and FYLY = #{fyly}
  186. </if>
  187. <if test="dkyfzr != null and dkyfzr != ''">
  188. and DKYFZR = #{dkyfzr}
  189. </if>
  190. <if test="fj2 != null and fj2 != ''">
  191. and FJ2 = #{fj2}
  192. </if>
  193. </where>
  194. limit #{pageable.offset}, #{pageable.pageSize}
  195. </select>
  196. <!--统计总行数-->
  197. <select id="count" resultType="java.lang.Long">
  198. select count(1)
  199. from prj_Project
  200. <where>
  201. <if test="id != null">
  202. and ID = #{id}
  203. </if>
  204. <if test="zwmc != null and zwmc != ''">
  205. and ZWMC = #{zwmc}
  206. </if>
  207. <if test="xkfl1 != null and xkfl1 != ''">
  208. and XKFL1 = #{xkfl1}
  209. </if>
  210. <if test="xkfl2 != null and xkfl2 != ''">
  211. and XKFL2 = #{xkfl2}
  212. </if>
  213. <if test="xkfl3 != null and xkfl3 != ''">
  214. and XKFL3 = #{xkfl3}
  215. </if>
  216. <if test="sfgjmmjsxm != null and sfgjmmjsxm != ''">
  217. and SFGJMMJSXM = #{sfgjmmjsxm}
  218. </if>
  219. <if test="ssgmjjhy != null and ssgmjjhy != ''">
  220. and SSGMJJHY = #{ssgmjjhy}
  221. </if>
  222. <if test="qs != null">
  223. and QS = #{qs}
  224. </if>
  225. <if test="wc != null">
  226. and WC = #{wc}
  227. </if>
  228. <if test="cjrq != null">
  229. and CJRQ = #{cjrq}
  230. </if>
  231. <if test="xmlx != null and xmlx != ''">
  232. and XMLX = #{xmlx}
  233. </if>
  234. <if test="ywmc != null and ywmc != ''">
  235. and YWMC = #{ywmc}
  236. </if>
  237. <if test="xmmb != null and xmmb != ''">
  238. and XMMB = #{xmmb}
  239. </if>
  240. <if test="qy != null and qy != ''">
  241. and QY = #{qy}
  242. </if>
  243. <if test="zrs != null">
  244. and ZRS = #{zrs}
  245. </if>
  246. <if test="gjzc != null">
  247. and GJZC = #{gjzc}
  248. </if>
  249. <if test="zjzc != null">
  250. and ZJZC = #{zjzc}
  251. </if>
  252. <if test="cjzc != null">
  253. and CJZC = #{cjzc}
  254. </if>
  255. <if test="yjs != null">
  256. and YJS = #{yjs}
  257. </if>
  258. <if test="txsm != null and txsm != ''">
  259. and TXSM = #{txsm}
  260. </if>
  261. <if test="yjnrjkhzb != null and yjnrjkhzb != ''">
  262. and YJNRJKHZB = #{yjnrjkhzb}
  263. </if>
  264. <if test="ygwtsm != null and ygwtsm != ''">
  265. and YGWTSM = #{ygwtsm}
  266. </if>
  267. <if test="cjr != null">
  268. and CJR = #{cjr}
  269. </if>
  270. <if test="tdi432 != null and tdi432 != ''">
  271. and tdi432 = #{tdi432}
  272. </if>
  273. <if test="sfkybg != null and sfkybg != ''">
  274. and SFKYBG = #{sfkybg}
  275. </if>
  276. <if test="bm != null">
  277. and BM = #{bm}
  278. </if>
  279. <if test="bm2 != null and bm2 != ''">
  280. and BM2 = #{bm2}
  281. </if>
  282. <if test="sfkybg2 != null and sfkybg2 != ''">
  283. and SFKYBG2 = #{sfkybg2}
  284. </if>
  285. <if test="fj != null and fj != ''">
  286. and FJ = #{fj}
  287. </if>
  288. <if test="ssbm != null">
  289. and SSBM = #{ssbm}
  290. </if>
  291. <if test="erpbh != null and erpbh != ''">
  292. and ERPBH = #{erpbh}
  293. </if>
  294. <if test="spzt != null and spzt != ''">
  295. and SPZT = #{spzt}
  296. </if>
  297. <if test="fyly != null and fyly != ''">
  298. and FYLY = #{fyly}
  299. </if>
  300. <if test="dkyfzr != null and dkyfzr != ''">
  301. and DKYFZR = #{dkyfzr}
  302. </if>
  303. <if test="fj2 != null and fj2 != ''">
  304. and FJ2 = #{fj2}
  305. </if>
  306. </where>
  307. </select>
  308. <!--新增基本信息-->
  309. <insert id="insert" keyProperty="id" useGeneratedKeys="true">
  310. insert into prj_Project(ZWMC, XKFL1, XKFL2, XKFL3, SFGJMMJSXM, SSGMJJHY, QS, WC, CJRQ, XMLX, YWMC, XMMB, ZRS, GJZC, ZJZC, CJZC, YJS, CJR, BM, FJ, SSBM, ERPBH, SPZT, FYLY, DKYFZR)
  311. values (#{zwmc}, #{xkfl1}, #{xkfl2}, #{xkfl3},#{sfgjmmjsxm}, #{ssgmjjhy}, #{qs}, #{wc}, GETDATE(), #{xmlx}, #{ywmc}, 0, #{zrs}, #{gjzc}, #{zjzc}, #{cjzc}, #{yjs}, #{cjr},
  312. #{bm}, #{fj}, #{ssbm}, #{erpbh}, #{spzt}, #{fyly}, #{dkyfzr})
  313. </insert>
  314. <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
  315. insert into prj_Project(ZWMC, XKFL1, XKFL2, XKFL3, SFGJMMJSXM, SSGMJJHY, QS, WC, CJRQ, XMLX, YWMC, XMMB, QY, ZRS, GJZC, ZJZC, CJZC, YJS, TXSM, YJNRJKHZB, YGWTSM, CJR, tdi432, SFKYBG, BM, BM2, SFKYBG2, FJ, SSBM, ERPBH, SPZT, FYLY, DKYFZR, FJ2)
  316. values
  317. <foreach collection="entities" item="entity" separator=",">
  318. (#{entity.zwmc}, #{entity.xkfl1}, #{entity.xkfl2}, #{entity.xkfl3}, #{entity.sfgjmmjsxm}, #{entity.ssgmjjhy}, #{entity.qs}, #{entity.wc}, #{entity.cjrq}, #{entity.xmlx}, #{entity.ywmc}, #{entity.xmmb}, #{entity.qy}, #{entity.zrs}, #{entity.gjzc}, #{entity.zjzc}, #{entity.cjzc}, #{entity.yjs}, #{entity.txsm}, #{entity.yjnrjkhzb}, #{entity.ygwtsm}, #{entity.cjr}, #{entity.tdi432}, #{entity.sfkybg}, #{entity.bm}, #{entity.bm2}, #{entity.sfkybg2}, #{entity.fj}, #{entity.ssbm}, #{entity.erpbh}, #{entity.spzt}, #{entity.fyly}, #{entity.dkyfzr}, #{entity.fj2})
  319. </foreach>
  320. </insert>
  321. <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
  322. insert into prj_Project(ZWMC, XKFL1, XKFL2, XKFL3, SFGJMMJSXM, SSGMJJHY, QS, WC, CJRQ, XMLX, YWMC, XMMB, QY, ZRS, GJZC, ZJZC, CJZC, YJS, TXSM, YJNRJKHZB, YGWTSM, CJR, tdi432, SFKYBG, BM, BM2, SFKYBG2, FJ, SSBM, ERPBH, SPZT, FYLY, DKYFZR, FJ2)
  323. values
  324. <foreach collection="entities" item="entity" separator=",">
  325. (#{entity.zwmc}, #{entity.xkfl1}, #{entity.xkfl2}, #{entity.xkfl3}, #{entity.sfgjmmjsxm}, #{entity.ssgmjjhy}, #{entity.qs}, #{entity.wc}, #{entity.cjrq}, #{entity.xmlx}, #{entity.ywmc}, #{entity.xmmb}, #{entity.qy}, #{entity.zrs}, #{entity.gjzc}, #{entity.zjzc}, #{entity.cjzc}, #{entity.yjs}, #{entity.txsm}, #{entity.yjnrjkhzb}, #{entity.ygwtsm}, #{entity.cjr}, #{entity.tdi432}, #{entity.sfkybg}, #{entity.bm}, #{entity.bm2}, #{entity.sfkybg2}, #{entity.fj}, #{entity.ssbm}, #{entity.erpbh}, #{entity.spzt}, #{entity.fyly}, #{entity.dkyfzr}, #{entity.fj2})
  326. </foreach>
  327. on duplicate key update
  328. ZWMC = values(ZWMC),
  329. XKFL1 = values(XKFL1),
  330. XKFL2 = values(XKFL2),
  331. XKFL3 = values(XKFL3),
  332. SFGJMMJSXM = values(SFGJMMJSXM),
  333. SSGMJJHY = values(SSGMJJHY),
  334. QS = values(QS),
  335. WC = values(WC),
  336. CJRQ = values(CJRQ),
  337. XMLX = values(XMLX),
  338. YWMC = values(YWMC),
  339. XMMB = values(XMMB),
  340. QY = values(QY),
  341. ZRS = values(ZRS),
  342. GJZC = values(GJZC),
  343. ZJZC = values(ZJZC),
  344. CJZC = values(CJZC),
  345. YJS = values(YJS),
  346. TXSM = values(TXSM),
  347. YJNRJKHZB = values(YJNRJKHZB),
  348. YGWTSM = values(YGWTSM),
  349. CJR = values(CJR),
  350. tdi432 = values(tdi432),
  351. SFKYBG = values(SFKYBG),
  352. BM = values(BM),
  353. BM2 = values(BM2),
  354. SFKYBG2 = values(SFKYBG2),
  355. FJ = values(FJ),
  356. SSBM = values(SSBM),
  357. ERPBH = values(ERPBH),
  358. SPZT = values(SPZT),
  359. FYLY = values(FYLY),
  360. DKYFZR = values(DKYFZR),
  361. FJ2 = values(FJ2)
  362. </insert>
  363. <!--通过主键修改数据-->
  364. <update id="update">
  365. update prj_Project
  366. set ZWMC = #{zwmc},
  367. XKFL1 = #{xkfl1},
  368. XKFL2 = #{xkfl2},
  369. XKFL3 = #{xkfl3},
  370. SSGMJJHY = #{ssgmjjhy},
  371. QS = #{qs},
  372. WC = #{wc},
  373. XMLX = #{xmlx},
  374. BM = #{bm},
  375. YWMC = #{ywmc},
  376. ZRS = #{zrs},
  377. GJZC = #{gjzc},
  378. ZJZC = #{zjzc},
  379. CJZC = #{cjzc},
  380. YJS = #{yjs},
  381. SSBM = #{ssbm},
  382. ERPBH = #{erpbh},
  383. SFGJMMJSXM = #{sfgjmmjsxm},
  384. FYLY = #{fyly},
  385. DKYFZR = #{dkyfzr},
  386. SPZT = #{spzt}
  387. where ID = #{id}
  388. </update>
  389. <!--通过主键删除-->
  390. <delete id="deleteById">
  391. delete from prj_Project where ID = #{id}
  392. </delete>
  393. <!--项目列表-->
  394. <select id="getProjectList" resultMap="PrjProjectMap" parameterType="map">
  395. select p.*, t.XMLXMC, u.name as CJRXM, k.MC as KYBGMC, b.YSJE
  396. from prj_Project p
  397. left join base_ProjectType t on t.XMLX = p.XMLX
  398. left join sys_user_info u on u.user_id = p.CJR
  399. left join sta_FeasibilityReport k on k.ID = p.BM
  400. left join prj_Budget b on b.XM = p.ID and b.FJ = ''
  401. where p.XMMB != 1
  402. <if test="userId != null and userId != ''">
  403. and (p.CJR = #{userId} or #{userId} in (select SHR from prj_ApproveRecord where XMID = p.ID))
  404. </if>
  405. <if test="deptId != null and deptId != ''">
  406. and p.SSBM = #{deptId}
  407. </if>
  408. <if test="spzt != null and spzt != ''">
  409. and p.SPZT = #{spzt}
  410. </if>
  411. <if test="zwmc != null and zwmc != ''">
  412. and p.ZWMC like '%'+#{zwmc}+'%'
  413. </if>
  414. <if test="erpbh != null and erpbh != ''">
  415. and p.ERPBH like '%'+#{erpbh}+'%'
  416. </if>
  417. <if test="xmlx != null and xmlx != ''">
  418. and p.XMLX = #{xmlx}
  419. </if>
  420. <choose>
  421. <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
  422. order by ${sortName} ${sortOrder}
  423. </when>
  424. <otherwise>
  425. order by p.ID desc
  426. </otherwise>
  427. </choose>
  428. </select>
  429. <!--年度预算项目列表-->
  430. <select id="getNdysProjectList" resultMap="PrjProjectMap" parameterType="map">
  431. select DISTINCT p.ID, p.ZWMC, p.QS, p.WC, p.ERPBH, p.XMLX, t.XMLXMC, u.name as CJRXM, k.MC as KYBGMC, p.SSBM, d.dept_name as SSBMMC, b.YSJE,
  432. (select TOP 1 RY from prj_Member where XM = p.ID and XMJS = 1) as XMFZR,
  433. (select TOP 1 RYXM from prj_Member where XM = p.ID and XMJS = 1) as XMFZRXM,
  434. (SELECT STUFF((SELECT ','+XM from (select xm from base_Person
  435. where id in (select dkyfzrid from
  436. (select DISTINCT zwmc, SUBSTRING(dkyfzr, number,CHARINDEX(',',dkyfzr+',',number)-number) as dkyfzrid
  437. from prj_Project WITH(nolock) ,master..spt_values with(nolock) where number >= 1 and len(DKYFZR) > number
  438. and SUBSTRING(','+DKYFZR,number,1)=',' and ID = p.ID) t)) B for xml path('')),1,1,'')) as DKYFZRXM
  439. from prj_Project p
  440. left join base_ProjectType t on t.XMLX = p.XMLX
  441. left join sys_user_info u on u.user_id = p.CJR
  442. left join sta_FeasibilityReport k on k.ID = p.BM
  443. left join sys_dept_info d on d.dept_id = p.SSBM
  444. left join prj_Member m on m.XM = p.ID and m.XMJS = 1
  445. left join prj_Budget b on b.XM = p.ID and b.FJ = ''
  446. left join prj_FeeScheme f on f.ZB = p.ID
  447. where p.XMMB != 1
  448. and p.SPZT = '审批结束'
  449. and CONCAT(p.ID, f.NF) not in (select CONCAT(RWS, NF) from prj_AnnualBudget where XMLX !='s8')
  450. <if test="zwmc != null and zwmc != ''">
  451. and p.ZWMC like '%'+#{zwmc}+'%'
  452. </if>
  453. <if test="erpbh != null and erpbh != ''">
  454. and p.ERPBH like '%'+#{erpbh}+'%'
  455. </if>
  456. <if test="xmlx != null and xmlx != ''">
  457. and p.XMLX = #{xmlx}
  458. </if>
  459. <choose>
  460. <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
  461. order by ${sortName} ${sortOrder}
  462. </when>
  463. <otherwise>
  464. order by p.ID asc
  465. </otherwise>
  466. </choose>
  467. </select>
  468. <!--批量删除项目任务书-->
  469. <delete id="batchDelete" parameterType="java.util.ArrayList">
  470. delete from prj_Project
  471. where ID in
  472. <foreach item="item" index="index" collection="idList" open = "(" separator = "," close = ")">
  473. #{item}
  474. </foreach>
  475. </delete>
  476. <!--撤销审核状态任务书-->
  477. <update id="tjrevokeApprove">
  478. update prj_Project
  479. set SPZT = '未提交'
  480. where ID = #{id}
  481. </update>
  482. <!--新增基本信息-->
  483. <insert id="insertNormal" keyProperty="id" useGeneratedKeys="true">
  484. insert into prj_Project(ZWMC, XKFL1, XKFL2, XKFL3, SFGJMMJSXM, SSGMJJHY, QS, WC, CJRQ, XMLX, YWMC, ZRS, GJZC, ZJZC, CJZC, YJS, CJR, BM, SSBM, ERPBH, SPZT, FYLY, DKYFZR)
  485. values (#{zwmc}, #{xkfl1}, #{xkfl2}, #{xkfl3}, #{sfgjmmjsxm}, #{ssgmjjhy}, #{qs}, #{wc}, GETDATE(), #{xmlx}, #{ywmc}, #{zrs}, #{gjzc}, #{zjzc}, #{cjzc}, #{yjs}, #{cjr}, #{bm}, #{ssbm}, #{erpbh}, #{spzt}, #{fyly}, #{dkyfzr})
  486. </insert>
  487. <!--修改基本信息-->
  488. <update id="updateNormal">
  489. update prj_Project
  490. set ZWMC = #{zwmc},
  491. XKFL1 = #{xkfl1},
  492. XKFL2 = #{xkfl2},
  493. XKFL3 = #{xkfl3},
  494. SSGMJJHY = #{ssgmjjhy},
  495. QS = #{qs},
  496. WC = #{wc},
  497. YWMC = #{ywmc},
  498. ZRS = #{zrs},
  499. GJZC = #{gjzc},
  500. ZJZC = #{zjzc},
  501. CJZC = #{cjzc},
  502. YJS = #{yjs},
  503. SSBM = #{ssbm},
  504. ERPBH = #{erpbh},
  505. SFGJMMJSXM = #{sfgjmmjsxm},
  506. FYLY = #{fyly},
  507. DKYFZR = #{dkyfzr}
  508. where ID = #{id}
  509. </update>
  510. <!--通修改填写说明-->
  511. <update id="updateTXSM">
  512. update prj_Project
  513. set TXSM = #{txsm}
  514. where ID = #{id}
  515. </update>
  516. <!--修改内容-->
  517. <update id="updateContent">
  518. update prj_Project
  519. set YJNRJKHZB = #{yjnrjkhzb}
  520. where ID = #{id}
  521. </update>
  522. <!--通过主键修改数据-->
  523. <update id="updateYGWTSM">
  524. update prj_Project
  525. set YGWTSM = #{ygwtsm}
  526. where ID = #{id}
  527. </update>
  528. <!--通过主键修改数据-->
  529. <update id="updateFJ">
  530. update prj_Project
  531. set FJ = #{fj}
  532. where ID = #{id}
  533. </update>
  534. <!--获取任务书列表-->
  535. <select id="getRwsList" resultMap="PrjProjectMap" parameterType="map">
  536. select p.*, t.XMLXMC, d.dept_name as SSBMMC,
  537. (select TOP 1 RY from prj_Member where XM = p.ID and XMJS = 1) as XMFZR,
  538. (select TOP 1 RYXM from prj_Member where XM = p.ID and XMJS = 1) as XMFZRXM,
  539. (SELECT STUFF((SELECT ','+XM from (select xm from base_Person
  540. where id in (select dkyfzrid from
  541. (select DISTINCT zwmc,SUBSTRING(dkyfzr, number,CHARINDEX(',',dkyfzr+',',number)-number) as dkyfzrid
  542. from prj_Project WITH(nolock) ,master..spt_values with(nolock) where number >= 1 and len(DKYFZR) > number
  543. and SUBSTRING(','+DKYFZR,number,1)=',' and ID = p.ID) t)) B for xml path('')),1,1,'')) as DKYFZRXM
  544. from prj_Project p
  545. left join base_ProjectType t on t.XMLX = p.XMLX
  546. left join sys_dept_info d on d.dept_id = p.SSBM
  547. left join sta_FeasibilityReport f on f.ID = p.BM
  548. where p.XMMB != 1
  549. <if test="spzt != null and spzt != ''">
  550. and p.SPZT = #{spzt}
  551. </if>
  552. <if test="zwmc != null and zwmc != ''">
  553. and p.ZWMC like '%'+#{zwmc}+'%'
  554. </if>
  555. <choose>
  556. <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
  557. order by ${sortName} ${sortOrder}
  558. </when>
  559. <otherwise>
  560. order by p.ID asc
  561. </otherwise>
  562. </choose>
  563. </select>
  564. <!--年度预算任务书-->
  565. <select id="getNdysRwsList" resultMap="PrjProjectMap" parameterType="map">
  566. select p.*, t.XMLXMC, d.dept_name as SSBMMC,
  567. (select TOP 1 RY from prj_Member where XM = p.ID and XMJS = 1) as XMFZR,
  568. (select TOP 1 RYXM from prj_Member where XM = p.ID and XMJS = 1) as XMFZRXM,
  569. (SELECT STUFF((SELECT ','+XM from (select xm from base_Person
  570. where id in (select dkyfzrid from
  571. (select DISTINCT zwmc, SUBSTRING(dkyfzr, number,CHARINDEX(',',dkyfzr+',',number)-number) as dkyfzrid
  572. from prj_Project WITH(nolock) ,master..spt_values with(nolock) where number >= 1 and len(DKYFZR) > number
  573. and SUBSTRING(','+DKYFZR,number,1)=',' and ID = p.ID) t)) B for xml path('')),1,1,'')) as DKYFZRXM
  574. from prj_Project p
  575. left join base_ProjectType t on t.XMLX = p.XMLX
  576. left join sys_dept_info d on d.dept_id = p.SSBM
  577. left join sta_FeasibilityReport f on f.ID = p.BM
  578. where p.SPZT = '审批结束'
  579. and p.ID not in (select distinct RWS from prj_AnnualBudget where RWS is not NULL)
  580. <if test="zwmc != null and zwmc != ''">
  581. and p.ZWMC like '%'+#{zwmc}+'%'
  582. </if>
  583. <if test="erpbh != null and erpbh != ''">
  584. and p.ERPBH like '%'+#{erpbh}+'%'
  585. </if>
  586. <if test="xmlx != null and xmlx != ''">
  587. and p.XMLX like '%'+#{xmlx}+'%'
  588. </if>
  589. </select>
  590. <!--通过主键修改审批状态-->
  591. <update id="updateSpzt">
  592. update prj_Project
  593. set SPZT = #{spzt}
  594. where ID = #{id}
  595. </update>
  596. <!--年度预算项目列表-->
  597. <select id="getByjProjectList" resultMap="PrjProjectMap" parameterType="map">
  598. select DISTINCT p.ID, p.ZWMC, p.QS, p.WC, p.ERPBH, p.XMLX, t.XMLXMC, p.SSBM, d.dept_name as SSBMMC,
  599. (select TOP 1 RY from prj_Member where XM = p.ID and XMJS = 1) as XMFZR,
  600. (select TOP 1 RYXM from prj_Member where XM = p.ID and XMJS = 1) as XMFZRXM,
  601. (SELECT STUFF((SELECT ','+XM from (select xm from base_Person
  602. where id in (select dkyfzrid from
  603. (select DISTINCT zwmc, SUBSTRING(dkyfzr, number,CHARINDEX(',',dkyfzr+',',number)-number) as dkyfzrid
  604. from prj_Project WITH(nolock) ,master..spt_values with(nolock) where number >= 1 and len(DKYFZR) > number
  605. and SUBSTRING(','+DKYFZR,number,1)=',' and ID = p.ID) t)) B for xml path('')),1,1,'')) as DKYFZRXM
  606. from prj_Project p
  607. left join base_ProjectType t on t.XMLX = p.XMLX
  608. left join sys_dept_info d on d.dept_id = p.SSBM
  609. left join prj_Member m on m.XM = p.ID and m.XMJS = 1
  610. left join prj_AnnualBudget b on b.RWS = p.ID and b.NF = #{nf}
  611. left join prj_FeeScheme f on f.ZB = p.ID
  612. where p.XMMB != 1
  613. and p.SPZT = '审批结束'
  614. and CONCAT(p.ID, f.NF) in (select CONCAT(RWS, NF) from prj_AnnualBudget)
  615. <if test="zwmc != null and zwmc != ''">
  616. and p.ZWMC like '%'+#{zwmc}+'%'
  617. </if>
  618. <if test="erpbh != null and erpbh != ''">
  619. and p.ERPBH like '%'+#{erpbh}+'%'
  620. </if>
  621. <if test="xmlx != null and xmlx != ''">
  622. and p.XMLX = #{xmlx}
  623. </if>
  624. <choose>
  625. <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
  626. order by ${sortName} ${sortOrder}
  627. </when>
  628. <otherwise>
  629. order by p.ID asc
  630. </otherwise>
  631. </choose>
  632. </select>
  633. <!-- 获取费用管理列表 -->
  634. <select id="getFyglList" resultMap="FeeManagementMap" parameterType="map">
  635. select p.ID,p.ZWMC,p.ERPBH,p.XMLX,t.XMLXMC,b.XMFZRXM,d.dept_name as SSBMMC,b.NF, case when aa.NF=b.NF then aa.YSJE else 0 end as YSJE, case when aa.NF=b.NF then aa.XMZ else 0 end as XMZ, (SUM(case when b.BZJE is null and b.SFBYJ =0 then b.SQJE else 0 end)/10000+SUM(case when b.BZJE is not null and b.SFBYJ =0 then b.BZJE else 0 end)/10000) as SQJE, (SUM(case when b.BZJE is not null and b.SFBYJ =0 then b.BZJE else 0 end)/10000) as BZJE, case when aa.NF=b.NF then aa.BYJ else 0 end as BYJ, (SUM(case when b.BZJE is null and b.SFBYJ =1 then b.SQJE else 0 end)/10000+SUM(case when b.BZJE is not null and b.SFBYJ =1 then b.BZJE else 0 end)/10000) as BYJSQJE, (SUM(case when b.BZJE is not null and b.SFBYJ =1 then b.BZJE else 0 end)/10000) as BYJBZJE, ((case when aa.NF=b.NF then aa.XMZ else 0 end)-(SUM(case when b.BZJE is null and b.SFBYJ =0 then b.SQJE else 0 end)/10000+SUM(case when b.BZJE is not null and b.SFBYJ =0 then b.BZJE else 0 end)/10000)) as YE, ((case when aa.NF=b.NF then aa.BYJ else 0 end)-(SUM(case when b.BZJE is null and b.SFBYJ =1 then b.SQJE else 0 end)/10000+SUM(case when b.BZJE is not null and b.SFBYJ =1 then b.BZJE else 0 end)/10000)) as BYJYE, (((SUM(case when b.BZJE is not null and b.NYS=aa.ID and b.SFBYJ =0 then b.BZJE else 0 end)/10000)+(SUM(case when b.BZJE is not null and b.NYS=aa.ID and b.SFBYJ =1 then b.BZJE else 0 end)/10000))/(case when aa.NF=b.NF then aa.YSJE else 1 end)) as RZBFB from prj_Project p left join (select s.*,r.XM as XMFZRXM from sta_BudgetApproval s left join base_Person r on r.ID=s.XMFZR where s.SPZT != '作废') b on b.XMID=p.ID left join base_ProjectType t on t.XMLX=p.XMLX left join sys_dept_info d on d.dept_id=p.SSBM left join (select a.*,bd.YSJE,bd.XMZ,bd.BYJ from prj_AnnualBudget a left join prj_AnnualBudgetDetail bd on bd.NYS = a.ID and bd.FJ = '' where a.SPZT != '作废') aa on aa.RWS=p.ID where 1 = 1
  636. <if test="xmmc != null and xmmc != ''"> and p.ZWMC like '%'+#{xmmc}+'%' </if>
  637. <if test="erpbh != null and erpbh != ''"> and p.ERPBH like '%'+#{erpbh}+'%' </if>
  638. <if test="xmlx != null and xmlx != ''"> and p.XMLX = #{xmlx} </if>
  639. <if test="xmfzrxm != null and xmfzrxm != ''"> and b.XMFZRXM like '%'+#{xmfzrxm}+'%' </if>
  640. <if test="ssbmmc != null and ssbmmc != ''"> and d.dept_name like '%'+#{ssbmmc}+'%' </if>
  641. <if test="nf != null and nf != ''"> and b.NF = #{nf} </if>
  642. group by p.ID,p.ZWMC,p.ERPBH,p.XMLX,t.XMLXMC,b.XMFZRXM,d.dept_name,b.NF,aa.NF,aa.YSJE,aa.XMZ,aa.BYJ
  643. <choose>
  644. <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''"> order by ${sortName} ${sortOrder} </when>
  645. </choose>
  646. </select>
  647. </mapper>