PrjAnnualbudgetdetailDao.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  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.PrjAnnualbudgetdetailDao">
  4. <resultMap type="com.liang.entity.PrjAnnualbudgetdetail" id="PrjAnnualbudgetdetailMap">
  5. <result property="id" column="ID" jdbcType="INTEGER"/>
  6. <result property="fymc" column="FYMC" jdbcType="VARCHAR"/>
  7. <result property="ysje" column="YSJE" jdbcType="NUMERIC"/>
  8. <result property="ysqje" column="YSQJE" jdbcType="NUMERIC"/>
  9. <result property="nys" column="NYS" jdbcType="INTEGER"/>
  10. <result property="bm" column="BM" jdbcType="VARCHAR"/>
  11. <result property="fj" column="FJ" jdbcType="VARCHAR"/>
  12. <result property="nf" column="NF" jdbcType="INTEGER"/>
  13. <result property="px" column="PX" jdbcType="VARCHAR"/>
  14. <result property="hjbm" column="HJBM" jdbcType="VARCHAR"/>
  15. <result property="bz" column="BZ" jdbcType="VARCHAR"/>
  16. <result property="bndsqje" column="bndbzje" jdbcType="NUMERIC"/>
  17. <result property="bndsqje" column="bndbzje" jdbcType="NUMERIC"/>
  18. <result property="dw1" column="DW1" jdbcType="NUMERIC"/>
  19. <result property="dw2" column="DW2" jdbcType="NUMERIC"/>
  20. <result property="dw3" column="DW3" jdbcType="NUMERIC"/>
  21. <result property="dw4" column="DW4" jdbcType="NUMERIC"/>
  22. <result property="dw5" column="DW5" jdbcType="NUMERIC"/>
  23. <result property="dw6" column="DW6" jdbcType="NUMERIC"/>
  24. <result property="dw7" column="DW7" jdbcType="NUMERIC"/>
  25. <result property="dw8" column="DW8" jdbcType="NUMERIC"/>
  26. <result property="dw9" column="DW9" jdbcType="NUMERIC"/>
  27. <result property="dw10" column="DW10" jdbcType="NUMERIC"/>
  28. <result property="sjys1" column="SJYS1" jdbcType="NUMERIC"/>
  29. <result property="sjys2" column="SJYS2" jdbcType="NUMERIC"/>
  30. <result property="sjys3" column="SJYS3" jdbcType="NUMERIC"/>
  31. <result property="sjys4" column="SJYS4" jdbcType="NUMERIC"/>
  32. <result property="sjys5" column="SJYS5" jdbcType="NUMERIC"/>
  33. <result property="sjys6" column="SJYS6" jdbcType="NUMERIC"/>
  34. <result property="sjys7" column="SJYS7" jdbcType="NUMERIC"/>
  35. <result property="sjys8" column="SJYS8" jdbcType="NUMERIC"/>
  36. <result property="sjys9" column="SJYS9" jdbcType="NUMERIC"/>
  37. <result property="sjys10" column="SJYS10" jdbcType="NUMERIC"/>
  38. <result property="xtjsyzx" column="XTJSYZX" jdbcType="NUMERIC"/>
  39. <result property="xmz" column="XMZ" jdbcType="NUMERIC"/>
  40. <result property="byj" column="BYJ" jdbcType="NUMERIC"/>
  41. <result property="zrje" column="ZRJE" jdbcType="NUMERIC"/>
  42. <result property="rwsys" column="RWSYS" jdbcType="NUMERIC"/>
  43. <result property="xmzys" column="XMZYS" jdbcType="NUMERIC"/>
  44. <result property="ybzje" column="YBZJE" jdbcType="NUMERIC"/>
  45. <result property="zcbyj" column="ZCBYJ" jdbcType="NUMERIC"/>
  46. <result property="kyys" column="KYYS" jdbcType="NUMERIC"/>
  47. <result property="zcje" column="ZCJE" jdbcType="NUMERIC"/>
  48. <result property="byjysq" column="BYJYSQ" jdbcType="NUMERIC"/>
  49. <result property="byqybz" column="BYQYBZ" jdbcType="NUMERIC"/>
  50. <result property="zrbyj" column="ZRBYJ" jdbcType="NUMERIC"/>
  51. <result property="sjyzx" column="SJYZX" jdbcType="NUMERIC"/>
  52. <result property="dnzyzf" column="DNZYZF" jdbcType="NUMERIC"/>
  53. </resultMap>
  54. <!--查询单个-->
  55. <select id="queryById" resultMap="PrjAnnualbudgetdetailMap">
  56. select *
  57. from prj_AnnualBudgetDetail
  58. where ID = #{id}
  59. </select>
  60. <!--查询指定行数据-->
  61. <select id="queryAllByLimit" resultMap="PrjAnnualbudgetdetailMap">
  62. select *
  63. from prj_AnnualBudgetDetail
  64. <where>
  65. <if test="id != null">
  66. and ID = #{id}
  67. </if>
  68. <if test="fymc != null and fymc != ''">
  69. and FYMC = #{fymc}
  70. </if>
  71. <if test="ysje != null">
  72. and YSJE = #{ysje}
  73. </if>
  74. <if test="ysqje != null">
  75. and YSQJE = #{ysqje}
  76. </if>
  77. <if test="nys != null">
  78. and NYS = #{nys}
  79. </if>
  80. <if test="bm != null and bm != ''">
  81. and BM = #{bm}
  82. </if>
  83. <if test="fj != null and fj != ''">
  84. and FJ = #{fj}
  85. </if>
  86. <if test="nf != null">
  87. and NF = #{nf}
  88. </if>
  89. <if test="px != null and px != ''">
  90. and PX = #{px}
  91. </if>
  92. <if test="hjbm != null and hjbm != ''">
  93. and HJBM = #{hjbm}
  94. </if>
  95. <if test="bz != null and bz != ''">
  96. and BZ = #{bz}
  97. </if>
  98. <if test="dw1 != null">
  99. and DW1 = #{dw1}
  100. </if>
  101. <if test="dw2 != null">
  102. and DW2 = #{dw2}
  103. </if>
  104. <if test="dw3 != null">
  105. and DW3 = #{dw3}
  106. </if>
  107. <if test="dw4 != null">
  108. and DW4 = #{dw4}
  109. </if>
  110. <if test="dw5 != null">
  111. and DW5 = #{dw5}
  112. </if>
  113. <if test="dw6 != null">
  114. and DW6 = #{dw6}
  115. </if>
  116. <if test="dw7 != null">
  117. and DW7 = #{dw7}
  118. </if>
  119. <if test="dw8 != null">
  120. and DW8 = #{dw8}
  121. </if>
  122. <if test="dw9 != null">
  123. and DW9 = #{dw9}
  124. </if>
  125. <if test="dw10 != null">
  126. and DW10 = #{dw10}
  127. </if>
  128. <if test="sjys1 != null">
  129. and SJYS1 = #{sjys1}
  130. </if>
  131. <if test="sjys2 != null">
  132. and SJYS2 = #{sjys2}
  133. </if>
  134. <if test="sjys3 != null">
  135. and SJYS3 = #{sjys3}
  136. </if>
  137. <if test="sjys4 != null">
  138. and SJYS4 = #{sjys4}
  139. </if>
  140. <if test="sjys5 != null">
  141. and SJYS5 = #{sjys5}
  142. </if>
  143. <if test="sjys6 != null">
  144. and SJYS6 = #{sjys6}
  145. </if>
  146. <if test="sjys7 != null">
  147. and SJYS7 = #{sjys7}
  148. </if>
  149. <if test="sjys8 != null">
  150. and SJYS8 = #{sjys8}
  151. </if>
  152. <if test="sjys9 != null">
  153. and SJYS9 = #{sjys9}
  154. </if>
  155. <if test="sjys10 != null">
  156. and SJYS10 = #{sjys10}
  157. </if>
  158. <if test="xtjsyzx != null">
  159. and XTJSYZX = #{xtjsyzx}
  160. </if>
  161. <if test="xmz != null">
  162. and XMZ = #{xmz}
  163. </if>
  164. <if test="byj != null">
  165. and BYJ = #{byj}
  166. </if>
  167. <if test="zrje != null">
  168. and ZRJE = #{zrje}
  169. </if>
  170. <if test="rwsys != null">
  171. and RWSYS = #{rwsys}
  172. </if>
  173. <if test="xmzys != null">
  174. and XMZYS = #{xmzys}
  175. </if>
  176. <if test="ybzje != null">
  177. and YBZJE = #{ybzje}
  178. </if>
  179. <if test="zcbyj != null">
  180. and ZCBYJ = #{zcbyj}
  181. </if>
  182. <if test="kyys != null">
  183. and KYYS = #{kyys}
  184. </if>
  185. <if test="zcje != null">
  186. and ZCJE = #{zcje}
  187. </if>
  188. <if test="byjysq != null">
  189. and BYJYSQ = #{byjysq}
  190. </if>
  191. <if test="byqybz != null">
  192. and BYQYBZ = #{byqybz}
  193. </if>
  194. <if test="zrbyj != null">
  195. and ZRBYJ = #{zrbyj}
  196. </if>
  197. <if test="sjyzx != null">
  198. and SJYZX = #{sjyzx}
  199. </if>
  200. <if test="dnzyzf != null">
  201. and DNZYZF = #{dnzyzf}
  202. </if>
  203. </where>
  204. limit #{pageable.offset}, #{pageable.pageSize}
  205. </select>
  206. <!--统计总行数-->
  207. <select id="count" resultType="java.lang.Long">
  208. select count(1)
  209. from prj_AnnualBudgetDetail
  210. <where>
  211. <if test="id != null">
  212. and ID = #{id}
  213. </if>
  214. <if test="fymc != null and fymc != ''">
  215. and FYMC = #{fymc}
  216. </if>
  217. <if test="ysje != null">
  218. and YSJE = #{ysje}
  219. </if>
  220. <if test="ysqje != null">
  221. and YSQJE = #{ysqje}
  222. </if>
  223. <if test="nys != null">
  224. and NYS = #{nys}
  225. </if>
  226. <if test="bm != null and bm != ''">
  227. and BM = #{bm}
  228. </if>
  229. <if test="fj != null and fj != ''">
  230. and FJ = #{fj}
  231. </if>
  232. <if test="nf != null">
  233. and NF = #{nf}
  234. </if>
  235. <if test="px != null and px != ''">
  236. and PX = #{px}
  237. </if>
  238. <if test="hjbm != null and hjbm != ''">
  239. and HJBM = #{hjbm}
  240. </if>
  241. <if test="bz != null and bz != ''">
  242. and BZ = #{bz}
  243. </if>
  244. <if test="dw1 != null">
  245. and DW1 = #{dw1}
  246. </if>
  247. <if test="dw2 != null">
  248. and DW2 = #{dw2}
  249. </if>
  250. <if test="dw3 != null">
  251. and DW3 = #{dw3}
  252. </if>
  253. <if test="dw4 != null">
  254. and DW4 = #{dw4}
  255. </if>
  256. <if test="dw5 != null">
  257. and DW5 = #{dw5}
  258. </if>
  259. <if test="dw6 != null">
  260. and DW6 = #{dw6}
  261. </if>
  262. <if test="dw7 != null">
  263. and DW7 = #{dw7}
  264. </if>
  265. <if test="dw8 != null">
  266. and DW8 = #{dw8}
  267. </if>
  268. <if test="dw9 != null">
  269. and DW9 = #{dw9}
  270. </if>
  271. <if test="dw10 != null">
  272. and DW10 = #{dw10}
  273. </if>
  274. <if test="sjys1 != null">
  275. and SJYS1 = #{sjys1}
  276. </if>
  277. <if test="sjys2 != null">
  278. and SJYS2 = #{sjys2}
  279. </if>
  280. <if test="sjys3 != null">
  281. and SJYS3 = #{sjys3}
  282. </if>
  283. <if test="sjys4 != null">
  284. and SJYS4 = #{sjys4}
  285. </if>
  286. <if test="sjys5 != null">
  287. and SJYS5 = #{sjys5}
  288. </if>
  289. <if test="sjys6 != null">
  290. and SJYS6 = #{sjys6}
  291. </if>
  292. <if test="sjys7 != null">
  293. and SJYS7 = #{sjys7}
  294. </if>
  295. <if test="sjys8 != null">
  296. and SJYS8 = #{sjys8}
  297. </if>
  298. <if test="sjys9 != null">
  299. and SJYS9 = #{sjys9}
  300. </if>
  301. <if test="sjys10 != null">
  302. and SJYS10 = #{sjys10}
  303. </if>
  304. <if test="xtjsyzx != null">
  305. and XTJSYZX = #{xtjsyzx}
  306. </if>
  307. <if test="xmz != null">
  308. and XMZ = #{xmz}
  309. </if>
  310. <if test="byj != null">
  311. and BYJ = #{byj}
  312. </if>
  313. <if test="zrje != null">
  314. and ZRJE = #{zrje}
  315. </if>
  316. <if test="rwsys != null">
  317. and RWSYS = #{rwsys}
  318. </if>
  319. <if test="xmzys != null">
  320. and XMZYS = #{xmzys}
  321. </if>
  322. <if test="ybzje != null">
  323. and YBZJE = #{ybzje}
  324. </if>
  325. <if test="zcbyj != null">
  326. and ZCBYJ = #{zcbyj}
  327. </if>
  328. <if test="kyys != null">
  329. and KYYS = #{kyys}
  330. </if>
  331. <if test="zcje != null">
  332. and ZCJE = #{zcje}
  333. </if>
  334. <if test="byjysq != null">
  335. and BYJYSQ = #{byjysq}
  336. </if>
  337. <if test="byqybz != null">
  338. and BYQYBZ = #{byqybz}
  339. </if>
  340. <if test="zrbyj != null">
  341. and ZRBYJ = #{zrbyj}
  342. </if>
  343. <if test="sjyzx != null">
  344. and SJYZX = #{sjyzx}
  345. </if>
  346. <if test="dnzyzf != null">
  347. and DNZYZF = #{dnzyzf}
  348. </if>
  349. </where>
  350. </select>
  351. <!--新增所有列-->
  352. <insert id="insert" keyProperty="id" useGeneratedKeys="true">
  353. insert into prj_AnnualBudgetDetail(FYMC, YSJE, YSQJE, NYS, BM, FJ, NF, PX, HJBM, BZ, DW1, DW2, DW3, DW4, DW5,
  354. DW6, DW7, DW8, DW9, DW10, SJYS1, SJYS2, SJYS3, SJYS4, SJYS5, SJYS6, SJYS7,
  355. SJYS8, SJYS9, SJYS10, XTJSYZX, XMZ, BYJ, ZRJE, RWSYS, XMZYS, YBZJE, ZCBYJ,
  356. KYYS, ZCJE, BYJYSQ, BYQYBZ, ZRBYJ, SJYZX, DNZYZF)
  357. values (#{fymc}, #{ysje}, #{ysqje}, #{nys}, #{bm}, #{fj}, #{nf}, #{px}, #{hjbm}, #{bz}, #{dw1}, #{dw2}, #{dw3},
  358. #{dw4}, #{dw5}, #{dw6}, #{dw7}, #{dw8}, #{dw9}, #{dw10}, #{sjys1}, #{sjys2}, #{sjys3}, #{sjys4},
  359. #{sjys5}, #{sjys6}, #{sjys7}, #{sjys8}, #{sjys9}, #{sjys10}, #{xtjsyzx}, #{xmz}, #{byj}, #{zrje},
  360. #{rwsys}, #{xmzys}, #{ybzje}, #{zcbyj}, #{kyys}, #{zcje}, #{byjysq}, #{byqybz}, #{zrbyj}, #{sjyzx},
  361. #{dnzyzf})
  362. </insert>
  363. <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
  364. insert into prj_AnnualBudgetDetail(FYMC, YSJE, YSQJE, NYS, BM, FJ, NF, PX, HJBM, BZ, DW1, DW2, DW3, DW4, DW5,
  365. DW6, DW7, DW8, DW9, DW10, SJYS1, SJYS2, SJYS3, SJYS4, SJYS5, SJYS6, SJYS7, SJYS8, SJYS9, SJYS10, XTJSYZX, XMZ,
  366. BYJ, ZRJE, RWSYS, XMZYS, YBZJE, ZCBYJ, KYYS, ZCJE, BYJYSQ, BYQYBZ, ZRBYJ, SJYZX, DNZYZF)
  367. values
  368. <foreach collection="entities" item="entity" separator=",">
  369. (#{entity.fymc}, #{entity.ysje}, #{entity.ysqje}, #{entity.nys}, #{entity.bm}, #{entity.fj}, #{entity.nf},
  370. #{entity.px}, #{entity.hjbm}, #{entity.bz}, #{entity.dw1}, #{entity.dw2}, #{entity.dw3}, #{entity.dw4},
  371. #{entity.dw5}, #{entity.dw6}, #{entity.dw7}, #{entity.dw8}, #{entity.dw9}, #{entity.dw10}, #{entity.sjys1},
  372. #{entity.sjys2}, #{entity.sjys3}, #{entity.sjys4}, #{entity.sjys5}, #{entity.sjys6}, #{entity.sjys7},
  373. #{entity.sjys8}, #{entity.sjys9}, #{entity.sjys10}, #{entity.xtjsyzx}, #{entity.xmz}, #{entity.byj},
  374. #{entity.zrje}, #{entity.rwsys}, #{entity.xmzys}, #{entity.ybzje}, #{entity.zcbyj}, #{entity.kyys},
  375. #{entity.zcje}, #{entity.byjysq}, #{entity.byqybz}, #{entity.zrbyj}, #{entity.sjyzx}, #{entity.dnzyzf})
  376. </foreach>
  377. on duplicate key update
  378. FYMC = values(FYMC),
  379. YSJE = values(YSJE),
  380. YSQJE = values(YSQJE),
  381. NYS = values(NYS),
  382. BM = values(BM),
  383. FJ = values(FJ),
  384. NF = values(NF),
  385. PX = values(PX),
  386. HJBM = values(HJBM),
  387. BZ = values(BZ),
  388. DW1 = values(DW1),
  389. DW2 = values(DW2),
  390. DW3 = values(DW3),
  391. DW4 = values(DW4),
  392. DW5 = values(DW5),
  393. DW6 = values(DW6),
  394. DW7 = values(DW7),
  395. DW8 = values(DW8),
  396. DW9 = values(DW9),
  397. DW10 = values(DW10),
  398. SJYS1 = values(SJYS1),
  399. SJYS2 = values(SJYS2),
  400. SJYS3 = values(SJYS3),
  401. SJYS4 = values(SJYS4),
  402. SJYS5 = values(SJYS5),
  403. SJYS6 = values(SJYS6),
  404. SJYS7 = values(SJYS7),
  405. SJYS8 = values(SJYS8),
  406. SJYS9 = values(SJYS9),
  407. SJYS10 = values(SJYS10),
  408. XTJSYZX = values(XTJSYZX),
  409. XMZ = values(XMZ),
  410. BYJ = values(BYJ),
  411. ZRJE = values(ZRJE),
  412. RWSYS = values(RWSYS),
  413. XMZYS = values(XMZYS),
  414. YBZJE = values(YBZJE),
  415. ZCBYJ = values(ZCBYJ),
  416. KYYS = values(KYYS),
  417. ZCJE = values(ZCJE),
  418. BYJYSQ = values(BYJYSQ),
  419. BYQYBZ = values(BYQYBZ),
  420. ZRBYJ = values(ZRBYJ),
  421. SJYZX = values(SJYZX),
  422. DNZYZF = values(DNZYZF)
  423. </insert>
  424. <!--通过主键修改数据-->
  425. <update id="update">
  426. update prj_AnnualBudgetDetail
  427. set XMZYS = #{xmzys},
  428. XTJSYZX = #{xtjsyzx},
  429. SJYZX = #{sjyzx},
  430. YSJE = #{ysje},
  431. XMZ = #{xmz},
  432. BYJ = #{byj}
  433. where ID = #{id}
  434. </update>
  435. <update id="updateRWSYS">
  436. update A
  437. set A.XMZYS = B.DW from prj_AnnualBudgetDetail A
  438. inner join (SELECT MC, ${DW} as DW
  439. , YSJE from prj_Budget where XM = #{id}) B
  440. on A.FYMC = B.MC
  441. where
  442. NYS in (SELECT ID from prj_AnnualBudget where RWS = #{id} )
  443. and A.FYMC != '1.外委研究支出费'
  444. and A.FYMC != '总计'
  445. </update>
  446. <update id="updateWWYJZCF">
  447. update prj_AnnualBudgetDetail
  448. set RWSYS = #{WWYJZCF},
  449. XMZYS = #{WWYJZCF}
  450. where NYS in (SELECT ID from prj_AnnualBudget where RWS = #{id})
  451. and FYMC = '1.外委研究支出费'
  452. </update>
  453. <update id="updateXMZYS">
  454. update prj_AnnualBudgetDetail
  455. set XMZYS = #{rwsys},
  456. rwsys = #{rwsys}
  457. where NYS in (SELECT ID from prj_AnnualBudget where RWS = #{id})
  458. and FYMC = '总计'
  459. </update>
  460. <update id="updateNDYS">
  461. update prj_AnnualBudgetDetail
  462. set YSJE = null
  463. where NYS in (SELECT ID from prj_AnnualBudget where RWS = #{id})
  464. and FYMC != '1.外委研究支出费' and FYMC != '总计'
  465. </update>
  466. <update id="updateWWYJZCFSUM">
  467. update A
  468. set A.xmzys = B.XMZYS from prj_AnnualBudgetDetail A
  469. inner join (
  470. SELECT sum(XMZYS)XMZYS ,pa.NYS
  471. from prj_AnnualBudgetDetail pa
  472. where NYS in (SELECT ID from prj_AnnualBudget where RWS = #{id})
  473. and (FYMC = '1.外委研究支出费' or FYMC = '2.仪器设备租赁费' or FYMC = '3.外协测试试验与加工费')
  474. group by pa.NYS
  475. ) B
  476. on A.NYS = B.NYS
  477. where
  478. a.FYMC = '(三)外委支出费'
  479. </update>
  480. <update id="updateRWSYS_SX">
  481. update A
  482. set A.xmzys = B.ysje from prj_AnnualBudgetDetail A
  483. inner join (SELECT MC,YSJE from prj_Budget where XM = #{id}) B
  484. on A.FYMC = B.MC
  485. where
  486. NYS in (SELECT ID from prj_AnnualBudget where RWS = #{id} )
  487. </update>
  488. <!--通过主键删除-->
  489. <delete id="deleteById">
  490. delete
  491. from prj_AnnualBudgetDetail
  492. where ID = #{id}
  493. </delete>
  494. <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
  495. insert into prj_AnnualBudgetDetail(FYMC, NYS, BM, FJ, NF, PX, HJBM, BZ, DW1, DW2, DW3, DW4, DW5, DW6, DW7, DW8,
  496. DW9, DW10, RWSYS,XMZYS)
  497. values
  498. <foreach collection="entities" item="entity" separator=",">
  499. (#{entity.mc}, #{entity.xm}, #{entity.bm}, #{entity.fj}, #{entity.nf}, #{entity.px}, #{entity.hjbm},
  500. #{entity.bz}, #{entity.dw1}, #{entity.dw2},
  501. #{entity.dw3}, #{entity.dw4}, #{entity.dw5}, #{entity.dw6}, #{entity.dw7}, #{entity.dw8}, #{entity.dw9},
  502. #{entity.dw10}, #{entity.ysje},#{entity.xmzys})
  503. </foreach>
  504. </insert>
  505. <!--获取年度预算-->
  506. <select id="getBudgetList" resultMap="PrjAnnualbudgetdetailMap">
  507. select (select FYMC from prj_AnnualBudgetDetail where BM = b.FJ and NYS = b.NYS) as FJMC,
  508. ID, b.FYMC, YSJE, YSQJE, NYS, BM, FJ, NF, PX, HJBM, BZ, DW1, DW2, DW3, DW4, DW5, DW6, DW7, DW8, DW9, DW10, SJYS1, SJYS2, SJYS3, SJYS4, SJYS5, SJYS6, SJYS7, SJYS8, SJYS9, SJYS10, XTJSYZX, XMZ,BYJ, ZRJE, RWSYS, XMZYS, YBZJE, ZCBYJ, KYYS, ZCJE, BYJYSQ, BYQYBZ, ZRBYJ, DNZYZF,
  509. a.bzje sjyzx,
  510. c.bndsqje,
  511. c.bndbzje
  512. from prj_AnnualBudgetDetail b
  513. left join (
  514. SELECT convert(decimal(18,2),(sum(BZJE)/10000)) BZJE ,pa.fymc
  515. from(SELECT id ,fylb
  516. from sta_BudgetApproval
  517. where nys in (
  518. select id
  519. from prj_AnnualBudget
  520. where rws = (select rws from prj_AnnualBudget where id = #{nys}) and nf &lt; (select nf from prj_AnnualBudget where id = #{nys}) )) sb
  521. left join sta_Reimbursement sa on sa.fysq = sb.id
  522. LEFT join prj_AnnualBudgetDetail pa on pa.id = sb.fylb group by pa.fymc
  523. ) a on a.fymc = b.fymc
  524. left join (
  525. SELECT SUM(sb.SQJE) bndsqje, SUM(sr.BZJE) bndbzje,pa.FYMC
  526. from
  527. sta_BudgetApproval sb
  528. left join sta_Reimbursement sr on sr.FYSQ = sb.ID and sr.SPZT = '审批结束'
  529. left join prj_AnnualBudgetDetail pa on pa.ID = sb.FYLB
  530. where
  531. sb.NYS = #{nys} and sb.SPZT != '作废'
  532. GROUP by pa.FYMC
  533. ) c on c.fymc = b.fymc
  534. where NYS = #{nys}
  535. </select>
  536. <!--获取费用申请年度预算-->
  537. <select id="getFysqBudgetList" resultMap="PrjAnnualbudgetdetailMap">
  538. select (select FYMC from prj_AnnualBudgetDetail where BM = b.FJ and NYS = b.NYS) as FJMC, b.*
  539. from prj_AnnualBudgetDetail b
  540. where NYS = #{nys}
  541. -- and ID not in (select FYLB from sta_BudgetApproval where FYLB = b.ID and SPZT != '作废')
  542. </select>
  543. <!--批量删除年度预算明细-->
  544. <delete id="batchDelete" parameterType="java.util.ArrayList">
  545. delete from prj_AnnualBudgetDetail
  546. where NYS in
  547. <foreach item="item" index="index" collection="nysList" open="(" separator="," close=")">
  548. #{item}
  549. </foreach>
  550. </delete>
  551. <!--获取费用申请年度预算-->
  552. <select id="getSubNode" resultMap="PrjAnnualbudgetdetailMap">
  553. select top ${limit} *
  554. from (
  555. select
  556. (select FYMC from prj_AnnualBudgetDetail where BM = b.FJ and NYS = b.NYS) as FJMC,
  557. b.*,
  558. row_number() over (order by b.id asc) as rownumber
  559. from prj_AnnualBudgetDetail b
  560. where NYS = #{nys}
  561. and BM not in (select distinct FJ from prj_AnnualBudgetDetail where FJ != ''
  562. AND NYS=#{nys})
  563. <if test="mc != null and mc != ''">
  564. AND b.FYMC LIKE CONCAT('%',#{mc},'%')
  565. </if>
  566. ) temp_row
  567. where rownumber > ((${page} - 1) * ${limit})
  568. </select>
  569. <select id="selectWWYJZCF_GW" resultType="java.math.BigDecimal">
  570. select ((SELECT SUM(SKJE)
  571. from (SELECT ID, ZB from prj_feescheme where ZB = #{id} and DWMC LIKE '%国网陕西省电力%') pf
  572. left join prj_UndertakeCompany pu on pu.ZB = pf.ID
  573. where pu.DWMC not LIKE '%国网陕西省电力%')
  574. +
  575. (select ISNULL(${DW}, 0)
  576. from prj_Budget
  577. where XM = #{id}
  578. and mc = '1.外委研究支出费'))
  579. </select>
  580. <select id="selectWWYJZCF_SX" resultType="java.math.BigDecimal">
  581. SELECT YSJE - ISNULL(${DW}, 0) + (select ISNULL(${DW}, 0) from prj_Budget where XM = #{id} and mc = '1.外委研究支出费')
  582. from prj_Budget
  583. where XM = #{id}
  584. and MC = '总计'
  585. </select>
  586. <select id="selectXMZYS" resultType="java.math.BigDecimal">
  587. SELECT SUM(CZJE)
  588. from prj_feescheme
  589. where ZB = #{id}
  590. and DWMC LIKE '%国网陕西省电力%'
  591. </select>
  592. <select id="selectXMZYS_SX" resultType="java.math.BigDecimal">
  593. SELECT SUM(CZJE)
  594. from prj_feescheme
  595. where ZB = #{id}
  596. </select>
  597. <select id="getSubNodeCount" resultType="java.lang.Integer">
  598. select
  599. count(*)
  600. from prj_AnnualBudgetDetail b
  601. where NYS = #{nys}
  602. and BM not in (select distinct FJ from prj_AnnualBudgetDetail where FJ != ''
  603. AND NYS=#{nys})
  604. </select>
  605. <select id="getYzxqk" resultType="com.liang.vo.PrjAnnualbudgetYzxqkVo">
  606. SELECT convert(decimal(18,2),(sum(BZJE)/10000)) BZJE ,pa.fymc,sb.nf
  607. from(SELECT sb.id ,sb.fylb,pa.nf
  608. from sta_BudgetApproval sb
  609. left join prj_AnnualBudget pa on pa.id = sb.nys
  610. where nys in (
  611. select id
  612. from prj_AnnualBudget
  613. where rws = (select rws from prj_AnnualBudget where ID = #{nys})
  614. AND NF &lt;( select DISTINCT NF from prj_AnnualBudget where id = #{nys} )
  615. )) sb
  616. left join sta_Reimbursement sa on sa.fysq = sb.id
  617. LEFT join prj_AnnualBudgetDetail pa on pa.id = sb.fylb
  618. group by pa.fymc,sb.nf
  619. order by sb.nf asc
  620. </select>
  621. <select id="getNf" resultType="com.liang.vo.PrjAnnualbudgetYzxqkVo">
  622. select DISTINCT NF
  623. from prj_AnnualBudget
  624. where
  625. rws = (SELECT RWS from prj_AnnualBudget where id = #{nys})
  626. AND NF &lt;( select DISTINCT NF from prj_AnnualBudget where id = #{nys} )
  627. </select>
  628. <select id="listAllBudgetDetail" resultType="com.liang.entity.PrjAnnualbudgetdetail">
  629. select a.FYMC ,a.YSJE ,b.NF
  630. from
  631. prj_AnnualBudgetDetail A
  632. left join prj_AnnualBudget B on b.ID = A.NYS
  633. where
  634. nys in (select ID from prj_AnnualBudget where rws = (select rws from prj_AnnualBudget where id = #{nys}))
  635. </select>
  636. </mapper>