ExpenseAccountMapper.xml 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015
  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.goafanti.common.dao.ExpenseAccountMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.ExpenseAccount">
  5. <id column="id" jdbcType="INTEGER" property="id" />
  6. <result column="prid" jdbcType="INTEGER" property="prid" />
  7. <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
  8. <result column="aid" jdbcType="VARCHAR" property="aid" />
  9. <result column="aname" jdbcType="VARCHAR" property="aname" />
  10. <result column="type" jdbcType="INTEGER" property="type" />
  11. <result column="type_other" jdbcType="VARCHAR" property="typeOther" />
  12. <result column="status" jdbcType="INTEGER" property="status" />
  13. <result column="process_status" jdbcType="INTEGER" property="processStatus" />
  14. <result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
  15. <result column="attachment_url" jdbcType="VARCHAR" property="attachmentUrl" />
  16. <result column="apply_dep" jdbcType="VARCHAR" property="applyDep" />
  17. <result column="pay_dep" jdbcType="VARCHAR" property="payDep" />
  18. <result column="eaaid" jdbcType="INTEGER" property="eaaid" />
  19. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  20. <result column="district_name" jdbcType="VARCHAR" property="districtName" />
  21. <result column="user_names" jdbcType="VARCHAR" property="userNames" />
  22. <result column="release_start" jdbcType="TIMESTAMP" property="releaseStart" />
  23. <result column="release_end" jdbcType="TIMESTAMP" property="releaseEnd" />
  24. <result column="duration" jdbcType="DOUBLE" property="duration" />
  25. <result column="examine_name" jdbcType="VARCHAR" property="examineName" />
  26. <result column="settlement_amount" jdbcType="DECIMAL" property="settlementAmount" />
  27. <result column="debit_id" jdbcType="INTEGER" property="debitId" />
  28. <result column="target_type" jdbcType="INTEGER" property="targetType" />
  29. <result column="liquidation_status" jdbcType="INTEGER" property="liquidationStatus" />
  30. <result column="remarks" jdbcType="VARCHAR" property="remarks" />
  31. <result column="check_no" jdbcType="VARCHAR" property="checkNo" />
  32. <result column="expense_main" jdbcType="INTEGER" property="expenseMain" />
  33. <result column="real_amount" jdbcType="DECIMAL" property="realAmount" />
  34. <result column="secondary_type" jdbcType="INTEGER" property="secondaryType" />
  35. <result column="secondary_type_other" jdbcType="VARCHAR" property="secondaryTypeOther" />
  36. </resultMap>
  37. <sql id="Base_Column_List">
  38. id, prid, order_no, aid, aname, `type`, type_other, `status`, process_status, total_amount,
  39. attachment_url, apply_dep, pay_dep, eaaid, create_time, district_name, user_names,
  40. release_start, release_end, duration, examine_name, settlement_amount, debit_id,
  41. target_type, liquidation_status, remarks, check_no, expense_main, real_amount, secondary_type,
  42. secondary_type_other
  43. </sql>
  44. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  45. select
  46. <include refid="Base_Column_List" />
  47. from expense_account
  48. where id = #{id,jdbcType=INTEGER}
  49. </select>
  50. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  51. delete from expense_account
  52. where id = #{id,jdbcType=INTEGER}
  53. </delete>
  54. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseAccount" useGeneratedKeys="true">
  55. insert into expense_account (prid, order_no, aid,
  56. aname, `type`, type_other,
  57. `status`, process_status, total_amount,
  58. attachment_url, apply_dep, pay_dep,
  59. eaaid, create_time, district_name,
  60. user_names, release_start, release_end,
  61. duration, examine_name, settlement_amount,
  62. debit_id, target_type, liquidation_status,
  63. remarks, check_no, expense_main,
  64. real_amount, secondary_type, secondary_type_other
  65. )
  66. values (#{prid,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR},
  67. #{aname,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{typeOther,jdbcType=VARCHAR},
  68. #{status,jdbcType=INTEGER}, #{processStatus,jdbcType=INTEGER}, #{totalAmount,jdbcType=DECIMAL},
  69. #{attachmentUrl,jdbcType=VARCHAR}, #{applyDep,jdbcType=VARCHAR}, #{payDep,jdbcType=VARCHAR},
  70. #{eaaid,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{districtName,jdbcType=VARCHAR},
  71. #{userNames,jdbcType=VARCHAR}, #{releaseStart,jdbcType=TIMESTAMP}, #{releaseEnd,jdbcType=TIMESTAMP},
  72. #{duration,jdbcType=DOUBLE}, #{examineName,jdbcType=VARCHAR}, #{settlementAmount,jdbcType=DECIMAL},
  73. #{debitId,jdbcType=INTEGER}, #{targetType,jdbcType=INTEGER}, #{liquidationStatus,jdbcType=INTEGER},
  74. #{remarks,jdbcType=VARCHAR}, #{checkNo,jdbcType=VARCHAR}, #{expenseMain,jdbcType=INTEGER},
  75. #{realAmount,jdbcType=DECIMAL}, #{secondaryType,jdbcType=INTEGER}, #{secondaryTypeOther,jdbcType=VARCHAR}
  76. )
  77. </insert>
  78. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseAccount" useGeneratedKeys="true">
  79. insert into expense_account
  80. <trim prefix="(" suffix=")" suffixOverrides=",">
  81. <if test="prid != null">
  82. prid,
  83. </if>
  84. <if test="orderNo != null">
  85. order_no,
  86. </if>
  87. <if test="aid != null">
  88. aid,
  89. </if>
  90. <if test="aname != null">
  91. aname,
  92. </if>
  93. <if test="type != null">
  94. `type`,
  95. </if>
  96. <if test="typeOther != null">
  97. type_other,
  98. </if>
  99. <if test="status != null">
  100. `status`,
  101. </if>
  102. <if test="processStatus != null">
  103. process_status,
  104. </if>
  105. <if test="totalAmount != null">
  106. total_amount,
  107. </if>
  108. <if test="attachmentUrl != null">
  109. attachment_url,
  110. </if>
  111. <if test="applyDep != null">
  112. apply_dep,
  113. </if>
  114. <if test="payDep != null">
  115. pay_dep,
  116. </if>
  117. <if test="eaaid != null">
  118. eaaid,
  119. </if>
  120. <if test="createTime != null">
  121. create_time,
  122. </if>
  123. <if test="districtName != null">
  124. district_name,
  125. </if>
  126. <if test="userNames != null">
  127. user_names,
  128. </if>
  129. <if test="releaseStart != null">
  130. release_start,
  131. </if>
  132. <if test="releaseEnd != null">
  133. release_end,
  134. </if>
  135. <if test="duration != null">
  136. duration,
  137. </if>
  138. <if test="examineName != null">
  139. examine_name,
  140. </if>
  141. <if test="settlementAmount != null">
  142. settlement_amount,
  143. </if>
  144. <if test="debitId != null">
  145. debit_id,
  146. </if>
  147. <if test="targetType != null">
  148. target_type,
  149. </if>
  150. <if test="liquidationStatus != null">
  151. liquidation_status,
  152. </if>
  153. <if test="remarks != null">
  154. remarks,
  155. </if>
  156. <if test="checkNo != null">
  157. check_no,
  158. </if>
  159. <if test="expenseMain != null">
  160. expense_main,
  161. </if>
  162. <if test="realAmount != null">
  163. real_amount,
  164. </if>
  165. <if test="secondaryType != null">
  166. secondary_type,
  167. </if>
  168. <if test="secondaryTypeOther != null">
  169. secondary_type_other,
  170. </if>
  171. </trim>
  172. <trim prefix="values (" suffix=")" suffixOverrides=",">
  173. <if test="prid != null">
  174. #{prid,jdbcType=INTEGER},
  175. </if>
  176. <if test="orderNo != null">
  177. #{orderNo,jdbcType=VARCHAR},
  178. </if>
  179. <if test="aid != null">
  180. #{aid,jdbcType=VARCHAR},
  181. </if>
  182. <if test="aname != null">
  183. #{aname,jdbcType=VARCHAR},
  184. </if>
  185. <if test="type != null">
  186. #{type,jdbcType=INTEGER},
  187. </if>
  188. <if test="typeOther != null">
  189. #{typeOther,jdbcType=VARCHAR},
  190. </if>
  191. <if test="status != null">
  192. #{status,jdbcType=INTEGER},
  193. </if>
  194. <if test="processStatus != null">
  195. #{processStatus,jdbcType=INTEGER},
  196. </if>
  197. <if test="totalAmount != null">
  198. #{totalAmount,jdbcType=DECIMAL},
  199. </if>
  200. <if test="attachmentUrl != null">
  201. #{attachmentUrl,jdbcType=VARCHAR},
  202. </if>
  203. <if test="applyDep != null">
  204. #{applyDep,jdbcType=VARCHAR},
  205. </if>
  206. <if test="payDep != null">
  207. #{payDep,jdbcType=VARCHAR},
  208. </if>
  209. <if test="eaaid != null">
  210. #{eaaid,jdbcType=INTEGER},
  211. </if>
  212. <if test="createTime != null">
  213. #{createTime,jdbcType=TIMESTAMP},
  214. </if>
  215. <if test="districtName != null">
  216. #{districtName,jdbcType=VARCHAR},
  217. </if>
  218. <if test="userNames != null">
  219. #{userNames,jdbcType=VARCHAR},
  220. </if>
  221. <if test="releaseStart != null">
  222. #{releaseStart,jdbcType=TIMESTAMP},
  223. </if>
  224. <if test="releaseEnd != null">
  225. #{releaseEnd,jdbcType=TIMESTAMP},
  226. </if>
  227. <if test="duration != null">
  228. #{duration,jdbcType=DOUBLE},
  229. </if>
  230. <if test="examineName != null">
  231. #{examineName,jdbcType=VARCHAR},
  232. </if>
  233. <if test="settlementAmount != null">
  234. #{settlementAmount,jdbcType=DECIMAL},
  235. </if>
  236. <if test="debitId != null">
  237. #{debitId,jdbcType=INTEGER},
  238. </if>
  239. <if test="targetType != null">
  240. #{targetType,jdbcType=INTEGER},
  241. </if>
  242. <if test="liquidationStatus != null">
  243. #{liquidationStatus,jdbcType=INTEGER},
  244. </if>
  245. <if test="remarks != null">
  246. #{remarks,jdbcType=VARCHAR},
  247. </if>
  248. <if test="checkNo != null">
  249. #{checkNo,jdbcType=VARCHAR},
  250. </if>
  251. <if test="expenseMain != null">
  252. #{expenseMain,jdbcType=INTEGER},
  253. </if>
  254. <if test="realAmount != null">
  255. #{realAmount,jdbcType=DECIMAL},
  256. </if>
  257. <if test="secondaryType != null">
  258. #{secondaryType,jdbcType=INTEGER},
  259. </if>
  260. <if test="secondaryTypeOther != null">
  261. #{secondaryTypeOther,jdbcType=VARCHAR},
  262. </if>
  263. </trim>
  264. </insert>
  265. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.ExpenseAccount">
  266. update expense_account
  267. <set>
  268. <if test="prid != null">
  269. prid = #{prid,jdbcType=INTEGER},
  270. </if>
  271. <if test="orderNo != null">
  272. order_no = #{orderNo,jdbcType=VARCHAR},
  273. </if>
  274. <if test="aid != null">
  275. aid = #{aid,jdbcType=VARCHAR},
  276. </if>
  277. <if test="aname != null">
  278. aname = #{aname,jdbcType=VARCHAR},
  279. </if>
  280. <if test="type != null">
  281. `type` = #{type,jdbcType=INTEGER},
  282. </if>
  283. <if test="typeOther != null">
  284. type_other = #{typeOther,jdbcType=VARCHAR},
  285. </if>
  286. <if test="status != null">
  287. `status` = #{status,jdbcType=INTEGER},
  288. </if>
  289. <if test="processStatus != null">
  290. process_status = #{processStatus,jdbcType=INTEGER},
  291. </if>
  292. <if test="totalAmount != null">
  293. total_amount = #{totalAmount,jdbcType=DECIMAL},
  294. </if>
  295. <if test="attachmentUrl != null">
  296. attachment_url = #{attachmentUrl,jdbcType=VARCHAR},
  297. </if>
  298. <if test="applyDep != null">
  299. apply_dep = #{applyDep,jdbcType=VARCHAR},
  300. </if>
  301. <if test="payDep != null">
  302. pay_dep = #{payDep,jdbcType=VARCHAR},
  303. </if>
  304. <if test="eaaid != null">
  305. eaaid = #{eaaid,jdbcType=INTEGER},
  306. </if>
  307. <if test="createTime != null">
  308. create_time = #{createTime,jdbcType=TIMESTAMP},
  309. </if>
  310. <if test="districtName != null">
  311. district_name = #{districtName,jdbcType=VARCHAR},
  312. </if>
  313. <if test="userNames != null">
  314. user_names = #{userNames,jdbcType=VARCHAR},
  315. </if>
  316. <if test="releaseStart != null">
  317. release_start = #{releaseStart,jdbcType=TIMESTAMP},
  318. </if>
  319. <if test="releaseEnd != null">
  320. release_end = #{releaseEnd,jdbcType=TIMESTAMP},
  321. </if>
  322. <if test="duration != null">
  323. duration = #{duration,jdbcType=DOUBLE},
  324. </if>
  325. <if test="examineName != null">
  326. examine_name = #{examineName,jdbcType=VARCHAR},
  327. </if>
  328. <if test="settlementAmount != null">
  329. settlement_amount = #{settlementAmount,jdbcType=DECIMAL},
  330. </if>
  331. <if test="debitId != null">
  332. debit_id = #{debitId,jdbcType=INTEGER},
  333. </if>
  334. <if test="targetType != null">
  335. target_type = #{targetType,jdbcType=INTEGER},
  336. </if>
  337. <if test="liquidationStatus != null">
  338. liquidation_status = #{liquidationStatus,jdbcType=INTEGER},
  339. </if>
  340. <if test="remarks != null">
  341. remarks = #{remarks,jdbcType=VARCHAR},
  342. </if>
  343. <if test="checkNo != null">
  344. check_no = #{checkNo,jdbcType=VARCHAR},
  345. </if>
  346. <if test="expenseMain != null">
  347. expense_main = #{expenseMain,jdbcType=INTEGER},
  348. </if>
  349. <if test="realAmount != null">
  350. real_amount = #{realAmount,jdbcType=DECIMAL},
  351. </if>
  352. <if test="secondaryType != null">
  353. secondary_type = #{secondaryType,jdbcType=INTEGER},
  354. </if>
  355. <if test="secondaryTypeOther != null">
  356. secondary_type_other = #{secondaryTypeOther,jdbcType=VARCHAR},
  357. </if>
  358. </set>
  359. where id = #{id,jdbcType=INTEGER}
  360. </update>
  361. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.ExpenseAccount">
  362. update expense_account
  363. set prid = #{prid,jdbcType=INTEGER},
  364. order_no = #{orderNo,jdbcType=VARCHAR},
  365. aid = #{aid,jdbcType=VARCHAR},
  366. aname = #{aname,jdbcType=VARCHAR},
  367. `type` = #{type,jdbcType=INTEGER},
  368. type_other = #{typeOther,jdbcType=VARCHAR},
  369. `status` = #{status,jdbcType=INTEGER},
  370. process_status = #{processStatus,jdbcType=INTEGER},
  371. total_amount = #{totalAmount,jdbcType=DECIMAL},
  372. attachment_url = #{attachmentUrl,jdbcType=VARCHAR},
  373. apply_dep = #{applyDep,jdbcType=VARCHAR},
  374. pay_dep = #{payDep,jdbcType=VARCHAR},
  375. eaaid = #{eaaid,jdbcType=INTEGER},
  376. create_time = #{createTime,jdbcType=TIMESTAMP},
  377. district_name = #{districtName,jdbcType=VARCHAR},
  378. user_names = #{userNames,jdbcType=VARCHAR},
  379. release_start = #{releaseStart,jdbcType=TIMESTAMP},
  380. release_end = #{releaseEnd,jdbcType=TIMESTAMP},
  381. duration = #{duration,jdbcType=DOUBLE},
  382. examine_name = #{examineName,jdbcType=VARCHAR},
  383. settlement_amount = #{settlementAmount,jdbcType=DECIMAL},
  384. debit_id = #{debitId,jdbcType=INTEGER},
  385. target_type = #{targetType,jdbcType=INTEGER},
  386. liquidation_status = #{liquidationStatus,jdbcType=INTEGER},
  387. remarks = #{remarks,jdbcType=VARCHAR},
  388. check_no = #{checkNo,jdbcType=VARCHAR},
  389. expense_main = #{expenseMain,jdbcType=INTEGER},
  390. real_amount = #{realAmount,jdbcType=DECIMAL},
  391. secondary_type = #{secondaryType,jdbcType=INTEGER},
  392. secondary_type_other = #{secondaryTypeOther,jdbcType=VARCHAR}
  393. where id = #{id,jdbcType=INTEGER}
  394. </update>
  395. <sql id="selectDtailsSql">
  396. a.id, a.prid, a.order_no orderNo, o.contract_no contractNo ,tm.buyer_name buyerName, a.aid, a.aname, a.`type`,
  397. a.type_other typeOther , a.status,a.process_status processStatus,a.total_amount totalAmount,a.debit_id debitId,
  398. a.attachment_url attachmentUrl,a.apply_dep applyDep, a.pay_dep payDep, a.eaaid,a.district_name districtName,
  399. a.user_names userNames,a.create_time, a.release_start,a.release_end, a.duration,b.name appDepName,
  400. c.name payDepName,d.name ,d.bank ,d.accounts ,a.settlement_amount settlementAmount,a.secondary_type secondaryType,
  401. a.liquidation_status liquidationStatus, a.remarks,a.check_no checkNo,a.secondary_type_other secondaryTypeOther,
  402. date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,
  403. date_format(a.release_start,'%Y-%m-%d %H:%i:%S')releaseStartStr,
  404. date_format(a.release_end,'%Y-%m-%d %H:%i:%S')releaseEndStr
  405. FROM expense_account a left join department b on a.apply_dep =b.id left join department c on a.pay_dep =c.id
  406. left join expense_account_private d on a.eaaid=d.id left join t_order_new o on a.order_no =o.order_no
  407. left join t_order_mid tm on a.order_no =tm.order_no
  408. </sql>
  409. <select id="selectByid" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccount">
  410. SELECT
  411. <include refid="selectDtailsSql"/>
  412. WHERE a.id= #{id}
  413. </select>
  414. <select id="selectByCheckNo" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccount">
  415. SELECT
  416. <include refid="selectDtailsSql"/>
  417. WHERE a.check_no= #{checkNo}
  418. </select>
  419. <select id="selectExpenseAccountList" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccountBo">
  420. select a.id,a.total_amount totalAmount,a.`type`,a.process_status processStatus,a.type_other typeOther,
  421. a.attachment_url attachmentUrl,a.target_type targetType , e.contract_no contractNo,tm.buyer_name buyerName ,
  422. a.secondary_type secondaryType, a.secondary_type_other secondaryTypeOther,a.status,
  423. date_format(a.release_start,'%Y-%m-%d %H:%i:%S')releaseStartStr,
  424. date_format(a.release_end,'%Y-%m-%d %H:%i:%S')releaseEndStr,
  425. <if test="processStatus ==1">
  426. eae.type eaeType,
  427. </if>
  428. <if test="expenseMain ==0">
  429. mea.examine_name examineName,mea.check_no checkNo,
  430. </if>
  431. <if test="expenseMain ==1">
  432. a.examine_name examineName,a.check_no checkNo,
  433. </if>
  434. f.name depName,d2.name financeName, date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,a.aname,
  435. b.name appDepName, c.name payDepName
  436. from expense_account a
  437. left join admin d on a.aid =d.id left join t_order_new e on a.order_no =e.order_no
  438. left join t_order_mid tm on a.order_no =tm.order_no left join department f on d.department_id =f.id
  439. left join admin d2 on f.finance_id =d2.id left join expense_relationship er on a.id=er.ea_id
  440. left join expense_account mea on er.id=mea.id
  441. <if test="expenseMain ==0">
  442. left join department b on mea.apply_dep =b.id left join department c on mea.pay_dep =c.id
  443. </if>
  444. <if test="expenseMain ==1">
  445. left join department b on a.apply_dep =b.id left join department c on a.pay_dep =c.id
  446. </if>
  447. <if test="processStatus ==1">
  448. inner join (select eaid ,auditor,min(process_status)`type` from expense_account_examine
  449. where auditor= #{auditor} group by eaid) eae on a.id=eae.eaid
  450. </if>
  451. where 1=1
  452. <if test="processStatus ==2">
  453. and a.process_status>=0
  454. <if test="examineStatus ==1">
  455. and a.status=1
  456. </if>
  457. <if test="examineStatus ==2">
  458. and a.status=2
  459. </if>
  460. </if>
  461. <if test=" aid !=null">
  462. and a.aid= #{aid}
  463. </if>
  464. <if test="processStatus ==1">
  465. and a.process_status>0
  466. <if test="examineStatus ==0">
  467. and a.process_status =eae.`type`
  468. </if>
  469. <if test="examineStatus ==1">
  470. and a.process_status >eae.`type`
  471. </if>
  472. </if>
  473. <if test="status != null">
  474. and a.status= #{status}
  475. </if>
  476. <if test="type != null">
  477. and a.type= #{type}
  478. </if>
  479. <if test="checkNo != null " >
  480. <if test="expenseMain ==0">
  481. and mea.check_no like concat('%',#{checkNo},'%')
  482. </if>
  483. <if test="expenseMain ==1">
  484. and a.check_no like concat('%',#{checkNo},'%')
  485. </if>
  486. </if>
  487. <if test="username != null" >
  488. and tm.buyer_name like concat('%',#{username},'%')
  489. </if>
  490. <if test="startTime !=null and endTime !=null">
  491. and a.create_time between #{startTime} and #{endTime}
  492. </if>
  493. <if test="depId != null">
  494. and d.department_id = #{depId}
  495. </if>
  496. <if test="contractNo != null">
  497. and e.contract_no = #{contractNo}
  498. </if>
  499. <if test="applyDep != null">
  500. and a.apply_dep = #{applyDep}
  501. </if>
  502. <if test="payDep != null">
  503. and a.pay_dep = #{payDep}
  504. </if>
  505. <if test="expenseMain != null">
  506. and a.expense_main= #{expenseMain}
  507. </if>
  508. <if test="secondaryType != null">
  509. and a.secondary_type= #{secondaryType}
  510. </if>
  511. order by a.status,a.create_time desc
  512. <if test="page_sql !=null">
  513. ${page_sql}
  514. </if>
  515. </select>
  516. <select id="selectExpenseAccountCount" resultType="java.lang.Integer">
  517. select count(*)
  518. from expense_account a left join department b on a.apply_dep =b.id left join department c on a.pay_dep =c.id
  519. left join admin d on a.aid =d.id left join t_order_new e on a.order_no =e.order_no
  520. left join t_order_mid tm on a.order_no =tm.order_no
  521. <if test="processStatus ==1">
  522. inner join (select eaid ,auditor,min(process_status)`type` from expense_account_examine
  523. where auditor= #{auditor} group by eaid) eae on a.id=eae.eaid
  524. </if>
  525. where 1=1
  526. <if test="processStatus ==2">
  527. and a.process_status>=0
  528. <if test="examineStatus ==1">
  529. and a.status=1
  530. </if>
  531. <if test="examineStatus ==2">
  532. and a.status=2
  533. </if>
  534. </if>
  535. <if test=" aid !=null">
  536. and a.aid= #{aid}
  537. </if>
  538. <if test="processStatus ==1">
  539. and a.process_status>0
  540. <if test="examineStatus ==0">
  541. and a.process_status =eae.`type`
  542. </if>
  543. <if test="examineStatus ==1">
  544. and a.process_status >eae.`type`
  545. </if>
  546. </if>
  547. <if test="status != null">
  548. and a.status= #{status}
  549. </if>
  550. <if test="type != null">
  551. and a.type= #{type}
  552. </if>
  553. <if test="checkNo != null " >
  554. and a.check_no like concat('%',#{checkNo},'%')
  555. </if>
  556. <if test="username != null" >
  557. and tm.buyer_name like concat('%',#{username},'%')
  558. </if>
  559. <if test="startTime !=null and endTime !=null">
  560. and a.create_time between #{startTime} and #{endTime}
  561. </if>
  562. <if test="depId != null">
  563. and d.department_id = #{depId}
  564. </if>
  565. <if test="contractNo != null">
  566. and e.contract_no = #{contractNo}
  567. </if>
  568. <if test="applyDep != null">
  569. and a.apply_dep = #{applyDep}
  570. </if>
  571. <if test="payDep != null">
  572. and a.pay_dep = #{payDep}
  573. </if>
  574. <if test="expenseMain != null">
  575. and a.expense_main = #{expenseMain}
  576. </if>
  577. <if test="secondaryType != null">
  578. and a.secondary_type= #{secondaryType}
  579. </if>
  580. </select>
  581. <select id="selectExpenseAccountTotalAmount" resultType="java.lang.Integer">
  582. select sum(a.total_amount) totalAmount
  583. from expense_account a left join department b on a.apply_dep =b.id left join department c on a.pay_dep =c.id
  584. left join admin d on a.aid =d.id left join t_order_new e on a.order_no =e.order_no
  585. left join t_order_mid tm on a.order_no =tm.order_no
  586. <if test="processStatus ==1">
  587. inner join (select eaid ,auditor,min(process_status)`type` from expense_account_examine
  588. where auditor= #{auditor} group by eaid) eae on a.id=eae.eaid
  589. </if>
  590. where 1=1
  591. <if test="processStatus ==2">
  592. and a.process_status>=0
  593. <if test="examineStatus ==1">
  594. and a.status=1
  595. </if>
  596. <if test="examineStatus ==2">
  597. and a.status=2
  598. </if>
  599. </if>
  600. <if test=" aid !=null">
  601. and a.aid= #{aid}
  602. </if>
  603. <if test="processStatus ==1">
  604. and a.process_status>0
  605. <if test="examineStatus ==0">
  606. and a.process_status =eae.`type`
  607. </if>
  608. <if test="examineStatus ==1">
  609. and a.process_status >eae.`type`
  610. </if>
  611. </if>
  612. <if test="status != null">
  613. and a.status= #{status}
  614. </if>
  615. <if test="type != null">
  616. and a.type= #{type}
  617. </if>
  618. <if test="checkNo != null " >
  619. and a.check_no like concat('%',#{checkNo},'%')
  620. </if>
  621. <if test="username != null" >
  622. and tm.buyer_name like concat('%',#{username},'%')
  623. </if>
  624. <if test="startTime !=null and endTime !=null">
  625. and a.create_time between #{startTime} and #{endTime}
  626. </if>
  627. <if test="depId != null">
  628. and d.department_id = #{depId}
  629. </if>
  630. <if test="contractNo != null">
  631. and e.contract_no = #{contractNo}
  632. </if>
  633. <if test="applyDep != null">
  634. and a.apply_dep = #{applyDep}
  635. </if>
  636. <if test="payDep != null">
  637. and a.pay_dep = #{payDep}
  638. </if>
  639. <if test="expenseMain != null">
  640. and a.expense_main = #{expenseMain}
  641. </if>
  642. <if test="secondaryType != null">
  643. and a.secondary_type= #{secondaryType}
  644. </if>
  645. </select>
  646. <select id="selectByaidAndPrid" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccount">
  647. SELECT
  648. <include refid="selectDtailsSql"/>
  649. WHERE a.status= #{status}
  650. and a.prid= #{prid} and a.aid = #{aid}
  651. </select>
  652. <select id="selectByaidAndType" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccount">
  653. SELECT
  654. a.id, a.prid, a.order_no orderNo, o.contract_no contractNo ,tm.buyer_name buyerName, a.aid, a.aname, a.`type`,
  655. a.type_other typeOther , a.status,a.process_status processStatus,a.total_amount totalAmount,a.debit_id debitId,
  656. a.attachment_url attachmentUrl,a.apply_dep applyDep, a.pay_dep payDep, a.eaaid,a.district_name districtName,
  657. a.user_names userNames,a.create_time, a.release_start,a.release_end, a.duration,b.name appDepName,
  658. c.name payDepName,d.name ,d.bank ,d.accounts ,t0.amount settlementAmount,a.check_no checkNo,
  659. a.liquidation_status liquidationStatus, a.remarks,
  660. date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,
  661. date_format(a.release_start,'%Y-%m-%d %H:%i:%S')releaseStartStr,
  662. date_format(a.release_end,'%Y-%m-%d %H:%i:%S')releaseEndStr
  663. FROM expense_account a left join department b on a.apply_dep =b.id left join department c on a.pay_dep =c.id
  664. left join expense_account_private d on a.eaaid=d.id left join t_order_new o on a.order_no =o.order_no
  665. left join t_order_mid tm on a.order_no =tm.order_no
  666. left join (select debit_id ,sum(settlement_amount) amount from expense_account where debit_id is not null and
  667. id != #{id} group by debit_id )t0 on a.id =t0.debit_id
  668. WHERE a.status=2 and a.liquidation_status in (0,1,2)
  669. and a.aid= #{aid} and a.type= #{type} and a.pay_dep= #{depId}
  670. order by a.create_time desc
  671. </select>
  672. <select id="selectStatistics" resultType="com.goafanti.expenseAccount.bo.OutMyEAStatistics">
  673. select a.aid,a.aname ,a.type,a.status ,a.total_amount totalAmount ,ifnull(a.debit_id,0) debitId ,a.target_type targetType ,ifnull(a2.total_amount,0) bxdkAmount
  674. from expense_account a
  675. left join expense_account a2 on a.debit_id =a2.id left join admin ad on a.aid=ad.id
  676. where 1=1 and a.expense_main=0
  677. <if test="name != null">
  678. and a.aname like concat('%',#{name},'%')
  679. </if>
  680. <if test="depId != null">
  681. and ad.department_id = #{depId}
  682. </if>
  683. <if test="startTime != null and endTime != null">
  684. and a.create_time between #{startTime} and #{endTime}
  685. </if>
  686. </select>
  687. <select id="selectByDebitId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  688. select
  689. <include refid="Base_Column_List" />
  690. from expense_account
  691. where debit_id = #{debitId}
  692. </select>
  693. <select id="selectByCheckNoNot" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  694. select
  695. <include refid="Base_Column_List" />
  696. from expense_account
  697. where check_no =''
  698. </select>
  699. <select id="selectCountByFinance" resultType="com.goafanti.common.model.FinanceCount">
  700. select x.aid, x.dates dateTime, count(*)expenseCount, sum(if(x.process_status = 1, 1, 0))expenseUnauditedCount
  701. from (select c.finance_id aid , a.process_status, DATE_FORMAT(a.create_time , '%Y-%m-%d') dates
  702. from expense_account a left join admin b on a.aid=b.id left join department c on b.department_id =c.id
  703. where a.status in (1, 2) and a.process_status >0 and c.finance_id = #{aid})x
  704. group by x.aid, x.dates;
  705. </select>
  706. <select id="selectByIds" resultMap="BaseResultMap">
  707. select
  708. <include refid="Base_Column_List" />
  709. from expense_account
  710. where id in
  711. <foreach collection="list" open="(" close=")" separator="," item="id">
  712. #{id}
  713. </foreach>
  714. </select>
  715. <select id="selectByMainId" resultMap="MainMap">
  716. <include refid="mainAllSql"/>
  717. where a.id= #{id}
  718. </select>
  719. <sql id="mainAllSql">
  720. select b.id,b.check_no,b.total_amount,b.order_no,o.contract_no,b.aname,b.apply_dep,b.pay_dep,b.real_amount,
  721. date_format(b.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,b.examine_name,
  722. dep.name applyDepName,dep2.name payDepName, b.remarks,b.eaaid ,eap.name ,eap.bank ,eap.accounts ,b.status,b.process_status,
  723. c.id sonId,c.total_amount sonAmount,c.`type` ,c.type_other ,c.user_names ,c.release_start ,c.release_end ,
  724. c.district_name districtName,c.user_names userNames,c.secondary_type ,c.secondary_type_other,c.attachment_url,
  725. d.id detId,d.`type` detType,d.amount,d.real_amount realAmount ,d.start_district ,d.end_district,d.vehicle,d.vehicle_other,
  726. d.pay_type ,d.invoice_type ,d.invoice_no,d.payer_name ,d.open_bank ,d.bank_accounts ,d.open_bank_address
  727. from expense_relationship a left join expense_account b on a.id =b.id
  728. left join department dep on b.apply_dep =dep.id left join department dep2 on b.pay_dep =dep2.id
  729. left join t_order_new o on b.order_no =o.order_no left join expense_account_private eap on b.eaaid =eap.id
  730. left join expense_account c on a.ea_id =c.id left join expense_account_details d on c.id =d.eaid
  731. </sql>
  732. <select id="selectListByMainId" resultMap="BaseResultMap">
  733. select b.*
  734. from expense_relationship a left join expense_account b on a.ea_id =b.id
  735. where a.id =#{id}
  736. </select>
  737. <resultMap id="MainMap" type="com.goafanti.expenseAccount.bo.MainExpenseAccount">
  738. <id column="id" jdbcType="INTEGER" property="id" />
  739. <result column="check_no" jdbcType="VARCHAR" property="checkNo" />
  740. <result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
  741. <result column="real_amount" jdbcType="DECIMAL" property="realAmount" />
  742. <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
  743. <result column="contract_no" jdbcType="VARCHAR" property="contractNo" />
  744. <result column="aname" jdbcType="VARCHAR" property="aname" />
  745. <result column="apply_dep" jdbcType="VARCHAR" property="applyDep" />
  746. <result column="pay_dep" jdbcType="VARCHAR" property="payDep" />
  747. <result column="applyDepName" jdbcType="VARCHAR" property="applyDepName" />
  748. <result column="payDepName" jdbcType="VARCHAR" property="payDepName" />
  749. <result column="remarks" jdbcType="VARCHAR" property="remarks" />
  750. <result column="eaaid" jdbcType="INTEGER" property="eaaid" />
  751. <result column="name" jdbcType="VARCHAR" property="name" />
  752. <result column="bank" jdbcType="VARCHAR" property="bank" />
  753. <result column="accounts" jdbcType="VARCHAR" property="accounts" />
  754. <result column="status" jdbcType="INTEGER" property="status" />
  755. <result column="process_status" jdbcType="INTEGER" property="processStatus" />
  756. <result column="createTimeStr" jdbcType="VARCHAR" property="createTimeStr" />
  757. <result column="examine_name" jdbcType="VARCHAR" property="examineName" />
  758. <association property="sonList" resultMap="SonExpenseAccountMap"></association>
  759. </resultMap>
  760. <resultMap id="SonExpenseAccountMap" type="com.goafanti.expenseAccount.bo.SonExpenseAccount">
  761. <id column="sonId" jdbcType="INTEGER" property="id" />
  762. <result column="sonAmount" jdbcType="DECIMAL" property="totalAmount" />
  763. <result column="type" jdbcType="INTEGER" property="type" />
  764. <result column="type_other" jdbcType="VARCHAR" property="typeOther" />
  765. <result column="secondary_type" jdbcType="INTEGER" property="secondaryType" />
  766. <result column="secondary_type_other" jdbcType="INTEGER" property="secondaryTypeOther" />
  767. <result column="attachment_url" jdbcType="INTEGER" property="attachmentUrl" />
  768. <result column="user_names" jdbcType="VARCHAR" property="userNames" />
  769. <result column="release_start" jdbcType="VARCHAR" property="releaseStart" />
  770. <result column="release_end" jdbcType="VARCHAR" property="releaseEnd" />
  771. <result column="districtName" jdbcType="VARCHAR" property="districtName" />
  772. <association property="detList" resultMap="ExpenseAccountDetailsMap"></association>
  773. </resultMap>
  774. <resultMap id="ExpenseAccountDetailsMap" type="com.goafanti.expenseAccount.bo.SonExpenseAccountDetails">
  775. <id column="detId" jdbcType="INTEGER" property="id" />
  776. <result column="detType" jdbcType="INTEGER" property="type" />
  777. <result column="amount" jdbcType="DECIMAL" property="amount" />
  778. <result column="start_district" jdbcType="VARCHAR" property="startDistrict" />
  779. <result column="end_district" jdbcType="VARCHAR" property="endDistrict" />
  780. <result column="vehicle" jdbcType="INTEGER" property="vehicle" />
  781. <result column="vehicle_other" jdbcType="VARCHAR" property="vehicleOther" />
  782. <result column="pay_type" jdbcType="INTEGER" property="payType" />
  783. <result column="invoice_type" jdbcType="INTEGER" property="invoiceType" />
  784. <result column="invoice_no" jdbcType="VARCHAR" property="invoiceNo" />
  785. <result column="payer_name" jdbcType="VARCHAR" property="payerName" />
  786. <result column="open_bank" jdbcType="VARCHAR" property="openBank" />
  787. <result column="bank_accounts" jdbcType="VARCHAR" property="bankAccounts" />
  788. <result column="open_bank_address" jdbcType="VARCHAR" property="openBankAddress" />
  789. </resultMap>
  790. <update id="updateByIds" >
  791. update expense_account
  792. set status= #{status}
  793. where id in
  794. <foreach collection="list" open="(" close=")" separator="," item="item">
  795. #{item.id}
  796. </foreach>
  797. </update>
  798. <update id="updateByMainId">
  799. update expense_relationship a ,expense_account b
  800. set b.status= #{status}
  801. where a.id= #{id} and a.ea_id=b.id
  802. </update>
  803. <select id="ExpenseMainList" resultMap="MainMap">
  804. select b.id,b.check_no,b.total_amount,b.order_no,o.contract_no,b.aname,b.apply_dep,b.pay_dep,
  805. date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,b.status,b.process_status,b.examine_name,
  806. dep.name applyDepName,dep2.name payDepName, b.remarks,b.eaaid ,
  807. c.id sonId,c.total_amount sonAmount,c.`type` ,c.type_other ,c.user_names ,c.release_start ,c.release_end,
  808. c.attachment_url attachmentUrl,c.secondary_type,c.secondary_type_other
  809. from expense_relationship a
  810. left join expense_account b on a.id =b.id
  811. left join department dep on b.apply_dep =dep.id left join department dep2 on b.pay_dep =dep2.id
  812. left join t_order_new o on b.order_no =o.order_no left join expense_account c on a.ea_id =c.id
  813. left join admin ad on b.aid=ad.id left join department adDep on ad.department_id=adDep.id
  814. where 1=1 and b.expense_main =1
  815. <if test="checkNo !=null">
  816. and b.check_no like concat('%',#{checkNo},'%')
  817. </if>
  818. <if test=" status != null">
  819. and b.status = #{status}
  820. </if>
  821. <if test=" roleType ==0">
  822. and b.aid = #{aid}
  823. </if>
  824. <if test="roleType == 1">
  825. <if test="listStatus ==0">
  826. and b.process_status =1
  827. </if>
  828. <if test="listStatus ==1">
  829. and b.process_status &gt; 1
  830. </if>
  831. and ad.superior_id= #{aid}
  832. </if>
  833. <if test="roleType == 2">
  834. <if test="listStatus ==0">
  835. and b.process_status =2
  836. </if>
  837. <if test="listStatus ==1">
  838. and b.process_status &gt; 2
  839. </if>
  840. and adDep.finance_id = #{aid}
  841. </if>
  842. <if test="roleType == 3">
  843. <if test="listStatus ==0">
  844. and b.process_status =3
  845. </if>
  846. <if test="listStatus ==1">
  847. and b.process_status &gt; 3
  848. </if>
  849. and ad.department_id in
  850. <foreach collection="deps" item="dep" open="(" close=")" separator=",">
  851. #{dep}
  852. </foreach>
  853. </if>
  854. ${page_sql}
  855. </select>
  856. <select id="ExpenseMainCount" resultType="java.lang.Integer">
  857. select count(*)
  858. from expense_account b
  859. left join admin ad on b.aid=ad.id
  860. left join department adDep on ad .department_id=adDep.id
  861. where 1=1 and b.expense_main =1
  862. <if test="checkNo !=null">
  863. and b.check_no like concat('%',#{checkNo},'%')
  864. </if>
  865. <if test=" status != null">
  866. and b.status = #{status}
  867. </if>
  868. <if test=" roleType ==0">
  869. and b.aid = #{aid}
  870. </if>
  871. <if test="roleType == 1">
  872. <if test="listStatus ==0">
  873. and b.process_status =1
  874. </if>
  875. <if test="listStatus ==1">
  876. and b.process_status &gt; 1
  877. </if>
  878. and ad.superior_id= #{aid}
  879. </if>
  880. <if test="roleType == 2">
  881. <if test="listStatus ==0">
  882. and b.process_status =2
  883. </if>
  884. <if test="listStatus ==1">
  885. and b.process_status &gt; 2
  886. </if>
  887. and adDep.finance_id = #{aid}
  888. </if>
  889. <if test="roleType == 3">
  890. <if test="listStatus ==0">
  891. and b.process_status =3
  892. </if>
  893. <if test="listStatus ==1">
  894. and b.process_status &gt; 3
  895. </if>
  896. and ad.department_id in
  897. <foreach collection="deps" item="dep" open="(" close=")" separator=",">
  898. #{dep}
  899. </foreach>
  900. </if>
  901. </select>
  902. <select id="ExpenseDetailsList" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccountDetailsList">
  903. select mea.check_no ,ead.`type`,ead.amount ,ead.real_amount ,o.contract_no ,dep.name applyDepName,
  904. dep2.name payDepName ,mea.aname ,ad2.name financeName,mea.status ,mea.process_status ,mea.id mainId,
  905. tm.buyer_name buyerName ,date_format(mea.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr
  906. from expense_account_details ead left join expense_account a on ead.eaid =a.id
  907. left join expense_relationship er on a.id=er.ea_id left join expense_account mea on er.id=mea.id
  908. left join t_order_new o on mea.order_no =o.order_no left join t_order_mid tm on o.order_no =tm.order_no
  909. left join department dep on mea.apply_dep =dep.id
  910. left join department dep2 on mea.pay_dep =dep2.id left join admin ad on mea.aid=ad.id
  911. left join department dep3 on ad.department_id =dep3.id left join admin ad2 on dep3.finance_id =ad2.id
  912. where 1=1
  913. <if test=" status != null">
  914. and mea.status = #{status}
  915. </if>
  916. <if test="deps !=null">
  917. and ad.department_id in
  918. <foreach collection="deps" item="dep" open="(" close=")" separator=",">
  919. #{dep}
  920. </foreach>
  921. </if>
  922. <if test=" contractNo != null">
  923. and o.contract_no like concat('%',#{contractNo},'%')
  924. </if><if test=" buyerName != null">
  925. and tm.buyer_name like concat('%','buyerName','%')
  926. </if><if test=" type != null">
  927. and ead.`type` = #{type}
  928. </if><if test=" aname != null">
  929. and mea.aname like concat('%',#{aname},'%')
  930. </if><if test=" applyDep != null">
  931. and mea.apply_dep =#{applyDep}
  932. </if><if test=" payDep != null">
  933. and mea.pay_dep =#{payDep}
  934. </if><if test=" startTime != null and endTime !=null">
  935. and mea.create_time between #{startTime} and #{endTime}
  936. </if><if test=" checkNo != null">
  937. and mea.check_no like concat('%',#{checkNo},'%')
  938. </if>
  939. ${page_sql}
  940. </select>
  941. <select id="ExpenseDetailsCount" resultType="java.lang.Integer">
  942. select count(*)
  943. from expense_account_details ead left join expense_account a on ead.eaid =a.id
  944. left join expense_relationship er on a.id=er.ea_id left join expense_account mea on er.id=mea.id
  945. left join t_order_new o on mea.order_no =o.order_no left join t_order_mid tm on o.order_no =tm.order_no
  946. left join department dep on mea.apply_dep =dep.id
  947. left join department dep2 on mea.pay_dep =dep2.id left join admin ad on mea.aid=ad.id
  948. left join department dep3 on ad.department_id =dep3.id left join admin ad2 on dep3.finance_id =ad2.id
  949. where 1=1
  950. <if test=" status != null">
  951. and mea.status = #{status}
  952. </if>
  953. <if test="deps !=null">
  954. and ad.department_id in
  955. <foreach collection="deps" item="dep" open="(" close=")" separator=",">
  956. #{dep}
  957. </foreach>
  958. </if>
  959. <if test=" contractNo != null">
  960. and o.contract_no like concat('%',#{contractNo},'%')
  961. </if><if test=" buyerName != null">
  962. and tm.buyer_name like concat('%','buyerName','%')
  963. </if><if test=" type != null">
  964. and ead.`type` = #{type}
  965. </if><if test=" aname != null">
  966. and mea.aname like concat('%',#{aname},'%')
  967. </if><if test=" applyDep != null">
  968. and mea.apply_dep =#{applyDep}
  969. </if><if test=" payDep != null">
  970. and mea.pay_dep =#{payDep}
  971. </if><if test=" startTime != null and endTime !=null">
  972. and mea.create_time between #{startTime} and #{endTime}
  973. </if><if test=" checkNo != null">
  974. and mea.check_no like concat('%',#{checkNo},'%')
  975. </if>
  976. </select>
  977. <select id="selectCountByIdsAndType" resultType="java.lang.Integer">
  978. select count(*) from expense_account
  979. where type =#{type}
  980. and id in
  981. <foreach collection="list" item="id" open="(" close=")" separator=",">
  982. #{id}
  983. </foreach>
  984. </select>
  985. </mapper>