PublicReleaseMapper.xml 61 KB

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