PublicReleaseMapper.xml 61 KB

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