PublicReleaseMapper.xml 65 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372
  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 or type==8 or type==9">
  714. <if test="type==8">
  715. and a.type=0
  716. </if>
  717. <if test="type==9">
  718. and a.type=5
  719. </if>
  720. and a.public_type in (0,1,2,3)
  721. <if test="assist ==0">
  722. and a.assist in(0,1,4)
  723. </if>
  724. <if test="assist == 2">
  725. and a.assist in (2,4)
  726. </if>
  727. <if test="assist == 3">
  728. and a.assist =3
  729. </if>
  730. <if test="assist ==4">
  731. and a.assist in (2,3,4)
  732. </if>
  733. <if test="assistType ==1">
  734. and a.assist in(0,1,2)
  735. </if>
  736. <if test="aid !=null">
  737. and a.aid= #{aid}
  738. </if>
  739. <if test="statusType ==1">
  740. and a.status in (0,1,2,4)
  741. </if>
  742. </if>
  743. <if test="type==1">
  744. and a.public_type in (0,2)
  745. and a.assist in(0,1)
  746. and a.tech_start_process in (0,2)
  747. and a.assist_process in (0,1,2,3,4)
  748. <if test="status == 1">
  749. and a.status = 1 and a.assist_process in (0,1)
  750. and ((apr.type=0 and a.process_status in (0,1)) or(apr.type=4 and a.process_status in (2)))
  751. and apr.reviewer_id = #{aid}
  752. </if>
  753. <if test="status == 2">
  754. and a.status in(1,2) and a.assist_process in (0,2,3,4)
  755. and apr.type in (0,4)
  756. and a.process_status in (0,4)
  757. and apr.reviewer_id = #{aid}
  758. </if>
  759. </if>
  760. <if test="type==2">
  761. and a.public_type in (0,2)
  762. and a.assist in(0,1)
  763. and d.manager_id = #{aid}
  764. </if>
  765. <if test="type==3">
  766. and a.public_type in (0,2)
  767. and a.assist=2
  768. <if test="aid !=null">
  769. and a.aid= #{aid}
  770. </if>
  771. and a.type = #{type}
  772. </if>
  773. <if test="type==4">
  774. and a.assist in(0,1)
  775. and e.aid = #{aid}
  776. <if test="status==null"> and a.public_type in (1,2) </if>
  777. <if test="status==1">and a.status=1 and a.public_type in (1) </if>
  778. <if test="status==2">and a.public_type in (2) </if>
  779. </if>
  780. <if test="type==5">
  781. and e.aid =#{aid}
  782. <if test="status==null">and a.tech_start_process in (1,2) </if>
  783. <if test="status==1">and a.status=1 and a.tech_start_process in (1) </if>
  784. <if test="status==2">and a.tech_start_process in (2) </if>
  785. </if>
  786. <if test="type==6">
  787. and a.type=0 and a.assist=1
  788. and a.id in (select pr.main_id from public_release pr left join admin_public_reviewer apr
  789. on pr.aid = apr.aid where pr.`type` =3 and apr.type = 1 and apr.reviewer_id = #{aid})
  790. </if>
  791. <if test="type==7">
  792. and opc.max_process in (1,2,3,4,5)
  793. <if test="maxProcessStatus ==null">
  794. and opc.max_process >= #{configType}
  795. </if>
  796. <if test="maxProcessStatus ==0">
  797. and opc.max_process= #{configType}
  798. </if>
  799. <if test="maxProcessStatus ==1">
  800. and opc.max_process > #{configType}
  801. and opc.max_process in (1,2,3,5)
  802. </if>
  803. <if test="maxProcessStatus ==2">
  804. and opc.max_process =4
  805. </if>
  806. </if>
  807. <if test="clockIn !=null">
  808. and a.clock_in =#{clockIn}
  809. </if>
  810. <if test="clockTime !=null">
  811. and a.release_start &lt; #{clockTime} and a.release_end &gt; #{clockTime}
  812. </if>
  813. <if test="releaseStarts != null and publicEnd != null">
  814. and a.release_start BETWEEN #{releaseStarts} and #{publicEnd}
  815. </if>
  816. <if test="userName !=null">
  817. and e.nickname like concat('%',#{userName},'%')
  818. </if>
  819. <if test="type!=4 and type !=5 and type != 1">
  820. <if test="status !=null ">
  821. and a.status = #{status}
  822. </if>
  823. </if>
  824. </sql>
  825. <select id="countPublicRelease" resultType="java.lang.Integer">
  826. select count(*)
  827. from public_release a left join admin c on a.aid =c.id
  828. <if test="type==2">
  829. left join department d on c.department_id =d.id
  830. </if>
  831. <if test="type==4 or type==5 or userName !=null">
  832. left join public_release_details b on a.id=b.prid
  833. left join user e on b.uid=e.id left join admin ad on e.aid=ad.id
  834. </if>
  835. <if test="type==1">
  836. left join admin_public_reviewer apr on a.aid=apr.aid
  837. </if>
  838. <if test="type==7">
  839. left join t_order_public_release_count opc on a.order_no=opc.order_no
  840. </if>
  841. where 1=1
  842. <include refid="listPublicReleaseSql"/>
  843. </select>
  844. <select id="selectDtails" resultType="com.goafanti.weChat.bo.OutPublicRelease">
  845. 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,
  846. 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,
  847. 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,
  848. 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,
  849. 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,
  850. 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
  851. from public_release a left join admin c on a.aid =c.id left join admin c2 on c.reviewer =c2.id
  852. left join (select prid ,GROUP_CONCAT(uid)uids from public_release_details where prid= #{id} group by prid)x on a.id=x.prid
  853. left join t_order_new d on a.order_no=d.order_no
  854. where 1=1
  855. <if test="id !=null">
  856. and a.id= #{id}
  857. </if>
  858. </select>
  859. <select id="selectDtailsByFid" resultType="com.goafanti.weChat.bo.OutPublicReleaseAndDetails">
  860. 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,
  861. 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,
  862. 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,
  863. a.plan ,a.expected_effect expectedEffect,a.next_plan nextPlan,c.reviewer,a.type,a.order_no orderNo,d.contract_no contractNo,
  864. 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,
  865. a.main_name mainName,a.assistant_aid assistantAid,a.assistant_name assistantName,a.public_again publicAhain
  866. from public_release a left join admin c on a.aid =c.id
  867. left join public_release_details x on a.id=x.prid
  868. left join user u on x.uid=u.id
  869. left join t_order_new d on a.order_no=d.order_no
  870. where 1=1
  871. <if test="ufid !=null">
  872. and x.ufid= #{ufid}
  873. </if>
  874. </select>
  875. <select id="listPublicStatistics" resultType="com.goafanti.weChat.bo.OutPublicStatistics">
  876. select y.aid,y.bh,y.dk,y.wsh,y.tg,y.xds,y.duration,c.name
  877. from(select x.aid ,sum(x.bh)bh,sum(x.wsh)wsh,sum(x.tg)tg,sum(x.xds)xds,
  878. sum(x.dk)dk,sum(x.duration)duration
  879. from (select a.aid, b.dk ,
  880. if(a.status=0,1,0)bh ,
  881. if(a.status=1,1,0)wsh,
  882. if(a.status=2 and a.type &lt; 5,1,0)tg,
  883. if(a.status=2 and (a.type=5 or a.type=6),1,0)xds,
  884. if(a.status=2,a.duration,0)duration
  885. from public_release a left join admin c on a.aid =c.id
  886. inner join (select prid ,sum(if(clock_in=1,1,0))dk from public_release_details where 1=1
  887. <if test="clockStart != null and clockEnd != null">
  888. and clock_in_time between #{clockStart} and #{clockEnd}
  889. </if>
  890. group by prid ) b on a.id =b.prid
  891. where 1=1
  892. <if test="aid != null">
  893. and a.aid= #{aid}
  894. </if>
  895. <if test="createStart != null and createEnd !=null">
  896. and a.create_time between #{createStart} and #{createEnd}
  897. </if>
  898. <if test="depId != null">
  899. and c.department_id = #{depId}
  900. </if>
  901. )x group by x.aid)y left join admin c on c.id=y.aid
  902. <if test="page_sql!=null">
  903. ${page_sql}
  904. </if>
  905. </select>
  906. <select id="countPublicStatistics" resultType="java.lang.Integer">
  907. select count(*) from (select aid from public_release a
  908. inner join (select prid ,sum(if(clock_in=1,1,0))dk from public_release_details where 1=1
  909. <if test="clockStart != null and clockEnd != null">
  910. and clock_in_time between #{clockStart} and #{clockEnd}
  911. </if>
  912. group by prid ) b on a.id =b.prid
  913. left join admin c on a.aid=c.id
  914. where 1=1
  915. <if test="aid != null">
  916. and a.aid= #{aid}
  917. </if>
  918. <if test="createStart != null and createEnd !=null">
  919. and a.create_time between #{createStart} and #{createEnd}
  920. </if>
  921. <if test="depId != null">
  922. and c.department_id = #{depId}
  923. </if>
  924. group by aid)x
  925. </select>
  926. <select id="listPublicDtails" resultType="com.goafanti.weChat.bo.OutPublicDtails">
  927. select a.id prdId,b.id,a.district_name districtName ,b.aname ,a.duration ,b.status ,b.annex_url annexUrl,a.photo_url photoUrl,d.nickname userName,
  928. 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,
  929. 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,
  930. 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,
  931. b.plan ,b.next_plan nextPlan ,b.expected_effect expectedEffect,b.update_status updateStatus,b.assist_aid_name assistAidName,
  932. b.main_name mainName,b.assist,b.assistant_aid assistantAid, b.assistant_name assistantName,f.contract_no contractNo,
  933. uai.customer_demand customerDemand,uai.early_communication earlyCommunication,uai.interview_ideas interviewIdeas,
  934. uai.interview_purpose interviewPurpose,uai.interview_feedback interviewFeedback,uai.follow_up_plan followUpPlan,
  935. uai.interview_recommend interviewRecommend,pad.type assistType,pad.content_type assistContentType,pad.content assistContent,
  936. e.name sname,f.total_amount totalAmout,d.sign_bills signBills,date_format(d.sign_time,'%Y-%m-%d')signTime
  937. from public_release_details a left join public_release b on a.prid =b.id
  938. left join admin c on b.aid =c.id
  939. left join t_order_new f on b.order_no =f.order_no
  940. left join `user` d on a.uid =d.id left join admin e on d.aid=e.id
  941. left join user_archives_interview uai on a.id=uai.prdid
  942. left join public_assist_details pad on b.id=pad.prid
  943. where 1=1
  944. <if test="publicType != null">
  945. and b.type= #{publicType}
  946. </if>
  947. <if test="assistType!=null">
  948. and pad.type= #{assistType}
  949. </if>
  950. <if test="aid != null">
  951. and b.aid= #{aid}
  952. </if>
  953. <if test="sid != null">
  954. and d.aid= #{sid}
  955. </if>
  956. <if test="deps !=null">
  957. and c.department_id in
  958. <foreach close=")" collection="deps" item="dep" open="(" separator=",">
  959. #{dep}
  960. </foreach>
  961. </if>
  962. <if test="uid != null">
  963. and a.uid = #{uid}
  964. </if>
  965. <if test="releaseStart != null and releaseEnd != null">
  966. and (b.release_start between #{releaseStart} and #{releaseEnd} or b.release_end between #{releaseStart} and #{releaseEnd})
  967. </if>
  968. <if test="createStart != null and createEnd != null">
  969. and b.create_time between #{createStart} and #{createEnd}
  970. </if>
  971. <if test="status != null">
  972. and b.status = #{status}
  973. </if>
  974. <if test="statusType == 1">
  975. and b.status in (1,2)
  976. </if>
  977. <if test="clockIn !=null">
  978. and a.clock_in= #{clockIn}
  979. </if>
  980. <if test="contractNo !=null">
  981. and f.contract_no like CONCAT('%',#{contractNo},'%')
  982. </if>
  983. order by b.status,b.create_time desc
  984. <if test="page_sql!=null">
  985. ${page_sql}
  986. </if>
  987. </select>
  988. <select id="countPublicDtails" resultType="java.lang.Integer">
  989. select count(*)
  990. from public_release_details a left join public_release b on a.prid =b.id
  991. left join admin c on b.aid =c.id left join `user` d on a.uid =d.id
  992. <if test="contractNo !=null">
  993. left join t_order_new f on b.order_no =f.order_no
  994. </if>
  995. <if test="assistType!=null">
  996. left join public_assist_details pad on b.id=pad.prid
  997. </if>
  998. where 1=1
  999. <if test="publicType != null">
  1000. and b.type= #{publicType}
  1001. </if>
  1002. <if test="assistType!=null">
  1003. and pad.type= #{assistType}
  1004. </if>
  1005. <if test="aid != null">
  1006. and b.aid= #{aid}
  1007. </if>
  1008. <if test="sid != null">
  1009. and d.aid= #{sid}
  1010. </if>
  1011. <if test="deps !=null">
  1012. and c.department_id in
  1013. <foreach close=")" collection="deps" item="dep" open="(" separator=",">
  1014. #{dep}
  1015. </foreach>
  1016. </if>
  1017. <if test="uid != null">
  1018. and a.uid = #{uid}
  1019. </if>
  1020. <if test="releaseStart != null and releaseEnd != null">
  1021. and (b.release_start between #{releaseStart} and #{releaseEnd} or b.release_end between #{releaseStart} and #{releaseEnd})
  1022. </if>
  1023. <if test="createStart != null and createEnd != null">
  1024. and b.create_time between #{createStart} and #{createEnd}
  1025. </if>
  1026. <if test="status != null">
  1027. and b.status = #{status}
  1028. </if>
  1029. <if test="statusType == 1">
  1030. and b.status in (1,2)
  1031. </if>
  1032. <if test="clockIn !=null">
  1033. and a.clock_in= #{clockIn}
  1034. </if>
  1035. <if test="contractNo !=null">
  1036. and f.contract_no like CONCAT('%',#{contractNo},'%')
  1037. </if>
  1038. </select>
  1039. <select id="getTimeUserFollow" resultType="com.goafanti.common.model.OutPublicReleaseCount">
  1040. 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
  1041. left join public_release_details b on a.id=b.prid
  1042. where b.main_status =1 and a.create_time between #{date} and #{now}
  1043. group by a.aid,b.uid,b.new_user)a left join admin c on a.aid=c.id
  1044. left join department d on c.department_id =d.id left join district_glossory e on d.province =e.id
  1045. </select>
  1046. <select id="publicByOrder" resultType="com.goafanti.weChat.bo.OutPublicRelease">
  1047. select a.id,a.uid,b.aid,b.nickname ,pr.aname,a.duration ,a.district_name districtName,
  1048. date_format(pr.release_start,'%Y-%m-%d %H:%i:%S')releaseStarts,
  1049. date_format(pr.release_end ,'%Y-%m-%d %H:%i:%S')releaseEnds,
  1050. date_format(a.clock_in_time ,'%Y-%m-%d %H:%i:%S')clockInTimes,
  1051. pr.remarks
  1052. from public_release_details a left join public_release pr on a.prid=pr.id
  1053. left join user b on a.uid=b.id left join admin c on pr.aid =c.id
  1054. where pr.order_no = #{orderNo}
  1055. </select>
  1056. <select id="selectByMainId" parameterType="java.lang.Integer" resultMap="PublicReleaseMap">
  1057. select
  1058. <include refid="PublicReleaseAllSql" />
  1059. from public_release
  1060. where main_id = #{mainId}
  1061. <if test="type !=null">
  1062. and type= #{type}
  1063. </if>
  1064. <if test="aid !=null">
  1065. and aid= #{aid}
  1066. </if>
  1067. </select>
  1068. <update id="updateStatusByMainId">
  1069. update public_release set status= #{status}
  1070. where main_id= #{mainId}
  1071. <if test="type !=null">
  1072. and type= #{type}
  1073. </if>
  1074. <if test="aid !=null">
  1075. and aid= #{aid}
  1076. </if>
  1077. </update>
  1078. <update id="updateAssist">
  1079. update public_release set assist_aid=null,assist_aid_name=null
  1080. where id= #{id}
  1081. </update>
  1082. <select id="selectCountByaidAndDate" resultType="java.lang.Integer">
  1083. select ifnull(count(*),0)publicReleaseCount
  1084. from (select aid
  1085. from public_release a left join public_release_details b on a.id=b.prid
  1086. where status =2 and aid= #{aid}
  1087. <if test="startTime !=null and endTime !=null">
  1088. and a.release_start BETWEEN #{startTime} and #{endTime}
  1089. </if>
  1090. )x
  1091. group by aid
  1092. </select>
  1093. <select id="selectByaidAndDate" resultType="com.goafanti.admin.bo.OutFinanceCount">
  1094. select aid,dates,sum(publicCount)publicCount
  1095. from (select aid,if(a.`type` in (0,1,2),1,0) publicCount,DATE_FORMAT(a.release_start , '%Y-%m-%d') dates
  1096. from public_release a left join public_release_details b on a.id=b.prid
  1097. where a.status=2 and a.aid= #{aid}
  1098. and a.release_start between #{startTime} and #{endTime})x
  1099. group by x.aid,x.dates
  1100. </select>
  1101. <select id="selectByOrderNo" resultMap="PublicReleaseMap">
  1102. select
  1103. <include refid="PublicReleaseAllSql" />
  1104. from public_release
  1105. where status in (1,2)
  1106. and order_no= #{orderNo}
  1107. </select>
  1108. <select id="selectMyNewPublic" resultMap="PublicReleaseMap">
  1109. select
  1110. <include refid="PublicReleaseAllSql" />
  1111. from public_release
  1112. where status in(1,2) and aid = #{aid}
  1113. order by release_start desc limit 10
  1114. </select>
  1115. <select id="selectOutListBoById" resultType="com.goafanti.weChat.bo.OutPublicReleaseList">
  1116. select a.id ,a.aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.aid,a.public_type publicType,
  1117. 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,
  1118. date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_status updateStatus,a.district_name districtName,
  1119. a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,a.type,a.main_name mainName,a.reject_name rejectName,
  1120. a.assistant_aid assistantAid ,a.assistant_name assistantName,a.public_again publicAgain,a.user_names userNames,
  1121. ea.total_amount expenseAmount ,a.clock_in clockIn,a.tech_start_process techStartProcess
  1122. from public_release a
  1123. left join (select * from expense_account where status in (0,1,2,3)) ea on a.id =ea.prid
  1124. where a.id= #{id}
  1125. </select>
  1126. <select id="selectAll" resultMap="PublicReleaseMap">
  1127. select
  1128. <include refid="PublicReleaseAllSql" />
  1129. from public_release
  1130. where status in (1,2)
  1131. </select>
  1132. <select id="releaseAndExpenseCount" resultType="com.goafanti.weChat.bo.releaseAndExpenseCountOut">
  1133. select
  1134. a.order_no orderNo,a.contract_no contractNo,b.buyer_name buyerName,b.salesman_name salesmanName,b.dep_name depName,
  1135. toc.actual_duration actualDuration ,toc.max_type as maxType,toc.max_status as maxStatus,
  1136. a.total_amount totalAmount,a.settlement_amount settlementAmount,b.bid_type bidType,
  1137. c.expenseCount,c.peopleCount,c.notExamine,c.rejectCount,d.paymentAmount,c.days,c.amount expenseAmount
  1138. from t_order_new a left join t_order_mid b on a.order_no =b.order_no
  1139. left join t_order_public_release_count toc on a.order_no =toc.order_no
  1140. inner join (select a.order_no,a.expenseCount,b.peopleCount,c.notExamine, c.rejectCount,a.days,a.amount
  1141. from (select a.order_no,count(a.id)expenseCount,sum(a.amount) amount,sum(ROUND(a.duration/7.5) )days
  1142. from expense_account a where a.target_type = 1 and a.status=2
  1143. <if test="startTime !=null and endTime !=null">
  1144. and a.create_time BETWEEN #{startTime} and #{endTime}
  1145. </if>
  1146. group by order_no )a
  1147. left join (select order_no,count(aid)peopleCount from (select a.order_no,aid from expense_account a
  1148. 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
  1149. left join (select a.order_no,sum(notExamine)notExamine,sum(rejectCount)rejectCount
  1150. from (select a.order_no,status ,IF(status=1,1,0)notExamine,IF(status=3,1,0)rejectCount
  1151. from expense_account a where a.target_type=1
  1152. )a group by order_no)c on a.order_no=c.order_no )c on a.order_no =c.order_no
  1153. left join ( select a.order_no ,sum(c.payment_amount) paymentAmount
  1154. 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
  1155. where c.status =3 group by order_no )d on a.order_no=d.order_no
  1156. where a.delete_sign in (0,2) and a.process_status >0
  1157. <if test="contractNo != null">
  1158. and a.contract_no = #{contractNo}
  1159. </if>
  1160. <if test="buyerName != null">
  1161. and b.buyer_name like concat('%',#{buyerName},'%')
  1162. </if>
  1163. <if test="depId != null">
  1164. and a.order_dep = #{depId}
  1165. </if>
  1166. <if test="aid != null">
  1167. and a.salesman_id = #{aid}
  1168. </if>
  1169. <if test="allStatus == 1">
  1170. and toc.exceed_duration =0
  1171. </if>
  1172. <if test="allStatus == 2">
  1173. and toc.exceed_duration >0
  1174. </if>
  1175. order by contract_no desc
  1176. </select>
  1177. <select id="selectSonIdByMain" parameterType="java.lang.Integer" resultMap="PublicReleaseMap">
  1178. select
  1179. 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
  1180. from public_release a left join public_release b on a.main_id=b.id
  1181. where a.id = #{id,jdbcType=INTEGER}
  1182. </select>
  1183. <select id="selectCountByAssistUnaudited" resultType="java.lang.Integer">
  1184. SELECT count(*)
  1185. from public_release a
  1186. where a.`type`=0 and a.assist =1 and a.status =1
  1187. and a.id in (select pr.main_id
  1188. from public_release pr left join admin_public_reviewer apr on
  1189. pr.aid = apr.aid
  1190. where pr.`type` =3 and apr.type = 1
  1191. and apr.reviewer_id = #{aid})
  1192. </select>
  1193. <select id="selectCountByUnaudited" resultType="java.lang.Integer">
  1194. select COUNT(*)
  1195. from public_release a left join admin c on a.aid =c.id
  1196. where a.public_type in (0,2) and a.assist in(0,1) and a.tech_start_process in (0,2)
  1197. and a.status =1 and a.assist_process in (0,1)
  1198. and c.reviewer = #{aid}
  1199. </select>
  1200. <select id="selectCountByOtherUnaudited" resultType="java.lang.Integer">
  1201. select count(*)
  1202. from public_release a
  1203. left join public_release_details b on a.id=b.prid
  1204. left join `user` e on b.uid=e.id
  1205. where a.assist in(0,1)
  1206. and(a.public_type =1 or a.tech_start_process=1)
  1207. and a.status =1
  1208. and e.aid = #{aid}
  1209. </select>
  1210. <select id="selectByUid" resultType="com.goafanti.customer.bo.MyUserDetailsBo">
  1211. select a.id ,a.aid,a.aname,a.release_start as releaseStart
  1212. from public_release a
  1213. where a.status in (2) and a.type in (0,1,2)
  1214. and a.id in (select DISTINCT prid from public_release_details where uid = #{id})
  1215. </select>
  1216. <select id="selectCountByUid" resultType="com.goafanti.customer.bo.MyUserDetailsBo">
  1217. select a.id ,a.aid,a.aname,a.release_start as releaseStart,a.duration
  1218. from public_release a
  1219. where a.status in (2)
  1220. and a.id in (select DISTINCT prid from public_release_details where uid = #{id})
  1221. </select>
  1222. <select id="selectByMainIdAndReviewer" resultMap="PublicReleaseMap">
  1223. select
  1224. 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
  1225. from public_release a left join admin_public_reviewer b on a.aid =b.aid and b.type=1
  1226. where a.main_id = #{id}
  1227. and b.reviewer_id = #{reviewerId}
  1228. </select>
  1229. <select id="selectDetailsByPrid" resultType="com.goafanti.common.model.PublicReleaseDetails">
  1230. select
  1231. a.id, a.prid, a.uid
  1232. from public_release_details a
  1233. where a.prid = #{prid}
  1234. </select>
  1235. <select id="checkTime" resultMap="PublicReleaseMap">
  1236. select
  1237. <include refid="PublicReleaseAllSql"/>
  1238. from public_release where aid=#{aid} and status in (0,1,2)
  1239. and (alone in (0,1) or (alone=2 and assist=2))
  1240. and ( (release_start &gt;= #{start} and release_start &lt;= #{end})
  1241. or (release_start &lt; #{start} and release_end &gt; #{start})
  1242. or (release_start &lt; #{end} and release_end &gt; #{end}))
  1243. </select>
  1244. <select id="checkTech" resultMap="PublicReleaseMap">
  1245. select
  1246. <include refid="PublicReleaseAllSql"/>
  1247. from public_release where status =1 and `type` =0 and assist =1
  1248. and FIND_IN_SET(#{aid},assist_aid)
  1249. and ( (release_start &gt;= #{start} and release_start &lt;= #{end})
  1250. or (release_start &lt; #{start} and release_end &gt; #{start})
  1251. or (release_start &lt; #{end} and release_end &gt; #{end}))
  1252. </select>
  1253. <select id="selectByMonth" resultMap="PublicReleaseMap">
  1254. select
  1255. <include refid="PublicReleaseAllSql"/>
  1256. from public_release where status in (2) and clock_in=1
  1257. <if test="type==null">
  1258. and (release_start &gt; #{start} and release_start &lt; #{end})
  1259. </if>
  1260. <if test="type==1">
  1261. and (release_start &lt; #{start} and release_end &gt; #{start})
  1262. </if>
  1263. </select>
  1264. <select id="selectAllAidUid" resultType="com.goafanti.Interview.bo.OutPublicAidUid">
  1265. select a.id ,a.aid,b.uid ,a.release_start as releaseStart
  1266. from public_release a left join public_release_details b on a.id =b.prid
  1267. where a.status =2 and a.type=0
  1268. </select>
  1269. <select id="findAssistList" resultType="com.goafanti.weChat.bo.OutListAssist">
  1270. select a.id ,if(a.`type` &lt; 5,0,1) assistType,
  1271. c.content_type contentType,c.content ,a.aname,a.assist_aid_name assistAidName,
  1272. a.user_names userNames ,d.sign_number signNumber ,d.public_count publicCount,d.assist_count assistCount ,
  1273. d.public_assist_count publicAssistCount ,d.non_public_count nonPublicCount,a.release_start releaseStart,
  1274. d.task_names taskNames
  1275. from public_release a left join public_release_details b on a.id =b.prid
  1276. left join public_assist_details c on a.id =c.prid
  1277. left join user_mid d on b.uid =d.uid
  1278. where a.assist =1
  1279. <include refid="findAssistListSql"/>
  1280. order by a.release_start desc
  1281. <if test="page_sql != null">
  1282. ${page_sql}
  1283. </if>
  1284. </select>
  1285. <sql id="findAssistListSql">
  1286. <if test="assistType==0">
  1287. and a.type &lt; 5
  1288. </if>
  1289. <if test="assistType==1">
  1290. and a.type &gt; 4
  1291. </if>
  1292. <if test="contentType!=null">
  1293. and c.content_type = #{contentType}
  1294. </if>
  1295. <if test="aid !=null">
  1296. and a.aid = #{aid}
  1297. </if>
  1298. <if test="assistAid != null">
  1299. and FIND_IN_SET(#{assistAid},a.assist_aid)
  1300. </if>
  1301. <if test="uid !=null">
  1302. and b.uid = #{uid}
  1303. </if>
  1304. <if test="projectType !=null">
  1305. and a.id in (select DISTINCT prid from public_release_type
  1306. where `type` in
  1307. <foreach item="item" collection="projectType" separator="," open="(" close=")">
  1308. #{item}
  1309. </foreach>
  1310. </if>
  1311. <if test="startTime !=null and endTime !=null">
  1312. and a.release_start between #{startTime} and #{endTime}
  1313. </if>
  1314. <if test="depId != null">
  1315. </if>
  1316. <if test="assistCount != null">
  1317. <if test="assistCount == 1">
  1318. and d.assist_count &lt; 5
  1319. </if>
  1320. <if test="assistCount == 2">
  1321. and d.assist_count &gt;4 and d.assist_count &lt; 10
  1322. </if>
  1323. <if test="assistCount == 3">
  1324. and d.assist_count &gt;9 and d.assist_count &lt; 15
  1325. </if>
  1326. <if test="assistCount == 4">
  1327. and d.assist_count &gt;14
  1328. </if>
  1329. </if>
  1330. </sql>
  1331. <select id="findAssistCount" resultType="java.lang.Integer">
  1332. select count(*)
  1333. from public_release a left join public_release_details b on a.id =b.prid
  1334. left join public_assist_details c on a.id =c.prid
  1335. left join user_mid d on b.uid =d.uid
  1336. where a.assist =1
  1337. <include refid="findAssistListSql"/>
  1338. </select>
  1339. </mapper>