PublicReleaseMapper.xml 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243
  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.PublicReleaseMapper">
  4. <resultMap type="com.goafanti.common.model.PublicRelease" id="PublicReleaseMap">
  5. <result property="id" column="id" jdbcType="INTEGER"/>
  6. <result property="aid" column="aid" jdbcType="VARCHAR"/>
  7. <result property="releaseStart" column="release_start" jdbcType="TIMESTAMP"/>
  8. <result property="releaseEnd" column="release_end" jdbcType="TIMESTAMP"/>
  9. <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
  10. <result property="annexUrl" column="annex_url" jdbcType="VARCHAR"/>
  11. <result property="status" column="status" jdbcType="INTEGER"/>
  12. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  13. <result property="pid" column="pid" jdbcType="VARCHAR"/>
  14. <result property="pname" column="pname" jdbcType="VARCHAR"/>
  15. <result property="duration" column="duration" jdbcType="NUMERIC"/>
  16. <result property="validDate" column="valid_date" jdbcType="VARCHAR"/>
  17. <result property="supplement" column="supplement" jdbcType="VARCHAR"/>
  18. <result property="auditInfo" column="audit_info" jdbcType="VARCHAR"/>
  19. <result property="plan" column="plan" jdbcType="VARCHAR"/>
  20. <result property="expectedEffect" column="expected_effect" jdbcType="VARCHAR"/>
  21. <result property="nextPlan" column="next_plan" jdbcType="VARCHAR"/>
  22. <result property="type" column="type" jdbcType="INTEGER"/>
  23. <result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
  24. <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
  25. <result property="updateStatus" column="update_status" jdbcType="INTEGER"/>
  26. <result property="assist" column="assist" jdbcType="INTEGER"/>
  27. <result property="assistAid" column="assist_aid" jdbcType="VARCHAR"/>
  28. <result property="assistAidName" column="assist_aid_name" jdbcType="VARCHAR"/>
  29. <result property="mainId" column="main_id" jdbcType="INTEGER"/>
  30. <result property="mainName" column="main_name" jdbcType="VARCHAR"/>
  31. <result property="rejectName" column="reject_name" jdbcType="VARCHAR"/>
  32. <result property="assistantAid" column="assistant_aid" jdbcType="VARCHAR"/>
  33. <result property="assistantName" column="assistant_name" jdbcType="VARCHAR"/>
  34. <result property="publicAgain" column="public_again" jdbcType="INTEGER"/>
  35. <result property="auditTime" column="audit_time" jdbcType="TIMESTAMP"/>
  36. <result property="newUser" column="new_user" jdbcType="VARCHAR"/>
  37. <result property="signSum" column="sign_sum" jdbcType="VARCHAR"/>
  38. <result property="userNames" column="user_names" jdbcType="VARCHAR"/>
  39. <result property="objectType" column="object_type" jdbcType="INTEGER"/>
  40. <result property="publicType" column="public_type" jdbcType="INTEGER"/>
  41. <result property="districtName" column="district_name" jdbcType="VARCHAR"/>
  42. <result property="clockIn" column="clock_in" jdbcType="INTEGER"/>
  43. <result property="techStartProcess" column="tech_start_process" jdbcType="INTEGER"/>
  44. <result property="addressName" column="address_name" jdbcType="VARCHAR"/>
  45. <result property="assistProcess" column="assist_process" jdbcType="INTEGER"/>
  46. <result property="alone" column="alone" jdbcType="INTEGER"/>
  47. </resultMap>
  48. <sql id="PublicReleaseAllSql">
  49. id, aid, release_start, release_end, remarks, annex_url, status, create_time, pid, pname, duration, valid_date, supplement, audit_info, plan, expected_effect, next_plan, type, order_no, update_time, update_status, assist, assist_aid, assist_aid_name, main_id, main_name, reject_name, assistant_aid, assistant_name, public_again, audit_time, new_user, sign_sum, user_names, object_type, public_type, district_name, clock_in, tech_start_process, address_name, assist_process, alone
  50. </sql>
  51. <!--查询单个-->
  52. <select id="queryById" resultMap="PublicReleaseMap">
  53. select
  54. <include refid="PublicReleaseAllSql"/>
  55. from public_release
  56. where id = #{id}
  57. </select>
  58. <!--查询指定行数据-->
  59. <select id="findPublicReleaseList" resultMap="PublicReleaseMap">
  60. select
  61. <include refid="PublicReleaseAllSql"/>
  62. from public_release
  63. <where>
  64. <if test="id != null">
  65. and id = #{id}
  66. </if>
  67. <if test="aid != null and aid != ''">
  68. and aid = #{aid}
  69. </if>
  70. <if test="releaseStart != null">
  71. and release_start = #{releaseStart}
  72. </if>
  73. <if test="releaseEnd != null">
  74. and release_end = #{releaseEnd}
  75. </if>
  76. <if test="remarks != null and remarks != ''">
  77. and remarks = #{remarks}
  78. </if>
  79. <if test="annexUrl != null and annexUrl != ''">
  80. and annex_url = #{annexUrl}
  81. </if>
  82. <if test="status != null">
  83. and status = #{status}
  84. </if>
  85. <if test="createTime != null">
  86. and create_time = #{createTime}
  87. </if>
  88. <if test="pid != null and pid != ''">
  89. and pid = #{pid}
  90. </if>
  91. <if test="pname != null and pname != ''">
  92. and pname = #{pname}
  93. </if>
  94. <if test="duration != null">
  95. and duration = #{duration}
  96. </if>
  97. <if test="validDate != null and validDate != ''">
  98. and valid_date = #{validDate}
  99. </if>
  100. <if test="supplement != null and supplement != ''">
  101. and supplement = #{supplement}
  102. </if>
  103. <if test="auditInfo != null and auditInfo != ''">
  104. and audit_info = #{auditInfo}
  105. </if>
  106. <if test="plan != null and plan != ''">
  107. and plan = #{plan}
  108. </if>
  109. <if test="expectedEffect != null and expectedEffect != ''">
  110. and expected_effect = #{expectedEffect}
  111. </if>
  112. <if test="nextPlan != null and nextPlan != ''">
  113. and next_plan = #{nextPlan}
  114. </if>
  115. <if test="type != null">
  116. and type = #{type}
  117. </if>
  118. <if test="orderNo != null and orderNo != ''">
  119. and order_no = #{orderNo}
  120. </if>
  121. <if test="updateTime != null">
  122. and update_time = #{updateTime}
  123. </if>
  124. <if test="updateStatus != null">
  125. and update_status = #{updateStatus}
  126. </if>
  127. <if test="assist != null">
  128. and assist = #{assist}
  129. </if>
  130. <if test="assistAid != null and assistAid != ''">
  131. and assist_aid = #{assistAid}
  132. </if>
  133. <if test="assistAidName != null and assistAidName != ''">
  134. and assist_aid_name = #{assistAidName}
  135. </if>
  136. <if test="mainId != null">
  137. and main_id = #{mainId}
  138. </if>
  139. <if test="mainName != null and mainName != ''">
  140. and main_name = #{mainName}
  141. </if>
  142. <if test="rejectName != null and rejectName != ''">
  143. and reject_name = #{rejectName}
  144. </if>
  145. <if test="assistantAid != null and assistantAid != ''">
  146. and assistant_aid = #{assistantAid}
  147. </if>
  148. <if test="assistantName != null and assistantName != ''">
  149. and assistant_name = #{assistantName}
  150. </if>
  151. <if test="publicAgain != null">
  152. and public_again = #{publicAgain}
  153. </if>
  154. <if test="auditTime != null">
  155. and audit_time = #{auditTime}
  156. </if>
  157. <if test="newUser != null and newUser != ''">
  158. and new_user = #{newUser}
  159. </if>
  160. <if test="signSum != null and signSum != ''">
  161. and sign_sum = #{signSum}
  162. </if>
  163. <if test="userNames != null and userNames != ''">
  164. and user_names = #{userNames}
  165. </if>
  166. <if test="objectType != null">
  167. and object_type = #{objectType}
  168. </if>
  169. <if test="publicType != null">
  170. and public_type = #{publicType}
  171. </if>
  172. <if test="districtName != null and districtName != ''">
  173. and district_name = #{districtName}
  174. </if>
  175. <if test="clockIn != null">
  176. and clock_in = #{clockIn}
  177. </if>
  178. <if test="techStartProcess != null">
  179. and tech_start_process = #{techStartProcess}
  180. </if>
  181. <if test="addressName != null and addressName != ''">
  182. and address_name = #{addressName}
  183. </if>
  184. <if test="assistProcess != null">
  185. and assist_process = #{assistProcess}
  186. </if>
  187. <if test="alone != null">
  188. and alone = #{alone}
  189. </if>
  190. </where>
  191. <if test="page_sql != null">
  192. ${page_sql}
  193. </if>
  194. </select>
  195. <!--统计总行数-->
  196. <select id="findPublicReleaseCount" resultType="java.lang.Integer">
  197. select count(1)
  198. from public_release
  199. <where>
  200. <if test="id != null">
  201. and id = #{id}
  202. </if>
  203. <if test="aid != null and aid != ''">
  204. and aid = #{aid}
  205. </if>
  206. <if test="releaseStart != null">
  207. and release_start = #{releaseStart}
  208. </if>
  209. <if test="releaseEnd != null">
  210. and release_end = #{releaseEnd}
  211. </if>
  212. <if test="remarks != null and remarks != ''">
  213. and remarks = #{remarks}
  214. </if>
  215. <if test="annexUrl != null and annexUrl != ''">
  216. and annex_url = #{annexUrl}
  217. </if>
  218. <if test="status != null">
  219. and status = #{status}
  220. </if>
  221. <if test="createTime != null">
  222. and create_time = #{createTime}
  223. </if>
  224. <if test="pid != null and pid != ''">
  225. and pid = #{pid}
  226. </if>
  227. <if test="pname != null and pname != ''">
  228. and pname = #{pname}
  229. </if>
  230. <if test="duration != null">
  231. and duration = #{duration}
  232. </if>
  233. <if test="validDate != null and validDate != ''">
  234. and valid_date = #{validDate}
  235. </if>
  236. <if test="supplement != null and supplement != ''">
  237. and supplement = #{supplement}
  238. </if>
  239. <if test="auditInfo != null and auditInfo != ''">
  240. and audit_info = #{auditInfo}
  241. </if>
  242. <if test="plan != null and plan != ''">
  243. and plan = #{plan}
  244. </if>
  245. <if test="expectedEffect != null and expectedEffect != ''">
  246. and expected_effect = #{expectedEffect}
  247. </if>
  248. <if test="nextPlan != null and nextPlan != ''">
  249. and next_plan = #{nextPlan}
  250. </if>
  251. <if test="type != null">
  252. and type = #{type}
  253. </if>
  254. <if test="orderNo != null and orderNo != ''">
  255. and order_no = #{orderNo}
  256. </if>
  257. <if test="updateTime != null">
  258. and update_time = #{updateTime}
  259. </if>
  260. <if test="updateStatus != null">
  261. and update_status = #{updateStatus}
  262. </if>
  263. <if test="assist != null">
  264. and assist = #{assist}
  265. </if>
  266. <if test="assistAid != null and assistAid != ''">
  267. and assist_aid = #{assistAid}
  268. </if>
  269. <if test="assistAidName != null and assistAidName != ''">
  270. and assist_aid_name = #{assistAidName}
  271. </if>
  272. <if test="mainId != null">
  273. and main_id = #{mainId}
  274. </if>
  275. <if test="mainName != null and mainName != ''">
  276. and main_name = #{mainName}
  277. </if>
  278. <if test="rejectName != null and rejectName != ''">
  279. and reject_name = #{rejectName}
  280. </if>
  281. <if test="assistantAid != null and assistantAid != ''">
  282. and assistant_aid = #{assistantAid}
  283. </if>
  284. <if test="assistantName != null and assistantName != ''">
  285. and assistant_name = #{assistantName}
  286. </if>
  287. <if test="publicAgain != null">
  288. and public_again = #{publicAgain}
  289. </if>
  290. <if test="auditTime != null">
  291. and audit_time = #{auditTime}
  292. </if>
  293. <if test="newUser != null and newUser != ''">
  294. and new_user = #{newUser}
  295. </if>
  296. <if test="signSum != null and signSum != ''">
  297. and sign_sum = #{signSum}
  298. </if>
  299. <if test="userNames != null and userNames != ''">
  300. and user_names = #{userNames}
  301. </if>
  302. <if test="objectType != null">
  303. and object_type = #{objectType}
  304. </if>
  305. <if test="publicType != null">
  306. and public_type = #{publicType}
  307. </if>
  308. <if test="districtName != null and districtName != ''">
  309. and district_name = #{districtName}
  310. </if>
  311. <if test="clockIn != null">
  312. and clock_in = #{clockIn}
  313. </if>
  314. <if test="techStartProcess != null">
  315. and tech_start_process = #{techStartProcess}
  316. </if>
  317. <if test="addressName != null and addressName != ''">
  318. and address_name = #{addressName}
  319. </if>
  320. <if test="assistProcess != null">
  321. and assist_process = #{assistProcess}
  322. </if>
  323. <if test="alone != null">
  324. and alone = #{alone}
  325. </if>
  326. </where>
  327. </select>
  328. <!--新增所有列-->
  329. <insert id="insert" keyProperty="id" useGeneratedKeys="true">
  330. insert into public_release(aid, release_start, release_end, remarks, annex_url, status, create_time, pid, pname,
  331. duration, valid_date, supplement, audit_info, plan, expected_effect, next_plan, type,
  332. order_no, update_time, update_status, assist, assist_aid, assist_aid_name, main_id,
  333. main_name, reject_name, assistant_aid, assistant_name, public_again, audit_time,
  334. new_user, sign_sum, user_names, object_type, public_type, district_name, clock_in,
  335. tech_start_process, address_name, assist_process, alone)
  336. values (#{aid}, #{releaseStart}, #{releaseEnd}, #{remarks}, #{annexUrl}, #{status}, #{createTime}, #{pid},
  337. #{pname}, #{duration}, #{validDate}, #{supplement}, #{auditInfo}, #{plan}, #{expectedEffect},
  338. #{nextPlan}, #{type}, #{orderNo}, #{updateTime}, #{updateStatus}, #{assist}, #{assistAid},
  339. #{assistAidName}, #{mainId}, #{mainName}, #{rejectName}, #{assistantAid}, #{assistantName},
  340. #{publicAgain}, #{auditTime}, #{newUser}, #{signSum}, #{userNames}, #{objectType}, #{publicType},
  341. #{districtName}, #{clockIn}, #{techStartProcess}, #{addressName}, #{assistProcess}, #{alone})
  342. </insert>
  343. <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
  344. insert into public_release(aid, release_start, release_end, remarks, annex_url, status, create_time, pid, pname,
  345. duration, valid_date, supplement, audit_info, plan, expected_effect, next_plan, type, order_no, update_time,
  346. update_status, assist, assist_aid, assist_aid_name, main_id, main_name, reject_name, assistant_aid,
  347. assistant_name, public_again, audit_time, new_user, sign_sum, user_names, object_type, public_type,
  348. district_name, clock_in, tech_start_process, address_name, assist_process, alone)
  349. values
  350. <foreach collection="entities" item="entity" separator=",">
  351. (#{entity.aid}, #{entity.releaseStart}, #{entity.releaseEnd}, #{entity.remarks}, #{entity.annexUrl},
  352. #{entity.status}, #{entity.createTime}, #{entity.pid}, #{entity.pname}, #{entity.duration},
  353. #{entity.validDate}, #{entity.supplement}, #{entity.auditInfo}, #{entity.plan}, #{entity.expectedEffect},
  354. #{entity.nextPlan}, #{entity.type}, #{entity.orderNo}, #{entity.updateTime}, #{entity.updateStatus},
  355. #{entity.assist}, #{entity.assistAid}, #{entity.assistAidName}, #{entity.mainId}, #{entity.mainName},
  356. #{entity.rejectName}, #{entity.assistantAid}, #{entity.assistantName}, #{entity.publicAgain},
  357. #{entity.auditTime}, #{entity.newUser}, #{entity.signSum}, #{entity.userNames}, #{entity.objectType},
  358. #{entity.publicType}, #{entity.districtName}, #{entity.clockIn}, #{entity.techStartProcess},
  359. #{entity.addressName}, #{entity.assistProcess}, #{entity.alone})
  360. </foreach>
  361. </insert>
  362. <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
  363. insert into public_release(aid, release_start, release_end, remarks, annex_url, status, create_time, pid, pname,
  364. duration, valid_date, supplement, audit_info, plan, expected_effect, next_plan, type, order_no, update_time,
  365. update_status, assist, assist_aid, assist_aid_name, main_id, main_name, reject_name, assistant_aid,
  366. assistant_name, public_again, audit_time, new_user, sign_sum, user_names, object_type, public_type,
  367. district_name, clock_in, tech_start_process, address_name, assist_process, alone)
  368. values
  369. <foreach collection="entities" item="entity" separator=",">
  370. (#{entity.aid}, #{entity.releaseStart}, #{entity.releaseEnd}, #{entity.remarks}, #{entity.annexUrl},
  371. #{entity.status}, #{entity.createTime}, #{entity.pid}, #{entity.pname}, #{entity.duration},
  372. #{entity.validDate}, #{entity.supplement}, #{entity.auditInfo}, #{entity.plan}, #{entity.expectedEffect},
  373. #{entity.nextPlan}, #{entity.type}, #{entity.orderNo}, #{entity.updateTime}, #{entity.updateStatus},
  374. #{entity.assist}, #{entity.assistAid}, #{entity.assistAidName}, #{entity.mainId}, #{entity.mainName},
  375. #{entity.rejectName}, #{entity.assistantAid}, #{entity.assistantName}, #{entity.publicAgain},
  376. #{entity.auditTime}, #{entity.newUser}, #{entity.signSum}, #{entity.userNames}, #{entity.objectType},
  377. #{entity.publicType}, #{entity.districtName}, #{entity.clockIn}, #{entity.techStartProcess},
  378. #{entity.addressName}, #{entity.assistProcess}, #{entity.alone})
  379. </foreach>
  380. on duplicate key update
  381. aid = values(aid),
  382. release_start = values(release_start),
  383. release_end = values(release_end),
  384. remarks = values(remarks),
  385. annex_url = values(annex_url),
  386. status = values(status),
  387. create_time = values(create_time),
  388. pid = values(pid),
  389. pname = values(pname),
  390. duration = values(duration),
  391. valid_date = values(valid_date),
  392. supplement = values(supplement),
  393. audit_info = values(audit_info),
  394. plan = values(plan),
  395. expected_effect = values(expected_effect),
  396. next_plan = values(next_plan),
  397. type = values(type),
  398. order_no = values(order_no),
  399. update_time = values(update_time),
  400. update_status = values(update_status),
  401. assist = values(assist),
  402. assist_aid = values(assist_aid),
  403. assist_aid_name = values(assist_aid_name),
  404. main_id = values(main_id),
  405. main_name = values(main_name),
  406. reject_name = values(reject_name),
  407. assistant_aid = values(assistant_aid),
  408. assistant_name = values(assistant_name),
  409. public_again = values(public_again),
  410. audit_time = values(audit_time),
  411. new_user = values(new_user),
  412. sign_sum = values(sign_sum),
  413. user_names = values(user_names),
  414. object_type = values(object_type),
  415. public_type = values(public_type),
  416. district_name = values(district_name),
  417. clock_in = values(clock_in),
  418. tech_start_process = values(tech_start_process),
  419. address_name = values(address_name),
  420. assist_process = values(assist_process),
  421. alone = values(alone)
  422. </insert>
  423. <!--通过主键修改数据-->
  424. <update id="update">
  425. update public_release
  426. <set>
  427. <if test="aid != null and aid != ''">
  428. aid = #{aid},
  429. </if>
  430. <if test="releaseStart != null">
  431. release_start = #{releaseStart},
  432. </if>
  433. <if test="releaseEnd != null">
  434. release_end = #{releaseEnd},
  435. </if>
  436. <if test="remarks != null and remarks != ''">
  437. remarks = #{remarks},
  438. </if>
  439. <if test="annexUrl != null and annexUrl != ''">
  440. annex_url = #{annexUrl},
  441. </if>
  442. <if test="status != null">
  443. status = #{status},
  444. </if>
  445. <if test="createTime != null">
  446. create_time = #{createTime},
  447. </if>
  448. <if test="pid != null and pid != ''">
  449. pid = #{pid},
  450. </if>
  451. <if test="pname != null and pname != ''">
  452. pname = #{pname},
  453. </if>
  454. <if test="duration != null">
  455. duration = #{duration},
  456. </if>
  457. <if test="validDate != null and validDate != ''">
  458. valid_date = #{validDate},
  459. </if>
  460. <if test="supplement != null and supplement != ''">
  461. supplement = #{supplement},
  462. </if>
  463. <if test="auditInfo != null and auditInfo != ''">
  464. audit_info = #{auditInfo},
  465. </if>
  466. <if test="plan != null and plan != ''">
  467. plan = #{plan},
  468. </if>
  469. <if test="expectedEffect != null and expectedEffect != ''">
  470. expected_effect = #{expectedEffect},
  471. </if>
  472. <if test="nextPlan != null and nextPlan != ''">
  473. next_plan = #{nextPlan},
  474. </if>
  475. <if test="type != null">
  476. type = #{type},
  477. </if>
  478. <if test="orderNo != null and orderNo != ''">
  479. order_no = #{orderNo},
  480. </if>
  481. <if test="updateTime != null">
  482. update_time = #{updateTime},
  483. </if>
  484. <if test="updateStatus != null">
  485. update_status = #{updateStatus},
  486. </if>
  487. <if test="assist != null">
  488. assist = #{assist},
  489. </if>
  490. <if test="assistAid != null and assistAid != ''">
  491. assist_aid = #{assistAid},
  492. </if>
  493. <if test="assistAidName != null and assistAidName != ''">
  494. assist_aid_name = #{assistAidName},
  495. </if>
  496. <if test="mainId != null">
  497. main_id = #{mainId},
  498. </if>
  499. <if test="mainName != null and mainName != ''">
  500. main_name = #{mainName},
  501. </if>
  502. <if test="rejectName != null and rejectName != ''">
  503. reject_name = #{rejectName},
  504. </if>
  505. <if test="assistantAid != null ">
  506. assistant_aid = #{assistantAid},
  507. </if>
  508. <if test="assistantName != null">
  509. assistant_name = #{assistantName},
  510. </if>
  511. <if test="publicAgain != null">
  512. public_again = #{publicAgain},
  513. </if>
  514. <if test="auditTime != null">
  515. audit_time = #{auditTime},
  516. </if>
  517. <if test="newUser != null and newUser != ''">
  518. new_user = #{newUser},
  519. </if>
  520. <if test="signSum != null and signSum != ''">
  521. sign_sum = #{signSum},
  522. </if>
  523. <if test="userNames != null and userNames != ''">
  524. user_names = #{userNames},
  525. </if>
  526. <if test="objectType != null">
  527. object_type = #{objectType},
  528. </if>
  529. <if test="publicType != null">
  530. public_type = #{publicType},
  531. </if>
  532. <if test="districtName != null and districtName != ''">
  533. district_name = #{districtName},
  534. </if>
  535. <if test="clockIn != null">
  536. clock_in = #{clockIn},
  537. </if>
  538. <if test="techStartProcess != null">
  539. tech_start_process = #{techStartProcess},
  540. </if>
  541. <if test="addressName != null and addressName != ''">
  542. address_name = #{addressName},
  543. </if>
  544. <if test="assistProcess != null">
  545. assist_process = #{assistProcess},
  546. </if>
  547. <if test="alone != null">
  548. alone = #{alone},
  549. </if>
  550. </set>
  551. where id = #{id}
  552. </update>
  553. <!--通过主键删除-->
  554. <delete id="deleteById">
  555. delete
  556. from public_release
  557. where id = #{id}
  558. </delete>
  559. <delete id="deleteByMainId">
  560. delete from public_release where main_id = #{id}
  561. </delete>
  562. <!--注意增删字段需要单独处理-->
  563. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicRelease" useGeneratedKeys="true">
  564. insert into public_release
  565. <trim prefix="(" suffix=")" suffixOverrides=",">
  566. <if test="id != null">id,</if>
  567. <if test="aid != null">aid,</if>
  568. <if test="releaseStart != null">release_start,</if>
  569. <if test="releaseEnd != null">release_end,</if>
  570. <if test="remarks != null">remarks,</if>
  571. <if test="annexUrl != null">annex_url,</if>
  572. <if test="status != null">status,</if>
  573. <if test="createTime != null">create_time,</if>
  574. <if test="pid != null">pid,</if>
  575. <if test="pname != null">pname,</if>
  576. <if test="duration != null">duration,</if>
  577. <if test="validDate != null">valid_date,</if>
  578. <if test="supplement != null">supplement,</if>
  579. <if test="auditInfo != null">audit_info,</if>
  580. <if test="plan != null">plan,</if>
  581. <if test="expectedEffect != null">expected_effect,</if>
  582. <if test="nextPlan != null">next_plan,</if>
  583. <if test="type != null">type,</if>
  584. <if test="orderNo != null">order_no,</if>
  585. <if test="updateTime != null">update_time,</if>
  586. <if test="updateStatus != null">update_status,</if>
  587. <if test="assist != null">assist,</if>
  588. <if test="assistAid != null">assist_aid,</if>
  589. <if test="assistAidName != null">assist_aid_name,</if>
  590. <if test="mainId != null">main_id,</if>
  591. <if test="mainName != null">main_name,</if>
  592. <if test="rejectName != null">reject_name,</if>
  593. <if test="assistantAid != null">assistant_aid,</if>
  594. <if test="assistantName != null">assistant_name,</if>
  595. <if test="publicAgain != null">public_again,</if>
  596. <if test="auditTime != null">audit_time,</if>
  597. <if test="newUser != null">new_user,</if>
  598. <if test="signSum != null">sign_sum,</if>
  599. <if test="userNames != null">user_names,</if>
  600. <if test="objectType != null">object_type,</if>
  601. <if test="publicType != null">public_type,</if>
  602. <if test="districtName != null">district_name,</if>
  603. <if test="clockIn != null">clock_in,</if>
  604. <if test="techStartProcess != null">tech_start_process,</if>
  605. <if test="addressName != null">address_name,</if>
  606. <if test="assistProcess != null">assist_process,</if>
  607. <if test="alone != null">alone,</if>
  608. </trim>
  609. <trim prefix="values (" suffix=")" suffixOverrides=",">
  610. <if test="id != null">#{id,jdbcType=INTEGER},</if>
  611. <if test="aid != null">#{aid,jdbcType=VARCHAR},</if>
  612. <if test="releaseStart != null">#{releaseStart,jdbcType=TIMESTAMP},</if>
  613. <if test="releaseEnd != null">#{releaseEnd,jdbcType=TIMESTAMP},</if>
  614. <if test="remarks != null">#{remarks,jdbcType=VARCHAR},</if>
  615. <if test="annexUrl != null">#{annexUrl,jdbcType=VARCHAR},</if>
  616. <if test="status != null">#{status,jdbcType=INTEGER},</if>
  617. <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
  618. <if test="pid != null">#{pid,jdbcType=VARCHAR},</if>
  619. <if test="pname != null">#{pname,jdbcType=VARCHAR},</if>
  620. <if test="duration != null">#{duration,jdbcType=DOUBLE},</if>
  621. <if test="validDate != null">#{validDate,jdbcType=VARCHAR},</if>
  622. <if test="supplement != null">#{supplement,jdbcType=VARCHAR},</if>
  623. <if test="auditInfo != null">#{auditInfo,jdbcType=VARCHAR},</if>
  624. <if test="plan != null">#{plan,jdbcType=VARCHAR},</if>
  625. <if test="expectedEffect != null">#{expectedEffect,jdbcType=VARCHAR},</if>
  626. <if test="nextPlan != null">#{nextPlan,jdbcType=VARCHAR},</if>
  627. <if test="type != null">#{type,jdbcType=INTEGER},</if>
  628. <if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if>
  629. <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
  630. <if test="updateStatus != null">#{updateStatus,jdbcType=INTEGER},</if>
  631. <if test="assist != null">#{assist,jdbcType=INTEGER},</if>
  632. <if test="assistAid != null">#{assistAid,jdbcType=VARCHAR},</if>
  633. <if test="assistAidName != null">#{assistAidName,jdbcType=VARCHAR},</if>
  634. <if test="mainId != null">#{mainId,jdbcType=INTEGER},</if>
  635. <if test="mainName != null">#{mainName,jdbcType=VARCHAR},</if>
  636. <if test="rejectName != null">#{rejectName,jdbcType=VARCHAR},</if>
  637. <if test="assistantAid != null">#{assistantAid,jdbcType=VARCHAR},</if>
  638. <if test="assistantName != null">#{assistantName,jdbcType=VARCHAR},</if>
  639. <if test="publicAgain != null">#{publicAgain,jdbcType=INTEGER},</if>
  640. <if test="auditTime != null">#{auditTime,jdbcType=TIMESTAMP},</if>
  641. <if test="newUser != null">#{newUser,jdbcType=VARCHAR},</if>
  642. <if test="signSum != null">#{signSum,jdbcType=VARCHAR},</if>
  643. <if test="userNames != null">#{userNames,jdbcType=VARCHAR},</if>
  644. <if test="objectType != null">#{objectType,jdbcType=INTEGER},</if>
  645. <if test="publicType != null">#{publicType,jdbcType=INTEGER},</if>
  646. <if test="districtName != null">#{districtName,jdbcType=VARCHAR},</if>
  647. <if test="clockIn != null">#{clockIn,jdbcType=INTEGER},</if>
  648. <if test="techStartProcess != null">#{techStartProcess,jdbcType=INTEGER},</if>
  649. <if test="addressName != null">#{addressName,jdbcType=VARCHAR},</if>
  650. <if test="assistProcess != null">#{assistProcess,jdbcType=INTEGER},</if>
  651. <if test="alone != null">#{alone,jdbcType=INTEGER},</if>
  652. </trim>
  653. </insert>
  654. <update id="updateSignByAidAndUid">
  655. update public_release_details a left join public_release b on a.prid =b.id
  656. left join `user` c on a.uid=c.id
  657. set a.sign_sum =a.sign_sum +1
  658. where a.uid= #{uid} and a.main_status =1 and b.aid= #{aid}
  659. </update>
  660. <select id="listPublicRelease" resultType="com.goafanti.weChat.bo.OutPublicReleaseList">
  661. select a.id ,c.name aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.aid,a.public_type publicType,a.order_no orderNo,
  662. date_format(a.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,date_format(a.create_time ,'%Y-%m-%d %H:%i:%S') createTimes,a.status,
  663. date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_status updateStatus,a.district_name districtName,
  664. a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,a.type,a.main_name mainName,a.reject_name rejectName,
  665. a.assistant_aid assistantAid ,a.assistant_name assistantName,a.public_again publicAgain,a.user_names userNames,a.alone,
  666. <if test="type==7">
  667. opc.max_process maxProcess,
  668. </if>
  669. ea.total_amount expenseAmount ,a.clock_in clockIn,a.assist_process assistProcess,a.tech_start_process techStartProcess
  670. from public_release a left join admin c on a.aid =c.id
  671. left join expense_account ea ON a.id = ea.prid AND ea.status IN (0, 1, 2, 3)
  672. <if test="type==2">
  673. left join department d on c.department_id =d.id
  674. </if>
  675. <if test="type==4 or type==5 or userName !=null">
  676. left join public_release_details b on a.id=b.prid
  677. left join user e on b.uid=e.id left join admin ad on e.aid=ad.id
  678. </if>
  679. <if test="type==5">
  680. left join t_order_new ton on a.order_no =ton.order_no
  681. left join t_order_mid tom on a.order_no=tom.order_no
  682. </if>
  683. <if test="type==1">
  684. left join admin_public_reviewer apr on a.aid=apr.aid
  685. </if>
  686. <if test="type==7">
  687. left join t_order_public_release_count opc on a.order_no=opc.order_no
  688. </if>
  689. where 1=1
  690. <include refid="listPublicReleaseSql"/>
  691. ORDER BY (case when a.status=1 then 1 when a.status=2 then 2 when a.status=3 then 5
  692. when a.status=0 then 3 when a.status=4 then 4 else 0 end),a.create_time desc
  693. <if test="page_sql!=null">
  694. ${page_sql}
  695. </if>
  696. </select>
  697. <sql id="listPublicReleaseSql">
  698. <if test="type==0">
  699. and a.public_type in (0,1,2,3)
  700. <if test="assist ==0">
  701. and a.assist in(0,1,4)
  702. </if>
  703. <if test="assist == 2">
  704. and a.assist in (2,4)
  705. </if>
  706. <if test="assist == 3">
  707. and a.assist =3
  708. </if>
  709. <if test="assist ==4">
  710. and a.assist in (2,3,4)
  711. </if>
  712. <if test="assistType ==1">
  713. and a.assist in(0,1,2)
  714. </if>
  715. <if test="aid !=null">
  716. and a.aid= #{aid}
  717. </if>
  718. <if test="statusType ==1">
  719. and a.status in (0,1,2,4)
  720. </if>
  721. </if>
  722. <if test="type==1">
  723. and a.public_type in (0,2)
  724. and a.assist in(0,1)
  725. and a.tech_start_process in (0,2)
  726. and a.assist_process in (0,1,2,3,4)
  727. and apr.reviewer_id = #{aid} and apr.type=0
  728. <if test="status == 1">
  729. and a.status = #{status} and a.assist_process in (0,1)
  730. </if>
  731. <if test="status == 2">
  732. and a.status = #{status} and a.assist_process in (2,3,4)
  733. </if>
  734. </if>
  735. <if test="type==2">
  736. and a.public_type in (0,2)
  737. and a.assist in(0,1)
  738. and d.manager_id = #{aid}
  739. </if>
  740. <if test="type==3">
  741. and a.public_type in (0,2)
  742. and a.assist=2
  743. <if test="aid !=null">
  744. and a.aid= #{aid}
  745. </if>
  746. and a.type = #{type}
  747. </if>
  748. <if test="type==4">
  749. and a.assist in(0,1)
  750. and e.aid = #{aid}
  751. <if test="status==null"> and a.public_type in (1,2) </if>
  752. <if test="status==1">and a.status=1 and a.public_type in (1) </if>
  753. <if test="status==2">and a.public_type in (2) </if>
  754. </if>
  755. <if test="type==5">
  756. and e.aid =#{aid}
  757. <if test="status==null">and a.tech_start_process in (1,2) </if>
  758. <if test="status==1">and a.status=1 and a.tech_start_process in (1) </if>
  759. <if test="status==2">and a.tech_start_process in (2) </if>
  760. </if>
  761. <if test="type==6">
  762. and a.type=0 and a.assist=1
  763. and a.id in (select pr.main_id from public_release pr left join admin_public_reviewer apr
  764. on pr.aid = apr.aid where pr.`type` =3 and apr.type = 1 and apr.reviewer_id = #{aid})
  765. </if>
  766. <if test="type==7">
  767. and opc.max_process in (1,2,3,4,5)
  768. <if test="maxProcessStatus ==null">
  769. and opc.max_process >= #{configType}
  770. </if>
  771. <if test="maxProcessStatus ==0">
  772. and opc.max_process= #{configType}
  773. </if>
  774. <if test="maxProcessStatus ==1">
  775. and opc.max_process > #{configType}
  776. and opc.max_process in (1,2,3,5)
  777. </if>
  778. <if test="maxProcessStatus ==2">
  779. and opc.max_process =4
  780. </if>
  781. </if>
  782. <if test="clockIn !=null">
  783. and a.clock_in =#{clockIn}
  784. </if>
  785. <if test="clockTime !=null">
  786. and a.release_start &lt; #{clockTime} and a.release_end &gt; #{clockTime}
  787. </if>
  788. <if test="releaseStarts != null and publicEnd != null">
  789. and a.release_start BETWEEN #{releaseStarts} and #{publicEnd}
  790. </if>
  791. <if test="userName !=null">
  792. and e.nickname like concat('%',#{userName},'%')
  793. </if>
  794. <if test="type!=4 and type !=5 and type != 1">
  795. <if test="status !=null ">
  796. and a.status = #{status}
  797. </if>
  798. </if>
  799. </sql>
  800. <select id="countPublicRelease" resultType="java.lang.Integer">
  801. select count(*)
  802. from public_release a left join admin c on a.aid =c.id
  803. <if test="type==2">
  804. left join department d on c.department_id =d.id
  805. </if>
  806. <if test="type==4 or type==5 or userName !=null">
  807. left join public_release_details b on a.id=b.prid
  808. left join user e on b.uid=e.id left join admin ad on e.aid=ad.id
  809. </if>
  810. <if test="type==1">
  811. left join admin_public_reviewer apr on a.aid=apr.aid
  812. </if>
  813. <if test="type==7">
  814. left join t_order_public_release_count opc on a.order_no=opc.order_no
  815. </if>
  816. where 1=1
  817. <include refid="listPublicReleaseSql"/>
  818. </select>
  819. <select id="selectDtails" resultType="com.goafanti.weChat.bo.OutPublicRelease">
  820. select a.id,c.name aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.update_time updateTime,a.user_names userNames,
  821. date_format(a.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,date_format(a.create_time ,'%Y-%m-%d %H:%i:%S') createTimes,a.status,a.assist_process assistProcess,
  822. a.annex_url annexUrl ,a.remarks,a.duration ,a.valid_date validDate ,a.aid ,c.superior_id suprId,a.tech_start_process techStartProcess,a.alone,
  823. a.plan ,a.expected_effect expectedEffect,a.next_plan nextPlan,c.reviewer,a.type,a.order_no orderNo,d.contract_no contractNo,a.address_name addressName,
  824. date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_Status updateStatus,a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,
  825. a.main_name mainName,a.assistant_aid assistantAid,a.assistant_name assistantName,a.public_again publicAhain,x.uids,a.public_type publicType,c2.name reviewerName
  826. from public_release a left join admin c on a.aid =c.id left join admin c2 on c.reviewer =c2.id
  827. left join (select prid ,GROUP_CONCAT(uid)uids from public_release_details where prid= #{id} group by prid)x on a.id=x.prid
  828. left join t_order_new d on a.order_no=d.order_no
  829. where 1=1
  830. <if test="id !=null">
  831. and a.id= #{id}
  832. </if>
  833. </select>
  834. <select id="selectDtailsByFid" resultType="com.goafanti.weChat.bo.OutPublicReleaseAndDetails">
  835. select a.id,c.name aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.update_time updateTime,a.user_names userNames,
  836. date_format(a.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,date_format(a.create_time ,'%Y-%m-%d %H:%i:%S') createTimes,a.status,
  837. a.annex_url annexUrl ,a.remarks,a.duration ,a.valid_date validDate ,a.aid ,c.superior_id suprId,x.uid uids,x.district_name districtName ,u.nickname,
  838. a.plan ,a.expected_effect expectedEffect,a.next_plan nextPlan,c.reviewer,a.type,a.order_no orderNo,d.contract_no contractNo,
  839. date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_Status updateStatus,a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,
  840. a.main_name mainName,a.assistant_aid assistantAid,a.assistant_name assistantName,a.public_again publicAhain
  841. from public_release a left join admin c on a.aid =c.id
  842. left join public_release_details x on a.id=x.prid
  843. left join user u on x.uid=u.id
  844. left join t_order_new d on a.order_no=d.order_no
  845. where 1=1
  846. <if test="ufid !=null">
  847. and x.ufid= #{ufid}
  848. </if>
  849. </select>
  850. <select id="listPublicStatistics" resultType="com.goafanti.weChat.bo.OutPublicStatistics">
  851. select y.aid,y.bh,y.dk,y.wsh,y.tg,y.duration,c.name from(select x.aid ,sum(x.bh)bh,sum(x.wsh)wsh,sum(x.tg)tg,sum(x.dk)dk,sum(x.duration)duration
  852. from (select a.aid, if(a.status=0,1,0)bh ,if(a.status=1,1,0)wsh,if(a.status=2,1,0)tg,b.dk ,if(a.status=2,a.duration,0)duration
  853. from public_release a inner join (select prid ,sum(if(clock_in=1,1,0))dk from public_release_details where 1=1
  854. <if test="clockStart != null and clockEnd != null">
  855. and clock_in_time between #{clockStart} and #{clockEnd}
  856. </if>
  857. group by prid ) b on a.id =b.prid
  858. left join admin c on a.aid=c.id where 1=1
  859. <if test="aid != null">
  860. and a.aid= #{aid}
  861. </if>
  862. <if test="createStart != null and createEnd !=null">
  863. and a.create_time between #{createStart} and #{createEnd}
  864. </if>
  865. <if test="depId != null">
  866. and c.department_id = #{depId}
  867. </if>
  868. )x group by x.aid)y left join admin c on c.id=y.aid
  869. <if test="page_sql!=null">
  870. ${page_sql}
  871. </if>
  872. </select>
  873. <select id="countPublicStatistics" resultType="java.lang.Integer">
  874. select count(*) from (select aid from public_release a
  875. inner join (select prid ,sum(if(clock_in=1,1,0))dk from public_release_details where 1=1
  876. <if test="clockStart != null and clockEnd != null">
  877. and clock_in_time between #{clockStart} and #{clockEnd}
  878. </if>
  879. group by prid ) b on a.id =b.prid
  880. left join admin c on a.aid=c.id
  881. where 1=1
  882. <if test="aid != null">
  883. and a.aid= #{aid}
  884. </if>
  885. <if test="createStart != null and createEnd !=null">
  886. and a.create_time between #{createStart} and #{createEnd}
  887. </if>
  888. <if test="depId != null">
  889. and c.department_id = #{depId}
  890. </if>
  891. group by aid)x
  892. </select>
  893. <select id="listPublicDtails" resultType="com.goafanti.weChat.bo.OutPublicDtails">
  894. select a.id prdId,b.id,a.district_name districtName ,c.name aname,a.duration ,b.status ,b.annex_url annexUrl,a.photo_url photoUrl,d.nickname userName,
  895. date_format(a.clock_in_time ,'%Y-%m-%d %H:%i:%S') clockInTimes,a.clock_in clockIn ,b.remarks ,b.supplement ,b.`type` ,b.object_type objectType ,b.alone,
  896. date_format(b.create_time ,'%Y-%m-%d %H:%i:%S') createTimes,b.audit_info auditInfo,date_format(b.audit_time ,'%Y-%m-%d %H:%i:%S') auditTimes,
  897. date_format(b.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,date_format(b.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,a.address_name addressName,
  898. b.plan ,b.next_plan nextPlan ,b.expected_effect expectedEffect,b.update_status updateStatus,b.assist_aid_name assistAidName,
  899. b.main_name mainName,b.assist,b.assistant_aid assistantAid, b.assistant_name assistantName,f.contract_no contractNo,
  900. e.name sname,f.total_amount totalAmout,d.sign_bills signBills,date_format(d.sign_time,'%Y-%m-%d')signTime
  901. from public_release_details a left join public_release b on a.prid =b.id
  902. left join admin c on b.aid =c.id left join t_order_new f on b.order_no =f.order_no
  903. left join `user` d on a.uid =d.id left join admin e on d.aid=e.id
  904. where 1=1
  905. <if test="publicType != null">
  906. and b.type= #{publicType}
  907. </if>
  908. <if test="aid != null">
  909. and b.aid= #{aid}
  910. </if>
  911. <if test="sid != null">
  912. and d.aid= #{sid}
  913. </if>
  914. <if test="deps !=null">
  915. and c.department_id in
  916. <foreach close=")" collection="deps" item="dep" open="(" separator=",">
  917. #{dep}
  918. </foreach>
  919. </if>
  920. <if test="uid != null">
  921. and a.uid = #{uid}
  922. </if>
  923. <if test="releaseStart != null and releaseEnd != null">
  924. and (b.release_start between #{releaseStart} and #{releaseEnd} or b.release_end between #{releaseStart} and #{releaseEnd})
  925. </if>
  926. <if test="createStart != null and createEnd != null">
  927. and b.create_time between #{createStart} and #{createEnd}
  928. </if>
  929. <if test="status != null">
  930. and b.status = #{status}
  931. </if>
  932. <if test="statusType == 1">
  933. and b.status in (1,2)
  934. </if>
  935. <if test="clockIn !=null">
  936. and a.clock_in= #{clockIn}
  937. </if>
  938. <if test="contractNo !=null">
  939. and f.contract_no like CONCAT('%',#{contractNo},'%')
  940. </if>
  941. order by b.status,b.create_time desc
  942. <if test="page_sql!=null">
  943. ${page_sql}
  944. </if>
  945. </select>
  946. <select id="countPublicDtails" resultType="java.lang.Integer">
  947. select count(*)
  948. from public_release_details a left join public_release b on a.prid =b.id
  949. left join admin c on b.aid =c.id left join `user` d on a.uid =d.id
  950. <if test="contractNo !=null">
  951. left join t_order_new f on b.order_no =f.order_no
  952. </if>
  953. where 1=1
  954. <if test="publicType != null">
  955. and b.type= #{publicType}
  956. </if>
  957. <if test="aid != null">
  958. and b.aid= #{aid}
  959. </if>
  960. <if test="sid != null">
  961. and d.aid= #{sid}
  962. </if>
  963. <if test="deps !=null">
  964. and c.department_id in
  965. <foreach close=")" collection="deps" item="dep" open="(" separator=",">
  966. #{dep}
  967. </foreach>
  968. </if>
  969. <if test="uid != null">
  970. and a.uid = #{uid}
  971. </if>
  972. <if test="releaseStart != null and releaseEnd != null">
  973. and (b.release_start between #{releaseStart} and #{releaseEnd} or b.release_end between #{releaseStart} and #{releaseEnd})
  974. </if>
  975. <if test="createStart != null and createEnd != null">
  976. and b.create_time between #{createStart} and #{createEnd}
  977. </if>
  978. <if test="status != null">
  979. and b.status = #{status}
  980. </if>
  981. <if test="statusType == 1">
  982. and b.status in (1,2)
  983. </if>
  984. <if test="clockIn !=null">
  985. and a.clock_in= #{clockIn}
  986. </if>
  987. <if test="contractNo !=null">
  988. and f.contract_no like CONCAT('%',#{contractNo},'%')
  989. </if>
  990. </select>
  991. <select id="getTimeUserFollow" resultType="com.goafanti.common.model.OutPublicReleaseCount">
  992. select e.id province,d.id depId,a.aid,a.uid,a.new_user newUser ,1 quantity from (select a.aid,b.uid,b.new_user from public_release a
  993. left join public_release_details b on a.id=b.prid
  994. where b.main_status =1 and a.create_time between #{date} and #{now}
  995. group by a.aid,b.uid,b.new_user)a left join admin c on a.aid=c.id
  996. left join department d on c.department_id =d.id left join district_glossory e on d.province =e.id
  997. </select>
  998. <select id="publicByOrder" resultType="com.goafanti.weChat.bo.OutPublicRelease">
  999. select a.id,a.uid,b.aid,b.nickname ,c.name aname,a.duration ,a.district_name districtName,
  1000. date_format(pr.release_start,'%Y-%m-%d %H:%i:%S')releaseStarts,
  1001. date_format(pr.release_end ,'%Y-%m-%d %H:%i:%S')releaseEnds,
  1002. date_format(a.clock_in_time ,'%Y-%m-%d %H:%i:%S')clockInTimes,
  1003. pr.remarks
  1004. from public_release_details a left join public_release pr on a.prid=pr.id
  1005. left join user b on a.uid=b.id left join admin c on pr.aid =c.id
  1006. where pr.order_no = #{orderNo}
  1007. </select>
  1008. <select id="selectByMainId" parameterType="java.lang.Integer" resultMap="PublicReleaseMap">
  1009. select
  1010. <include refid="PublicReleaseAllSql" />
  1011. from public_release
  1012. where main_id = #{mainId}
  1013. <if test="type !=null">
  1014. and type= #{type}
  1015. </if>
  1016. <if test="aid !=null">
  1017. and aid= #{aid}
  1018. </if>
  1019. </select>
  1020. <update id="updateStatusByMainId">
  1021. update public_release set status= #{status}
  1022. where main_id= #{mainId}
  1023. <if test="type !=null">
  1024. and type= #{type}
  1025. </if>
  1026. <if test="aid !=null">
  1027. and aid= #{aid}
  1028. </if>
  1029. </update>
  1030. <update id="updateAssist">
  1031. update public_release set assist_aid=null,assist_aid_name=null
  1032. where id= #{id}
  1033. </update>
  1034. <select id="selectCountByaidAndDate" resultType="java.lang.Integer">
  1035. select ifnull(count(*),0)publicReleaseCount
  1036. from (select aid
  1037. from public_release a left join public_release_details b on a.id=b.prid
  1038. where status =2 and aid= #{aid}
  1039. <if test="startTime !=null and endTime !=null">
  1040. and a.release_start BETWEEN #{startTime} and #{endTime}
  1041. </if>
  1042. )x
  1043. group by aid
  1044. </select>
  1045. <select id="selectByaidAndDate" resultType="com.goafanti.admin.bo.OutFinanceCount">
  1046. select aid,dates,sum(publicCount)publicCount
  1047. from (select aid,if(a.`type` in (0,1,2),1,0) publicCount,DATE_FORMAT(a.release_start , '%Y-%m-%d') dates
  1048. from public_release a left join public_release_details b on a.id=b.prid
  1049. where a.status=2 and a.aid= #{aid}
  1050. and a.release_start between #{startTime} and #{endTime})x
  1051. group by x.aid,x.dates
  1052. </select>
  1053. <select id="selectByOrderNo" resultMap="PublicReleaseMap">
  1054. select
  1055. <include refid="PublicReleaseAllSql" />
  1056. from public_release
  1057. where status in (1,2)
  1058. and order_no= #{orderNo}
  1059. </select>
  1060. <select id="selectMyNewPublic" resultMap="PublicReleaseMap">
  1061. select
  1062. <include refid="PublicReleaseAllSql" />
  1063. from public_release
  1064. where status in(1,2) and aid = #{aid}
  1065. order by release_start desc limit 10
  1066. </select>
  1067. <select id="selectOutListBoById" resultType="com.goafanti.weChat.bo.OutPublicReleaseList">
  1068. select a.id ,c.name aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.aid,a.public_type publicType,
  1069. date_format(a.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,date_format(a.create_time ,'%Y-%m-%d %H:%i:%S') createTimes,a.status,
  1070. date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_status updateStatus,a.district_name districtName,
  1071. a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,a.type,a.main_name mainName,a.reject_name rejectName,
  1072. a.assistant_aid assistantAid ,a.assistant_name assistantName,a.public_again publicAgain,a.user_names userNames,
  1073. ea.total_amount expenseAmount ,a.clock_in clockIn,c2.name reviewerName,a.tech_start_process techStartProcess
  1074. from public_release a left join admin c on a.aid =c.id
  1075. left join admin c2 on c.reviewer=c2.id
  1076. left join (select * from expense_account where status in (0,1,2,3)) ea on a.id =ea.prid
  1077. where a.id= #{id}
  1078. </select>
  1079. <select id="selectAll" resultMap="PublicReleaseMap">
  1080. select
  1081. <include refid="PublicReleaseAllSql" />
  1082. from public_release
  1083. where status in (1,2)
  1084. </select>
  1085. <select id="releaseAndExpenseCount" resultType="com.goafanti.weChat.bo.releaseAndExpenseCountOut">
  1086. select
  1087. a.order_no orderNo,a.contract_no contractNo,b.buyer_name buyerName,b.salesman_name salesmanName,b.dep_name depName,
  1088. toc.actual_duration actualDuration ,toc.max_type as maxType,toc.max_status as maxStatus,
  1089. a.total_amount totalAmount,a.settlement_amount settlementAmount,b.bid_type bidType,
  1090. c.expenseCount,c.peopleCount,c.notExamine,c.rejectCount,d.paymentAmount,c.days,c.amount expenseAmount
  1091. from t_order_new a left join t_order_mid b on a.order_no =b.order_no
  1092. left join t_order_public_release_count toc on a.order_no =toc.order_no
  1093. inner join (select a.order_no,a.expenseCount,b.peopleCount,c.notExamine, c.rejectCount,a.days,a.amount
  1094. from (select a.order_no,count(a.id)expenseCount,sum(a.amount) amount,sum(ROUND(a.duration/7.5) )days
  1095. from expense_account a where a.target_type = 1 and a.status=2
  1096. <if test="startTime !=null and endTime !=null">
  1097. and a.create_time BETWEEN #{startTime} and #{endTime}
  1098. </if>
  1099. group by order_no )a
  1100. left join (select order_no,count(aid)peopleCount from (select a.order_no,aid from expense_account a
  1101. where a.target_type = 1 and a.status=2 group by order_no,aid )a group by order_no)b on a.order_no=b.order_no
  1102. left join (select a.order_no,sum(notExamine)notExamine,sum(rejectCount)rejectCount
  1103. from (select a.order_no,status ,IF(status=1,1,0)notExamine,IF(status=3,1,0)rejectCount
  1104. from expense_account a where a.target_type=1
  1105. )a group by order_no)c on a.order_no=c.order_no )c on a.order_no =c.order_no
  1106. left join ( select a.order_no ,sum(c.payment_amount) paymentAmount
  1107. from t_order_new a left join t_order_task b on a.order_no =b.order_no left join t_order_payment c on b.id =c.tid
  1108. where c.status =3 group by order_no )d on a.order_no=d.order_no
  1109. where a.delete_sign in (0,2) and a.process_status >0
  1110. <if test="contractNo != null">
  1111. and a.contract_no = #{contractNo}
  1112. </if>
  1113. <if test="buyerName != null">
  1114. and b.buyer_name like concat('%',#{buyerName},'%')
  1115. </if>
  1116. <if test="depId != null">
  1117. and a.order_dep = #{depId}
  1118. </if>
  1119. <if test="aid != null">
  1120. and a.salesman_id = #{aid}
  1121. </if>
  1122. <if test="allStatus == 1">
  1123. and toc.exceed_duration =0
  1124. </if>
  1125. <if test="allStatus == 2">
  1126. and toc.exceed_duration >0
  1127. </if>
  1128. order by contract_no desc
  1129. </select>
  1130. <select id="selectSonIdByMain" parameterType="java.lang.Integer" resultMap="PublicReleaseMap">
  1131. select
  1132. b.id, b.aid, b.release_start, b.release_end, b.remarks, b.annex_url, b.status, b.create_time, b.pid, b.pname, b.duration, b.valid_date, b.supplement, b.audit_info, b.plan, b.expected_effect, b.next_plan, b.type, b.order_no, b.update_time, b.update_status, b.assist, b.assist_aid, b.assist_aid_name, b.main_id, b.main_name, b.reject_name, b.assistant_aid, b.assistant_name, b.public_again, b.audit_time, b.new_user, b.sign_sum, b.user_names, b.object_type, b.public_type, b.district_name, b.clock_in, b.tech_start_process, b.address_name
  1133. from public_release a left join public_release b on a.main_id=b.id
  1134. where a.id = #{id,jdbcType=INTEGER}
  1135. </select>
  1136. <select id="selectCountByAssistUnaudited" resultType="java.lang.Integer">
  1137. SELECT count(*)
  1138. from public_release a
  1139. where a.`type`=0 and a.assist =1 and a.status =1
  1140. and a.id in (select pr.main_id
  1141. from public_release pr left join admin_public_reviewer apr on
  1142. pr.aid = apr.aid
  1143. where pr.`type` =3 and apr.type = 1
  1144. and apr.reviewer_id = #{aid})
  1145. </select>
  1146. <select id="selectCountByUnaudited" resultType="java.lang.Integer">
  1147. select COUNT(*)
  1148. from public_release a left join admin c on a.aid =c.id
  1149. where a.public_type in (0,2) and a.assist in(0,1) and a.tech_start_process in (0,2)
  1150. and a.status =1 and a.assist_process in (0,1)
  1151. and c.reviewer = #{aid}
  1152. </select>
  1153. <select id="selectCountByOtherUnaudited" resultType="java.lang.Integer">
  1154. select count(*)
  1155. from public_release a
  1156. left join public_release_details b on a.id=b.prid
  1157. left join `user` e on b.uid=e.id
  1158. where a.assist in(0,1)
  1159. and(a.public_type =1 or a.tech_start_process=1)
  1160. and a.status =1
  1161. and e.aid = #{aid}
  1162. </select>
  1163. <select id="selectByUid" resultType="com.goafanti.customer.bo.MyUserDetailsBo">
  1164. select a.id ,a.aid,c.name aname,a.release_start as releaseStart
  1165. from public_release a left join admin c on a.aid =c.id
  1166. where a.status in (2) and a.type in (0,1,2)
  1167. and a.id in (select DISTINCT prid from public_release_details where uid = #{id})
  1168. </select>
  1169. <select id="selectCountByUid" resultType="com.goafanti.customer.bo.MyUserDetailsBo">
  1170. select a.id ,a.aid,c.name aname,a.release_start as releaseStart,a.duration
  1171. from public_release a left join admin c on a.aid =c.id
  1172. where a.status in (2)
  1173. and a.id in (select DISTINCT prid from public_release_details where uid = #{id})
  1174. </select>
  1175. <select id="selectByMainIdAndReviewer" resultMap="PublicReleaseMap">
  1176. select
  1177. a.id, a.aid, a.release_start, a.release_end, a.remarks, a.annex_url, a.status, a.create_time, a.pid, a.pname, a.duration, a.valid_date, a.supplement, a.audit_info, a.plan, a.expected_effect, a.next_plan, a.type, a.order_no, a.update_time, a.update_status, a.assist, a.assist_aid, a.assist_aid_name, a.main_id, a.main_name
  1178. from public_release a left join admin_public_reviewer b on a.aid =b.aid and b.type=1
  1179. where a.main_id = #{id}
  1180. and b.reviewer_id = #{reviewerId}
  1181. </select>
  1182. <select id="selectDetailsByPrid" resultType="com.goafanti.common.model.PublicReleaseDetails">
  1183. select
  1184. a.id, a.prid, a.uid
  1185. from public_release_details a
  1186. where a.prid = #{prid}
  1187. </select>
  1188. <select id="checkTime" resultMap="PublicReleaseMap">
  1189. select
  1190. <include refid="PublicReleaseAllSql"/>
  1191. from public_release where aid=#{aid} and status in (0,1,2)
  1192. and (alone in (0,1) or (alone=2 and assist=2))
  1193. and ( (release_start &gt;= #{start} and release_start &lt;= #{end})
  1194. or (release_start &lt; #{start} and release_end &gt; #{start})
  1195. or (release_start &lt; #{end} and release_end &gt; #{end}))
  1196. </select>
  1197. <select id="checkTech" resultMap="PublicReleaseMap">
  1198. select
  1199. <include refid="PublicReleaseAllSql"/>
  1200. from public_release where status =1 and `type` =0 and assist =1
  1201. and FIND_IN_SET(#{aid},assist_aid)
  1202. and ( (release_start &gt;= #{start} and release_start &lt;= #{end})
  1203. or (release_start &lt; #{start} and release_end &gt; #{start})
  1204. or (release_start &lt; #{end} and release_end &gt; #{end}))
  1205. </select>
  1206. <select id="selectByMonth" resultMap="PublicReleaseMap">
  1207. select
  1208. <include refid="PublicReleaseAllSql"/>
  1209. from public_release where aid=#{aid} and status in (2) and clock_in=1
  1210. and (release_start &gt; #{start} and release_start &lt; #{end})
  1211. </select>
  1212. </mapper>