PrjProjectDao.xml 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892
  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. <result property="nf" column="NF" jdbcType="VARCHAR"/>
  41. <result property="nys" column="NYS" jdbcType="INTEGER"/>
  42. <result property="sfxg" column="SFXG" jdbcType="INTEGER"/>
  43. <result property="xmze" column="XMZE" jdbcType="DOUBLE"/>
  44. </resultMap>
  45. <resultMap type="com.liang.entity.FeeManagemant" id="FeeManagementMap">
  46. <result property="id" column="ID" jdbcType="INTEGER"/>
  47. <result property="zwmc" column="ZWMC" jdbcType="VARCHAR"/>
  48. <result property="erpbh" column="ERPBH" jdbcType="VARCHAR"/>
  49. <result property="xmlx" column="XMLX" jdbcType="VARCHAR"/>
  50. <result property="xmlxmc" column="XMLXMC" jdbcType="VARCHAR"/>
  51. <result property="xmfzrxm" column="XMFZRXM" jdbcType="VARCHAR"/>
  52. <result property="ssbmmc" column="SSBMMC" jdbcType="VARCHAR"/>
  53. <result property="nf" column="NF" jdbcType="VARCHAR"/>
  54. <result property="ysje" column="YSJE" jdbcType="NUMERIC"/>
  55. <result property="xmz" column="XMZ" jdbcType="NUMERIC"/>
  56. <result property="sqje" column="SQJE" jdbcType="NUMERIC"/>
  57. <result property="bzje" column="BZJE" jdbcType="NUMERIC"/>
  58. <result property="byj" column="BYJ" jdbcType="NUMERIC"/>
  59. <result property="byjsqje" column="BYJSQJE" jdbcType="NUMERIC"/>
  60. <result property="byjbzje" column="BYJBZJE" jdbcType="NUMERIC"/>
  61. <result property="ye" column="YE" jdbcType="NUMERIC"/>
  62. <result property="byjye" column="BYJYE" jdbcType="NUMERIC"/>
  63. <result property="rzbfb" column="RZBFB" jdbcType="NUMERIC"/>
  64. <result property="bh" column="BH" jdbcType="VARCHAR"/>
  65. <result property="spzt" column="SPZT" jdbcType="VARCHAR"/>
  66. </resultMap>
  67. <!--查询单个-->
  68. <select id="queryById" resultMap="PrjProjectMap">
  69. select p.*,
  70. e.name as SSGMJJHYMC,
  71. t.XMLXMC,
  72. s1.name as XKFLMC1,
  73. s2.name as XKFLMC2,
  74. s3.name as XKFLMC3,
  75. d.dept_name as SSBMMC,
  76. k.MC as KYBGMC,
  77. b.YSJE,
  78. (select TOP 1 RY from prj_Member where XM = p.ID and XMJS = 1) as XMFZR,
  79. (select TOP 1 RYXM from prj_Member where XM = p.ID and XMJS = 1) as XMFZRXM,
  80. (SELECT STUFF((SELECT ',' + XM
  81. from (select xm
  82. from base_Person
  83. where id in (select dkyfzrid
  84. from (select DISTINCT zwmc,
  85. SUBSTRING(dkyfzr, number,
  86. CHARINDEX(',', dkyfzr + ',', number) -
  87. number) as dkyfzrid
  88. from prj_Project WITH(nolock) ,master..spt_values
  89. with (nolock)
  90. where number >= 1
  91. and len(DKYFZR)
  92. > number
  93. and SUBSTRING (','+DKYFZR
  94. , number
  95. , 1)=','
  96. and id = #{id}) t)) B for xml path ('')),1,1,'')) as DKYFZRXM,
  97. bp.name as CJRXM
  98. from prj_Project p
  99. left join base_EconomicSector e on e.id = p.SSGMJJHY
  100. left join base_ProjectType t on t.XMLX = p.XMLX
  101. left join base_SubjectName s1 on s1.id = p.XKFL1
  102. left join base_SubjectName s2 on s2.id = p.XKFL2
  103. left join base_SubjectName s3 on s3.id = p.XKFL3
  104. left join sys_dept_info d on d.dept_id = p.SSBM
  105. left join sta_FeasibilityReport k on k.ID = p.BM
  106. left join prj_Budget b on b.XM = p.ID and b.FJ = ''
  107. left join sys_user_info bp on p.CJR = bp.user_id
  108. where p.ID = #{id}
  109. </select>
  110. <!--查询指定行数据-->
  111. <select id="queryAllByLimit" resultMap="PrjProjectMap">
  112. select
  113. ID, ZWMC, XKFL1, XKFL2, XKFL3, SFGJMMJSXM, SSGMJJHY, QS, WC, CJRQ, XMLX, YWMC, XMMB, QY, ZRS, GJZC, ZJZC, CJZC,
  114. YJS, TXSM, YJNRJKHZB, YGWTSM, CJR, tdi432, SFKYBG, BM, BM2, SFKYBG2, FJ, SSBM, ERPBH, SPZT, FYLY, DKYFZR, FJ2
  115. from prj_Project
  116. <where>
  117. <if test="id != null">
  118. and ID = #{id}
  119. </if>
  120. <if test="zwmc != null and zwmc != ''">
  121. and ZWMC = #{zwmc}
  122. </if>
  123. <if test="xkfl1 != null and xkfl1 != ''">
  124. and XKFL1 = #{xkfl1}
  125. </if>
  126. <if test="xkfl2 != null and xkfl2 != ''">
  127. and XKFL2 = #{xkfl2}
  128. </if>
  129. <if test="xkfl3 != null and xkfl3 != ''">
  130. and XKFL3 = #{xkfl3}
  131. </if>
  132. <if test="sfgjmmjsxm != null and sfgjmmjsxm != ''">
  133. and SFGJMMJSXM = #{sfgjmmjsxm}
  134. </if>
  135. <if test="ssgmjjhy != null and ssgmjjhy != ''">
  136. and SSGMJJHY = #{ssgmjjhy}
  137. </if>
  138. <if test="qs != null">
  139. and QS = #{qs}
  140. </if>
  141. <if test="wc != null">
  142. and WC = #{wc}
  143. </if>
  144. <if test="cjrq != null">
  145. and CJRQ = #{cjrq}
  146. </if>
  147. <if test="xmlx != null and xmlx != ''">
  148. and XMLX = #{xmlx}
  149. </if>
  150. <if test="ywmc != null and ywmc != ''">
  151. and YWMC = #{ywmc}
  152. </if>
  153. <if test="xmmb != null and xmmb != ''">
  154. and XMMB = #{xmmb}
  155. </if>
  156. <if test="qy != null and qy != ''">
  157. and QY = #{qy}
  158. </if>
  159. <if test="zrs != null">
  160. and ZRS = #{zrs}
  161. </if>
  162. <if test="gjzc != null">
  163. and GJZC = #{gjzc}
  164. </if>
  165. <if test="zjzc != null">
  166. and ZJZC = #{zjzc}
  167. </if>
  168. <if test="cjzc != null">
  169. and CJZC = #{cjzc}
  170. </if>
  171. <if test="yjs != null">
  172. and YJS = #{yjs}
  173. </if>
  174. <if test="txsm != null and txsm != ''">
  175. and TXSM = #{txsm}
  176. </if>
  177. <if test="yjnrjkhzb != null and yjnrjkhzb != ''">
  178. and YJNRJKHZB = #{yjnrjkhzb}
  179. </if>
  180. <if test="ygwtsm != null and ygwtsm != ''">
  181. and YGWTSM = #{ygwtsm}
  182. </if>
  183. <if test="cjr != null">
  184. and CJR = #{cjr}
  185. </if>
  186. <if test="tdi432 != null and tdi432 != ''">
  187. and tdi432 = #{tdi432}
  188. </if>
  189. <if test="sfkybg != null and sfkybg != ''">
  190. and SFKYBG = #{sfkybg}
  191. </if>
  192. <if test="bm != null">
  193. and BM = #{bm}
  194. </if>
  195. <if test="bm2 != null and bm2 != ''">
  196. and BM2 = #{bm2}
  197. </if>
  198. <if test="sfkybg2 != null and sfkybg2 != ''">
  199. and SFKYBG2 = #{sfkybg2}
  200. </if>
  201. <if test="fj != null and fj != ''">
  202. and FJ = #{fj}
  203. </if>
  204. <if test="ssbm != null">
  205. and SSBM = #{ssbm}
  206. </if>
  207. <if test="erpbh != null and erpbh != ''">
  208. and ERPBH = #{erpbh}
  209. </if>
  210. <if test="spzt != null and spzt != ''">
  211. and SPZT = #{spzt}
  212. </if>
  213. <if test="fyly != null and fyly != ''">
  214. and FYLY = #{fyly}
  215. </if>
  216. <if test="dkyfzr != null and dkyfzr != ''">
  217. and DKYFZR = #{dkyfzr}
  218. </if>
  219. <if test="fj2 != null and fj2 != ''">
  220. and FJ2 = #{fj2}
  221. </if>
  222. </where>
  223. limit #{pageable.offset}, #{pageable.pageSize}
  224. </select>
  225. <!--统计总行数-->
  226. <select id="count" resultType="java.lang.Long">
  227. select count(1)
  228. from prj_Project
  229. <where>
  230. <if test="id != null">
  231. and ID = #{id}
  232. </if>
  233. <if test="zwmc != null and zwmc != ''">
  234. and ZWMC = #{zwmc}
  235. </if>
  236. <if test="xkfl1 != null and xkfl1 != ''">
  237. and XKFL1 = #{xkfl1}
  238. </if>
  239. <if test="xkfl2 != null and xkfl2 != ''">
  240. and XKFL2 = #{xkfl2}
  241. </if>
  242. <if test="xkfl3 != null and xkfl3 != ''">
  243. and XKFL3 = #{xkfl3}
  244. </if>
  245. <if test="sfgjmmjsxm != null and sfgjmmjsxm != ''">
  246. and SFGJMMJSXM = #{sfgjmmjsxm}
  247. </if>
  248. <if test="ssgmjjhy != null and ssgmjjhy != ''">
  249. and SSGMJJHY = #{ssgmjjhy}
  250. </if>
  251. <if test="qs != null">
  252. and QS = #{qs}
  253. </if>
  254. <if test="wc != null">
  255. and WC = #{wc}
  256. </if>
  257. <if test="cjrq != null">
  258. and CJRQ = #{cjrq}
  259. </if>
  260. <if test="xmlx != null and xmlx != ''">
  261. and XMLX = #{xmlx}
  262. </if>
  263. <if test="ywmc != null and ywmc != ''">
  264. and YWMC = #{ywmc}
  265. </if>
  266. <if test="xmmb != null and xmmb != ''">
  267. and XMMB = #{xmmb}
  268. </if>
  269. <if test="qy != null and qy != ''">
  270. and QY = #{qy}
  271. </if>
  272. <if test="zrs != null">
  273. and ZRS = #{zrs}
  274. </if>
  275. <if test="gjzc != null">
  276. and GJZC = #{gjzc}
  277. </if>
  278. <if test="zjzc != null">
  279. and ZJZC = #{zjzc}
  280. </if>
  281. <if test="cjzc != null">
  282. and CJZC = #{cjzc}
  283. </if>
  284. <if test="yjs != null">
  285. and YJS = #{yjs}
  286. </if>
  287. <if test="txsm != null and txsm != ''">
  288. and TXSM = #{txsm}
  289. </if>
  290. <if test="yjnrjkhzb != null and yjnrjkhzb != ''">
  291. and YJNRJKHZB = #{yjnrjkhzb}
  292. </if>
  293. <if test="ygwtsm != null and ygwtsm != ''">
  294. and YGWTSM = #{ygwtsm}
  295. </if>
  296. <if test="cjr != null">
  297. and CJR = #{cjr}
  298. </if>
  299. <if test="tdi432 != null and tdi432 != ''">
  300. and tdi432 = #{tdi432}
  301. </if>
  302. <if test="sfkybg != null and sfkybg != ''">
  303. and SFKYBG = #{sfkybg}
  304. </if>
  305. <if test="bm != null">
  306. and BM = #{bm}
  307. </if>
  308. <if test="bm2 != null and bm2 != ''">
  309. and BM2 = #{bm2}
  310. </if>
  311. <if test="sfkybg2 != null and sfkybg2 != ''">
  312. and SFKYBG2 = #{sfkybg2}
  313. </if>
  314. <if test="fj != null and fj != ''">
  315. and FJ = #{fj}
  316. </if>
  317. <if test="ssbm != null">
  318. and SSBM = #{ssbm}
  319. </if>
  320. <if test="erpbh != null and erpbh != ''">
  321. and ERPBH = #{erpbh}
  322. </if>
  323. <if test="spzt != null and spzt != ''">
  324. and SPZT = #{spzt}
  325. </if>
  326. <if test="fyly != null and fyly != ''">
  327. and FYLY = #{fyly}
  328. </if>
  329. <if test="dkyfzr != null and dkyfzr != ''">
  330. and DKYFZR = #{dkyfzr}
  331. </if>
  332. <if test="fj2 != null and fj2 != ''">
  333. and FJ2 = #{fj2}
  334. </if>
  335. </where>
  336. </select>
  337. <!--新增基本信息-->
  338. <insert id="insert" keyProperty="id" useGeneratedKeys="true">
  339. insert into prj_Project(ZWMC, XKFL1, XKFL2, XKFL3, SFGJMMJSXM, SSGMJJHY, QS, WC, CJRQ, XMLX, YWMC, XMMB, ZRS,
  340. GJZC, ZJZC, CJZC, YJS, CJR, BM, FJ, SSBM, ERPBH, SPZT, FYLY, DKYFZR)
  341. values (#{zwmc}, #{xkfl1}, #{xkfl2}, #{xkfl3}, #{sfgjmmjsxm}, #{ssgmjjhy}, #{qs}, #{wc}, GETDATE(), #{xmlx},
  342. #{ywmc}, 0, #{zrs}, #{gjzc}, #{zjzc}, #{cjzc}, #{yjs}, #{cjr},
  343. #{bm}, #{fj}, #{ssbm}, #{erpbh}, #{spzt}, #{fyly}, #{dkyfzr})
  344. </insert>
  345. <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
  346. insert into prj_Project(ZWMC, XKFL1, XKFL2, XKFL3, SFGJMMJSXM, SSGMJJHY, QS, WC, CJRQ, XMLX, YWMC, XMMB, QY,
  347. ZRS, GJZC, ZJZC, CJZC, YJS, TXSM, YJNRJKHZB, YGWTSM, CJR, tdi432, SFKYBG, BM, BM2, SFKYBG2, FJ, SSBM, ERPBH,
  348. SPZT, FYLY, DKYFZR, FJ2)
  349. values
  350. <foreach collection="entities" item="entity" separator=",">
  351. (#{entity.zwmc}, #{entity.xkfl1}, #{entity.xkfl2}, #{entity.xkfl3}, #{entity.sfgjmmjsxm},
  352. #{entity.ssgmjjhy}, #{entity.qs}, #{entity.wc}, #{entity.cjrq}, #{entity.xmlx}, #{entity.ywmc},
  353. #{entity.xmmb}, #{entity.qy}, #{entity.zrs}, #{entity.gjzc}, #{entity.zjzc}, #{entity.cjzc}, #{entity.yjs},
  354. #{entity.txsm}, #{entity.yjnrjkhzb}, #{entity.ygwtsm}, #{entity.cjr}, #{entity.tdi432}, #{entity.sfkybg},
  355. #{entity.bm}, #{entity.bm2}, #{entity.sfkybg2}, #{entity.fj}, #{entity.ssbm}, #{entity.erpbh},
  356. #{entity.spzt}, #{entity.fyly}, #{entity.dkyfzr}, #{entity.fj2})
  357. </foreach>
  358. </insert>
  359. <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
  360. insert into prj_Project(ZWMC, XKFL1, XKFL2, XKFL3, SFGJMMJSXM, SSGMJJHY, QS, WC, CJRQ, XMLX, YWMC, XMMB, QY,
  361. ZRS, GJZC, ZJZC, CJZC, YJS, TXSM, YJNRJKHZB, YGWTSM, CJR, tdi432, SFKYBG, BM, BM2, SFKYBG2, FJ, SSBM, ERPBH,
  362. SPZT, FYLY, DKYFZR, FJ2)
  363. values
  364. <foreach collection="entities" item="entity" separator=",">
  365. (#{entity.zwmc}, #{entity.xkfl1}, #{entity.xkfl2}, #{entity.xkfl3}, #{entity.sfgjmmjsxm},
  366. #{entity.ssgmjjhy}, #{entity.qs}, #{entity.wc}, #{entity.cjrq}, #{entity.xmlx}, #{entity.ywmc},
  367. #{entity.xmmb}, #{entity.qy}, #{entity.zrs}, #{entity.gjzc}, #{entity.zjzc}, #{entity.cjzc}, #{entity.yjs},
  368. #{entity.txsm}, #{entity.yjnrjkhzb}, #{entity.ygwtsm}, #{entity.cjr}, #{entity.tdi432}, #{entity.sfkybg},
  369. #{entity.bm}, #{entity.bm2}, #{entity.sfkybg2}, #{entity.fj}, #{entity.ssbm}, #{entity.erpbh},
  370. #{entity.spzt}, #{entity.fyly}, #{entity.dkyfzr}, #{entity.fj2})
  371. </foreach>
  372. on duplicate key update
  373. ZWMC = values(ZWMC),
  374. XKFL1 = values(XKFL1),
  375. XKFL2 = values(XKFL2),
  376. XKFL3 = values(XKFL3),
  377. SFGJMMJSXM = values(SFGJMMJSXM),
  378. SSGMJJHY = values(SSGMJJHY),
  379. QS = values(QS),
  380. WC = values(WC),
  381. CJRQ = values(CJRQ),
  382. XMLX = values(XMLX),
  383. YWMC = values(YWMC),
  384. XMMB = values(XMMB),
  385. QY = values(QY),
  386. ZRS = values(ZRS),
  387. GJZC = values(GJZC),
  388. ZJZC = values(ZJZC),
  389. CJZC = values(CJZC),
  390. YJS = values(YJS),
  391. TXSM = values(TXSM),
  392. YJNRJKHZB = values(YJNRJKHZB),
  393. YGWTSM = values(YGWTSM),
  394. CJR = values(CJR),
  395. tdi432 = values(tdi432),
  396. SFKYBG = values(SFKYBG),
  397. BM = values(BM),
  398. BM2 = values(BM2),
  399. SFKYBG2 = values(SFKYBG2),
  400. FJ = values(FJ),
  401. SSBM = values(SSBM),
  402. ERPBH = values(ERPBH),
  403. SPZT = values(SPZT),
  404. FYLY = values(FYLY),
  405. DKYFZR = values(DKYFZR),
  406. FJ2 = values(FJ2)
  407. </insert>
  408. <!--通过主键修改数据-->
  409. <update id="update">
  410. update prj_Project
  411. set ZWMC = #{zwmc},
  412. XKFL1 = #{xkfl1},
  413. XKFL2 = #{xkfl2},
  414. XKFL3 = #{xkfl3},
  415. SSGMJJHY = #{ssgmjjhy},
  416. QS = #{qs},
  417. WC = #{wc},
  418. XMLX = #{xmlx},
  419. BM = #{bm},
  420. YWMC = #{ywmc},
  421. ZRS = #{zrs},
  422. GJZC = #{gjzc},
  423. ZJZC = #{zjzc},
  424. CJZC = #{cjzc},
  425. YJS = #{yjs},
  426. SSBM = #{ssbm},
  427. ERPBH = #{erpbh},
  428. SFGJMMJSXM = #{sfgjmmjsxm},
  429. FYLY = #{fyly},
  430. DKYFZR = #{dkyfzr},
  431. SPZT = #{spzt}
  432. where ID = #{id}
  433. </update>
  434. <!-- 通过主键修改数据 -->
  435. <update id="updateZy">
  436. update prj_Project
  437. set
  438. <if test="ssbm != null and ssbm != ''">
  439. SSBM = #{ssbm}
  440. </if>
  441. <if test="dkyfzr != null and dkyfzr != ''">
  442. ,DKYFZR = #{dkyfzr}
  443. </if>
  444. <if test="cjr != null and cjr != ''">
  445. ,CJR = #{cjr}
  446. </if>
  447. where ID = #{id}
  448. </update>
  449. <!--通过主键删除-->
  450. <delete id="deleteById">
  451. delete
  452. from prj_Project
  453. where ID = #{id}
  454. </delete>
  455. <!--项目列表-->
  456. <select id="getProjectList" resultMap="PrjProjectMap" parameterType="map">
  457. select p.*, t.XMLXMC, u.name as CJRXM, k.MC as KYBGMC, b.YSJE
  458. from prj_Project p
  459. left join base_ProjectType t on t.XMLX = p.XMLX
  460. left join sys_user_info u on u.user_id = p.CJR
  461. LEFT join sys_dept_info d on d.dept_id = u.dept_id
  462. left join sta_FeasibilityReport k on k.ID = p.BM
  463. left join prj_Budget b on b.XM = p.ID and b.FJ = ''
  464. where p.XMMB != 1
  465. <if test="userId != null and userId != ''">
  466. and p.CJR = #{userId}
  467. </if>
  468. <if test="deptId != null and deptId != ''">
  469. and p.SSBM = #{deptId}
  470. </if>
  471. <if test="spzt != null and spzt != ''">
  472. and p.SPZT = #{spzt}
  473. </if>
  474. <if test="zwmc != null and zwmc != ''">
  475. and p.ZWMC like '%'+#{zwmc}+'%'
  476. </if>
  477. <if test="erpbh != null and erpbh != ''">
  478. and p.ERPBH like '%'+#{erpbh}+'%'
  479. </if>
  480. <if test="xmlx != null and xmlx != ''">
  481. and p.XMLX = #{xmlx}
  482. </if>
  483. <if test="sfxg != null and sfxg != ''">
  484. and p.SFXG = #{sfxg}
  485. </if>
  486. <if test="ssbmmc != null and ssbmmc != ''">
  487. and d.dept_name = #{ssbmmc}
  488. </if>
  489. <choose>
  490. <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
  491. order by ${sortName} ${sortOrder}
  492. </when>
  493. <otherwise>
  494. order by p.ID desc
  495. </otherwise>
  496. </choose>
  497. </select>
  498. <!--年度预算项目列表-->
  499. <select id="getNdysProjectList" resultMap="PrjProjectMap" parameterType="map">
  500. 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,
  501. d.dept_name as SSBMMC,
  502. (
  503. SELECT SUM(CZJE) from prj_feescheme where ZB = p.ID and DWMC LIKE '%国网陕西省电力%'
  504. ) WGYSJE,
  505. (
  506. SELECT SUM(CZJE) from prj_feescheme where ZB = p.ID
  507. ) SXYSJE,
  508. (select TOP 1 RY from prj_Member where XM = p.ID and XMJS = 1) as XMFZR,
  509. (select TOP 1 RYXM from prj_Member where XM = p.ID and XMJS = 1) as XMFZRXM,
  510. (SELECT STUFF((SELECT ','+XM from (select xm from base_Person
  511. where id in (select dkyfzrid from
  512. (select DISTINCT zwmc, SUBSTRING(dkyfzr, number,CHARINDEX(',',dkyfzr+',',number)-number) as dkyfzrid
  513. from prj_Project WITH(nolock) ,master..spt_values with(nolock) where number >= 1 and len(DKYFZR) > number
  514. and SUBSTRING(','+DKYFZR,number,1)=',' and ID = p.ID) t)) B for xml path('')),1,1,'')) as DKYFZRXM,
  515. COALESCE((select SUM(pf.CZJE) from prj_FeeScheme pf where pf.ZB = p.ID), 0.00) AS XMZE
  516. from prj_Project p
  517. left join base_ProjectType t on t.XMLX = p.XMLX
  518. left join sys_user_info u on u.user_id = p.CJR
  519. left join sta_FeasibilityReport k on k.ID = p.BM
  520. left join sys_dept_info d on d.dept_id = p.SSBM
  521. left join prj_Member m on m.XM = p.ID and m.XMJS = 1
  522. left join prj_Budget b on b.XM = p.ID and b.FJ = ''
  523. left join prj_FeeScheme f on f.ZB = p.ID
  524. where
  525. p.XMMB != 1
  526. and p.SPZT = '审批结束'
  527. -- and CONCAT(p.ID, f.NF) not in (select CONCAT(RWS, NF) from prj_AnnualBudget where XMLX !='s8')
  528. <if test="zwmc != null and zwmc != ''">
  529. and p.ZWMC like '%'+#{zwmc}+'%'
  530. </if>
  531. <if test="erpbh != null and erpbh != ''">
  532. and p.ERPBH like '%'+#{erpbh}+'%'
  533. </if>
  534. <if test="xmlx != null and xmlx != ''">
  535. and p.XMLX = #{xmlx}
  536. </if>
  537. <choose>
  538. <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
  539. order by ${sortName} ${sortOrder}
  540. </when>
  541. <otherwise>
  542. order by p.ID asc
  543. </otherwise>
  544. </choose>
  545. </select>
  546. <!--批量删除项目任务书-->
  547. <delete id="batchDelete" parameterType="java.util.ArrayList">
  548. delete from prj_Project
  549. where ID in
  550. <foreach item="item" index="index" collection="idList" open="(" separator="," close=")">
  551. #{item}
  552. </foreach>
  553. </delete>
  554. <!--撤销审核状态任务书-->
  555. <update id="tjrevokeApprove">
  556. update prj_Project
  557. set SPZT = '未提交'
  558. where ID = #{id}
  559. </update>
  560. <!--新增基本信息-->
  561. <insert id="insertNormal" keyProperty="id" useGeneratedKeys="true">
  562. insert into prj_Project(ZWMC, XKFL1, XKFL2, XKFL3, SFGJMMJSXM, SSGMJJHY, QS, WC, CJRQ, XMLX, YWMC, ZRS, GJZC,
  563. ZJZC, CJZC, YJS, CJR, BM, SSBM, ERPBH, SPZT, FYLY, DKYFZR,SFXG)
  564. values (#{zwmc}, #{xkfl1}, #{xkfl2}, #{xkfl3}, #{sfgjmmjsxm}, #{ssgmjjhy}, #{qs}, #{wc}, GETDATE(), #{xmlx},
  565. #{ywmc}, #{zrs}, #{gjzc}, #{zjzc}, #{cjzc}, #{yjs}, #{cjr}, #{bm}, #{ssbm}, #{erpbh}, #{spzt}, #{fyly},
  566. #{dkyfzr},#{sfxg})
  567. </insert>
  568. <!--修改基本信息-->
  569. <update id="updateNormal">
  570. update prj_Project
  571. set ZWMC = #{zwmc},
  572. XKFL1 = #{xkfl1},
  573. XKFL2 = #{xkfl2},
  574. XKFL3 = #{xkfl3},
  575. SSGMJJHY = #{ssgmjjhy},
  576. QS = #{qs},
  577. WC = #{wc},
  578. YWMC = #{ywmc},
  579. ZRS = #{zrs},
  580. GJZC = #{gjzc},
  581. ZJZC = #{zjzc},
  582. CJZC = #{cjzc},
  583. YJS = #{yjs},
  584. SSBM = #{ssbm},
  585. ERPBH = #{erpbh},
  586. SFGJMMJSXM = #{sfgjmmjsxm},
  587. FYLY = #{fyly},
  588. DKYFZR = #{dkyfzr}
  589. where ID = #{id}
  590. </update>
  591. <!--通修改填写说明-->
  592. <update id="updateTXSM">
  593. update prj_Project
  594. set TXSM = #{txsm}
  595. where ID = #{id}
  596. </update>
  597. <!--修改内容-->
  598. <update id="updateContent">
  599. update prj_Project
  600. set YJNRJKHZB = #{yjnrjkhzb}
  601. where ID = #{id}
  602. </update>
  603. <!--通过主键修改数据-->
  604. <update id="updateYGWTSM">
  605. update prj_Project
  606. set YGWTSM = #{ygwtsm}
  607. where ID = #{id}
  608. </update>
  609. <!--通过主键修改数据-->
  610. <update id="updateFJ">
  611. update prj_Project
  612. set FJ = #{fj}
  613. where ID = #{id}
  614. </update>
  615. <!--获取任务书列表-->
  616. <select id="getRwsList" resultMap="PrjProjectMap" parameterType="map">
  617. select p.*, t.XMLXMC, d.dept_name as SSBMMC,
  618. (select TOP 1 RY from prj_Member where XM = p.ID and XMJS = 1) as XMFZR,
  619. (select TOP 1 RYXM from prj_Member where XM = p.ID and XMJS = 1) as XMFZRXM,
  620. (SELECT STUFF((SELECT ','+XM from (select xm from base_Person
  621. where id in (select dkyfzrid from
  622. (select DISTINCT zwmc,SUBSTRING(dkyfzr, number,CHARINDEX(',',dkyfzr+',',number)-number) as dkyfzrid
  623. from prj_Project WITH(nolock) ,master..spt_values with(nolock) where number >= 1 and len(DKYFZR) > number
  624. and SUBSTRING(','+DKYFZR,number,1)=',' and ID = p.ID) t)) B for xml path('')),1,1,'')) as DKYFZRXM
  625. from prj_Project p
  626. left join base_ProjectType t on t.XMLX = p.XMLX
  627. left join sys_dept_info d on d.dept_id = p.SSBM
  628. left join sta_FeasibilityReport f on f.ID = p.BM
  629. where p.XMMB != 1
  630. <if test="spzt != null and spzt != ''">
  631. and p.SPZT = #{spzt}
  632. </if>
  633. <if test="zwmc != null and zwmc != ''">
  634. and p.ZWMC like '%'+#{zwmc}+'%'
  635. </if>
  636. <choose>
  637. <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
  638. order by ${sortName} ${sortOrder}
  639. </when>
  640. <otherwise>
  641. order by p.ID asc
  642. </otherwise>
  643. </choose>
  644. </select>
  645. <!--年度预算任务书-->
  646. <select id="getNdysRwsList" resultMap="PrjProjectMap" parameterType="map">
  647. select p.*, t.XMLXMC, d.dept_name as SSBMMC,
  648. (select TOP 1 RY from prj_Member where XM = p.ID and XMJS = 1) as XMFZR,
  649. (select TOP 1 RYXM from prj_Member where XM = p.ID and XMJS = 1) as XMFZRXM,
  650. (SELECT STUFF((SELECT ','+XM from (select xm from base_Person
  651. where id in (select dkyfzrid from
  652. (select DISTINCT zwmc, SUBSTRING(dkyfzr, number,CHARINDEX(',',dkyfzr+',',number)-number) as dkyfzrid
  653. from prj_Project WITH(nolock) ,master..spt_values with(nolock) where number >= 1 and len(DKYFZR) > number
  654. and SUBSTRING(','+DKYFZR,number,1)=',' and ID = p.ID) t)) B for xml path('')),1,1,'')) as DKYFZRXM
  655. from prj_Project p
  656. left join base_ProjectType t on t.XMLX = p.XMLX
  657. left join sys_dept_info d on d.dept_id = p.SSBM
  658. left join sta_FeasibilityReport f on f.ID = p.BM
  659. where p.SPZT = '审批结束'
  660. and p.ID not in (select distinct RWS from prj_AnnualBudget where RWS is not NULL)
  661. <if test="zwmc != null and zwmc != ''">
  662. and p.ZWMC like '%'+#{zwmc}+'%'
  663. </if>
  664. <if test="erpbh != null and erpbh != ''">
  665. and p.ERPBH like '%'+#{erpbh}+'%'
  666. </if>
  667. <if test="xmlx != null and xmlx != ''">
  668. and p.XMLX like '%'+#{xmlx}+'%'
  669. </if>
  670. </select>
  671. <!--通过主键修改审批状态-->
  672. <update id="updateSpzt">
  673. update prj_Project
  674. set SPZT = #{spzt}
  675. where ID = #{id}
  676. </update>
  677. <!--修改是否修改字段-->
  678. <update id="updateSFXG">
  679. update prj_Project
  680. set SFXG = 1
  681. where ID =#{xmid}
  682. </update>
  683. <!--年度预算项目列表-->
  684. <select id="getByjProjectList" resultMap="PrjProjectMap" parameterType="map">
  685. select DISTINCT p.ID, p.ZWMC, p.QS, p.WC, p.ERPBH, p.XMLX, t.XMLXMC, p.SSBM, d.dept_name as SSBMMC,b.NF,b.ID AS NYS,
  686. (select TOP 1 RY from prj_Member where XM = p.ID and XMJS = 1) as XMFZR,
  687. (select TOP 1 RYXM from prj_Member where XM = p.ID and XMJS = 1) as XMFZRXM,
  688. (SELECT STUFF((SELECT ','+XM from (select xm from base_Person
  689. where id in (select dkyfzrid from
  690. (select DISTINCT zwmc, SUBSTRING(dkyfzr, number,CHARINDEX(',',dkyfzr+',',number)-number) as dkyfzrid
  691. from prj_Project WITH(nolock) ,master..spt_values with(nolock) where number >= 1 and len(DKYFZR) > number
  692. and SUBSTRING(','+DKYFZR,number,1)=',' and ID = p.ID) t)) B for xml path('')),1,1,'')) as DKYFZRXM
  693. from prj_Project p
  694. left join base_ProjectType t on t.XMLX = p.XMLX
  695. left join sys_dept_info d on d.dept_id = p.SSBM
  696. left join prj_Member m on m.XM = p.ID and m.XMJS = 1
  697. left join prj_AnnualBudget b on b.RWS = p.ID and b.NF = #{nf}
  698. left join prj_FeeScheme f on f.ZB = p.ID
  699. INNER JOIN sta_BudgetApproval s ON b.RWS = s.XMID
  700. where p.XMMB != 1
  701. and p.SPZT = '审批结束'
  702. and CONCAT(p.ID, f.NF) in (select CONCAT(RWS, NF) from prj_AnnualBudget)
  703. <if test="nf != null and nf !=''">
  704. and b.nf = #{nf}
  705. </if>
  706. <if test="zwmc != null and zwmc != ''">
  707. and p.ZWMC like '%'+#{zwmc}+'%'
  708. </if>
  709. <if test="erpbh != null and erpbh != ''">
  710. and p.ERPBH like '%'+#{erpbh}+'%'
  711. </if>
  712. <if test="xmlx != null and xmlx != ''">
  713. and p.XMLX = #{xmlx}
  714. </if>
  715. <choose>
  716. <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
  717. order by ${sortName} ${sortOrder}
  718. </when>
  719. <otherwise>
  720. order by p.ID asc
  721. </otherwise>
  722. </choose>
  723. </select>
  724. <!-- 获取费用管理列表 -->
  725. <select id="getFyglList" resultMap="FeeManagementMap" parameterType="map">
  726. SELECT
  727. *
  728. FROM
  729. (
  730. SELECT
  731. p.ID,
  732. p.ZWMC,
  733. p.ERPBH,
  734. p.XMLX,
  735. t.XMLXMC,
  736. b.XMFZRXM,
  737. d.dept_name AS SSBMMC,
  738. b.NF,
  739. CASE
  740. WHEN aa.NF= b.NF THEN
  741. aa.YSJE ELSE 0
  742. END AS YSJE,
  743. CASE
  744. WHEN aa.NF= b.NF THEN
  745. aa.XMZ ELSE 0
  746. END AS XMZ,
  747. (
  748. SELECT SUM(SQJE)/10000 FROM sta_BudgetApproval WHERE SPZT != '作废'and erpbh = p.ERPBH and nf=b.nf GROUP BY NF ) AS SQJE,
  749. ( SUM ( CASE WHEN b.BZJE IS NOT NULL AND b.SFBYJ = 0 THEN b.BZJE ELSE 0 END ) / 10000 ) AS BZJE,
  750. CASE
  751. WHEN aa.NF= b.NF THEN
  752. aa.BYJ ELSE 0
  753. END AS BYJ,
  754. (
  755. 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
  756. ) AS BYJSQJE,
  757. ( SUM ( CASE WHEN b.BZJE IS NOT NULL AND b.SFBYJ = 1 THEN b.BZJE ELSE 0 END ) / 10000 ) AS BYJBZJE,
  758. (
  759. ( CASE WHEN aa.NF= b.NF THEN aa.XMZ ELSE 0 END ) - (
  760. SUM ( CASE WHEN b.BZJE IS NULL AND b.SFBYJ = 0 THEN b.BZJE ELSE 0 END ) / 10000+SUM ( CASE WHEN b.BZJE IS NOT NULL AND b.SFBYJ = 0 THEN b.BZJE ELSE 0 END ) / 10000
  761. )
  762. ) AS YE,
  763. (
  764. ( (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)
  765. -(SUM ( CASE WHEN b.BZJE IS NOT NULL AND b.SFBYJ = 1 THEN b.BZJE ELSE 0 END ) / 10000 )
  766. )
  767. )AS BYJYE,
  768. (
  769. (
  770. (
  771. SUM (
  772. CASE
  773. WHEN b.BZJE IS NOT NULL
  774. AND b.NYS= aa.ID
  775. AND b.SFBYJ = 0 THEN
  776. b.BZJE ELSE 0
  777. END
  778. ) / 10000
  779. ) + (
  780. SUM (
  781. CASE
  782. WHEN b.BZJE IS NOT NULL
  783. AND b.NYS= aa.ID
  784. AND b.SFBYJ = 1 THEN
  785. b.BZJE ELSE 0
  786. END
  787. ) / 10000
  788. )
  789. ) / ( CASE WHEN aa.NF= b.NF THEN aa.YSJE ELSE 1 END )
  790. ) AS RZBFB
  791. FROM
  792. prj_Project p
  793. LEFT JOIN (
  794. SELECT
  795. s.*,
  796. r.XM AS XMFZRXM
  797. FROM
  798. sta_BudgetApproval s
  799. LEFT JOIN base_Person r ON r.ID= s.XMFZR
  800. WHERE
  801. s.SPZT != '作废'
  802. ) b ON b.XMID= p.ID
  803. LEFT JOIN base_ProjectType t ON t.XMLX= p.XMLX
  804. LEFT JOIN sys_dept_info d ON d.dept_id= p.SSBM
  805. LEFT JOIN (
  806. SELECT
  807. a.*,
  808. bd.YSJE,
  809. bd.XMZ,
  810. bd.BYJ
  811. FROM
  812. prj_AnnualBudget a
  813. LEFT JOIN prj_AnnualBudgetDetail bd ON bd.NYS = a.ID
  814. AND bd.FJ = ''
  815. WHERE
  816. a.SPZT != '作废'
  817. ) aa ON aa.RWS= p.ID
  818. WHERE
  819. 1 = 1
  820. <if test="xmmc != null and xmmc != ''">
  821. and p.ZWMC like '%'+#{xmmc}+'%'</if>
  822. <if test="erpbh != null and erpbh != ''">
  823. and p.ERPBH like '%'+#{erpbh}+'%'</if>
  824. <if test="xmlx != null and xmlx != ''">
  825. and p.XMLX = #{xmlx}</if>
  826. <if test="xmfzrxm != null and xmfzrxm != ''">
  827. and b.XMFZRXM like '%'+#{xmfzrxm}+'%'</if>
  828. <if test="ssbmmc != null and ssbmmc != ''">
  829. and d.dept_name like '%'+#{ssbmmc}+'%'</if>
  830. <if test="nf != null and nf != ''">
  831. and b.NF = #{nf}</if>
  832. <if test="bh != null and bh != ''">
  833. and s.BH like '%'+#{bh}+'%'
  834. </if>
  835. <if test="spzt != null and spzt != ''">
  836. and s.SPZT = #{spzt}
  837. </if>
  838. 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
  839. <choose>
  840. <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">order by</when>
  841. </choose>
  842. ${sortName} ${sortOrder}
  843. ) as sx
  844. WHERE YSJE &lt;&gt; 0
  845. </select>
  846. <!-- 根据erp 编号查询数据 -->
  847. <select id="getErpBh" resultMap="PrjProjectMap">
  848. SELECT *
  849. from prj_Project
  850. where ERPBH = #{erpbh}
  851. </select>
  852. <select id="getSqje" resultMap="FeeManagementMap">
  853. SELECT SUM(SQJE
  854. ) AS sqje
  855. FROM sta_BudgetApproval WHERE ERPBH like '%'+#{erpbh}+'%' AND SPZT != '作废' and SFBYJ != 1
  856. </select>
  857. </mapper>