PublicReleaseMapper.xml 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380
  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. left join public_release_log prl on a.id=prl.prid and prl.aid=#{aid}
  701. </if>
  702. <if test="type==6">
  703. JOIN (
  704. SELECT pr.main_id
  705. FROM public_release pr
  706. JOIN admin_public_reviewer apr ON pr.aid = apr.aid
  707. WHERE pr.`type` IN (3, 6)
  708. AND apr.type = 1
  709. AND apr.reviewer_id = #{aid}
  710. ) sub ON a.id = sub.main_id
  711. </if>
  712. <if test="type==7">
  713. left join t_order_public_release_count opc on a.order_no=opc.order_no
  714. </if>
  715. where 1=1
  716. <include refid="listPublicReleaseSql"/>
  717. ORDER BY (case when a.status=1 then 1 when a.status=2 then 2 when a.status=3 then 5
  718. when a.status=0 then 3 when a.status=4 then 4 else 0 end),a.create_time desc
  719. <if test="page_sql!=null">
  720. ${page_sql}
  721. </if>
  722. </select>
  723. <sql id="listPublicReleaseSql">
  724. <if test="type==0 or type==8 or type==9">
  725. <if test="type==8">
  726. and a.type=0
  727. and a.assist =1
  728. </if>
  729. <if test="type==9">
  730. and a.type=5
  731. and a.assist =1
  732. </if>
  733. and a.public_type in (0,1,2,3)
  734. <if test="assist ==0">
  735. and a.assist in(0,1,4)
  736. </if>
  737. <if test="assist == 2">
  738. <if test="type==10">
  739. and a.type=6
  740. </if>
  741. <if test="type==0">
  742. and a.type = 3
  743. </if>
  744. and a.assist in (2,4)
  745. </if>
  746. <if test="assist == 3">
  747. and a.assist =3
  748. </if>
  749. <if test="assist ==4">
  750. and a.assist in (2,3,4)
  751. </if>
  752. <if test="assistType ==1">
  753. and a.assist in(0,1,2)
  754. </if>
  755. <if test="aid !=null">
  756. and a.aid= #{aid}
  757. </if>
  758. <if test="statusType ==1">
  759. and a.status in (0,1,2,4)
  760. </if>
  761. </if>
  762. <if test="type==1">
  763. and apr.reviewer_id = #{aid}
  764. and a.public_type in (0,2)
  765. and a.assist in(0,1)
  766. and a.tech_start_process in (0,2)
  767. and a.assist_process in (0,1,2,3,4)
  768. <if test="status == 1">
  769. and a.status = 1 and a.assist_process in (0,1)
  770. and ((apr.type=0 and a.process_status in (0,1)) or(apr.type=4 and a.process_status in (2)))
  771. </if>
  772. <if test="status == 2">
  773. and a.status in(1,2)
  774. and prl.status=2
  775. </if>
  776. </if>
  777. <if test="type==2">
  778. and a.public_type in (0,2)
  779. and a.assist in(0,1)
  780. and d.manager_id = #{aid}
  781. </if>
  782. <if test="type==3">
  783. and a.public_type in (0,2)
  784. and a.assist=2
  785. <if test="aid !=null">
  786. and a.aid= #{aid}
  787. </if>
  788. and a.type = #{type}
  789. </if>
  790. <if test="type==4">
  791. and a.assist in(0,1)
  792. and e.aid = #{aid}
  793. <if test="status==null"> and a.public_type in (1,2) </if>
  794. <if test="status==1">and a.status=1 and a.public_type in (1) </if>
  795. <if test="status==2">and a.public_type in (2) </if>
  796. </if>
  797. <if test="type==5">
  798. and e.aid =#{aid}
  799. <if test="status==null">and a.tech_start_process in (1,2) </if>
  800. <if test="status==1">and a.status=1 and a.tech_start_process in (1) </if>
  801. <if test="status==2">and a.tech_start_process in (2) </if>
  802. </if>
  803. <if test="type==6">
  804. and a.type in (0,5)
  805. and a.assist=1
  806. and a.process_status in(0,3)
  807. </if>
  808. <if test="type==7">
  809. and opc.max_process in (1,2,3,4,5)
  810. <if test="maxProcessStatus ==null">
  811. and opc.max_process >= #{configType}
  812. </if>
  813. <if test="maxProcessStatus ==0">
  814. and opc.max_process= #{configType}
  815. </if>
  816. <if test="maxProcessStatus ==1">
  817. and opc.max_process > #{configType}
  818. and opc.max_process in (1,2,3,5)
  819. </if>
  820. <if test="maxProcessStatus ==2">
  821. and opc.max_process =4
  822. </if>
  823. </if>
  824. <if test="clockIn !=null">
  825. and a.clock_in =#{clockIn}
  826. </if>
  827. <if test="clockTime !=null">
  828. and a.release_start &lt; #{clockTime} and a.release_end &gt; #{clockTime}
  829. </if>
  830. <if test="releaseStarts != null and publicEnd != null">
  831. and a.release_start BETWEEN #{releaseStarts} and #{publicEnd}
  832. </if>
  833. <if test="userName !=null">
  834. and e.nickname like concat('%',#{userName},'%')
  835. </if>
  836. <if test="type!=4 and type !=5 and type != 1">
  837. <if test="status !=null ">
  838. and a.status = #{status}
  839. </if>
  840. </if>
  841. </sql>
  842. <select id="countPublicRelease" resultType="java.lang.Integer">
  843. select count(*)
  844. from public_release a left join admin c on a.aid =c.id
  845. <if test="type==2">
  846. left join department d on c.department_id =d.id
  847. </if>
  848. <if test="type==4 or type==5 or userName !=null">
  849. left join public_release_details b on a.id=b.prid
  850. left join user e on b.uid=e.id left join admin ad on e.aid=ad.id
  851. </if>
  852. <if test="type==1">
  853. left join admin_public_reviewer apr on a.aid=apr.aid
  854. left join public_release_log prl on a.id=prl.prid and prl.aid=#{aid}
  855. </if>
  856. <if test="type==6">
  857. JOIN (
  858. SELECT pr.main_id
  859. FROM public_release pr
  860. JOIN admin_public_reviewer apr ON pr.aid = apr.aid
  861. WHERE pr.`type` IN (3, 6)
  862. AND apr.type = 1
  863. AND apr.reviewer_id = #{aid}
  864. ) sub ON a.id = sub.main_id
  865. </if>
  866. <if test="type==7">
  867. left join t_order_public_release_count opc on a.order_no=opc.order_no
  868. </if>
  869. where 1=1
  870. <include refid="listPublicReleaseSql"/>
  871. </select>
  872. <select id="selectDtails" resultType="com.goafanti.weChat.bo.OutPublicRelease">
  873. 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,
  874. 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,
  875. 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,
  876. 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,
  877. 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,
  878. 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,
  879. pad.type as assistType,pad.content_type assistContentType,pad.content assistContent
  880. from public_release a left join admin c on a.aid =c.id left join admin c2 on c.reviewer =c2.id
  881. left join (select prid ,GROUP_CONCAT(uid)uids from public_release_details where prid= #{id} group by prid)x on a.id=x.prid
  882. left join t_order_new d on a.order_no=d.order_no
  883. left join public_assist_details pad on a.id=pad.prid
  884. where 1=1
  885. <if test="id !=null">
  886. and a.id= #{id}
  887. </if>
  888. </select>
  889. <select id="selectDtailsByFid" resultType="com.goafanti.weChat.bo.OutPublicReleaseAndDetails">
  890. 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,
  891. 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,
  892. 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,
  893. a.plan ,a.expected_effect expectedEffect,a.next_plan nextPlan,c.reviewer,a.type,a.order_no orderNo,d.contract_no contractNo,
  894. 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,
  895. a.main_name mainName,a.assistant_aid assistantAid,a.assistant_name assistantName,a.public_again publicAhain
  896. from public_release a left join admin c on a.aid =c.id
  897. left join public_release_details x on a.id=x.prid
  898. left join user u on x.uid=u.id
  899. left join t_order_new d on a.order_no=d.order_no
  900. where 1=1
  901. <if test="ufid !=null">
  902. and x.ufid= #{ufid}
  903. </if>
  904. </select>
  905. <select id="listPublicStatistics" resultType="com.goafanti.weChat.bo.OutPublicStatistics">
  906. select y.aid,y.bh,y.dk,y.wsh,y.tg,y.xds,y.duration,c.name
  907. from(select x.aid ,sum(x.bh)bh,sum(x.wsh)wsh,sum(x.tg)tg,sum(x.xds)xds,
  908. sum(x.dk)dk,sum(x.duration)duration
  909. from (select a.aid, b.dk ,
  910. if(a.status=0,1,0)bh ,
  911. if(a.status=1,1,0)wsh,
  912. if(a.status=2 and a.type &lt; 5,1,0)tg,
  913. if(a.status=2 and (a.type=5 or a.type=6),1,0)xds,
  914. if(a.status=2,a.duration,0)duration
  915. from public_release a left join admin c on a.aid =c.id
  916. inner join (select prid ,sum(if(clock_in=1,1,0))dk from public_release_details where 1=1
  917. <if test="clockStart != null and clockEnd != null">
  918. and clock_in_time between #{clockStart} and #{clockEnd}
  919. </if>
  920. group by prid ) b on a.id =b.prid
  921. where 1=1
  922. <if test="aid != null">
  923. and a.aid= #{aid}
  924. </if>
  925. <if test="createStart != null and createEnd !=null">
  926. and a.create_time between #{createStart} and #{createEnd}
  927. </if>
  928. <if test="depId != null">
  929. and c.department_id = #{depId}
  930. </if>
  931. )x group by x.aid)y left join admin c on c.id=y.aid
  932. <if test="page_sql!=null">
  933. ${page_sql}
  934. </if>
  935. </select>
  936. <select id="countPublicStatistics" resultType="java.lang.Integer">
  937. select count(*) from (select aid from public_release a
  938. inner join (select prid ,sum(if(clock_in=1,1,0))dk from public_release_details where 1=1
  939. <if test="clockStart != null and clockEnd != null">
  940. and clock_in_time between #{clockStart} and #{clockEnd}
  941. </if>
  942. group by prid ) b on a.id =b.prid
  943. left join admin c on a.aid=c.id
  944. where 1=1
  945. <if test="aid != null">
  946. and a.aid= #{aid}
  947. </if>
  948. <if test="createStart != null and createEnd !=null">
  949. and a.create_time between #{createStart} and #{createEnd}
  950. </if>
  951. <if test="depId != null">
  952. and c.department_id = #{depId}
  953. </if>
  954. group by aid)x
  955. </select>
  956. <select id="listPublicDtails" resultType="com.goafanti.weChat.bo.OutPublicDtails">
  957. 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,
  958. 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,
  959. 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,
  960. 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,
  961. b.plan ,b.next_plan nextPlan ,b.expected_effect expectedEffect,b.update_status updateStatus,b.assist_aid_name assistAidName,
  962. b.main_name mainName,b.assist,b.assistant_aid assistantAid, b.assistant_name assistantName,f.contract_no contractNo,
  963. uai.customer_demand customerDemand,uai.early_communication earlyCommunication,uai.interview_ideas interviewIdeas,
  964. uai.interview_purpose interviewPurpose,uai.interview_feedback interviewFeedback,uai.follow_up_plan followUpPlan,
  965. uai.interview_recommend interviewRecommend,pad.type assistType,pad.content_type assistContentType,pad.content assistContent,
  966. e.name sname,f.total_amount totalAmout,d.sign_bills signBills,date_format(d.sign_time,'%Y-%m-%d')signTime
  967. from public_release_details a left join public_release b on a.prid =b.id
  968. left join admin c on b.aid =c.id
  969. left join t_order_new f on b.order_no =f.order_no
  970. left join `user` d on a.uid =d.id left join admin e on d.aid=e.id
  971. left join user_archives_interview uai on a.id=uai.prdid
  972. left join public_assist_details pad on b.id=pad.prid
  973. where 1=1
  974. <include refid="publicDtails_sql" />
  975. order by b.status,b.create_time desc
  976. <if test="page_sql!=null">
  977. ${page_sql}
  978. </if>
  979. </select>
  980. <sql id="publicDtails_sql">
  981. <if test="publicType != null">
  982. and b.type= #{publicType}
  983. </if>
  984. <if test="assistType!=null">
  985. and
  986. <foreach collection="assistType" item="type" separator=" or " open="(" close=")">
  987. find_in_set(#{type},pad.type) &gt; 0
  988. </foreach>
  989. </if>
  990. <if test="aid != null">
  991. and b.aid= #{aid}
  992. </if>
  993. <if test="sid != null">
  994. and d.aid= #{sid}
  995. </if>
  996. <if test="deps !=null">
  997. and c.department_id in
  998. <foreach close=")" collection="deps" item="dep" open="(" separator=",">
  999. #{dep}
  1000. </foreach>
  1001. </if>
  1002. <if test="uid != null">
  1003. and a.uid = #{uid}
  1004. </if>
  1005. <if test="releaseStart != null and releaseEnd != null">
  1006. and (b.release_start between #{releaseStart} and #{releaseEnd} or b.release_end between #{releaseStart} and #{releaseEnd})
  1007. </if>
  1008. <if test="createStart != null and createEnd != null">
  1009. and b.create_time between #{createStart} and #{createEnd}
  1010. </if>
  1011. <if test="status != null">
  1012. and b.status = #{status}
  1013. </if>
  1014. <if test="statusType == 1">
  1015. and b.status in (1,2)
  1016. </if>
  1017. <if test="clockIn !=null">
  1018. and a.clock_in= #{clockIn}
  1019. </if>
  1020. <if test="contractNo !=null">
  1021. and f.contract_no like CONCAT('%',#{contractNo},'%')
  1022. </if>
  1023. </sql>
  1024. <select id="countPublicDtails" resultType="java.lang.Integer">
  1025. select count(*)
  1026. from public_release_details a left join public_release b on a.prid =b.id
  1027. left join admin c on b.aid =c.id left join `user` d on a.uid =d.id
  1028. <if test="contractNo !=null">
  1029. left join t_order_new f on b.order_no =f.order_no
  1030. </if>
  1031. <if test="assistType!=null">
  1032. left join public_assist_details pad on b.id=pad.prid
  1033. </if>
  1034. where 1=1
  1035. <include refid="publicDtails_sql" />
  1036. </select>
  1037. <select id="getTimeUserFollow" resultType="com.goafanti.common.model.OutPublicReleaseCount">
  1038. 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
  1039. left join public_release_details b on a.id=b.prid
  1040. where b.main_status =1 and a.create_time between #{date} and #{now}
  1041. group by a.aid,b.uid,b.new_user)a left join admin c on a.aid=c.id
  1042. left join department d on c.department_id =d.id left join district_glossory e on d.province =e.id
  1043. </select>
  1044. <select id="publicByOrder" resultType="com.goafanti.weChat.bo.OutPublicRelease">
  1045. select a.id,a.uid,b.aid,b.nickname ,pr.aname,a.duration ,a.district_name districtName,
  1046. date_format(pr.release_start,'%Y-%m-%d %H:%i:%S')releaseStarts,
  1047. date_format(pr.release_end ,'%Y-%m-%d %H:%i:%S')releaseEnds,
  1048. date_format(a.clock_in_time ,'%Y-%m-%d %H:%i:%S')clockInTimes,
  1049. pr.remarks
  1050. from public_release_details a left join public_release pr on a.prid=pr.id
  1051. left join user b on a.uid=b.id left join admin c on pr.aid =c.id
  1052. where pr.order_no = #{orderNo}
  1053. </select>
  1054. <select id="selectByMainId" parameterType="java.lang.Integer" resultMap="PublicReleaseMap">
  1055. select
  1056. <include refid="PublicReleaseAllSql" />
  1057. from public_release
  1058. where main_id = #{mainId}
  1059. <if test="type !=null">
  1060. and type= #{type}
  1061. </if>
  1062. <if test="aid !=null">
  1063. and aid= #{aid}
  1064. </if>
  1065. </select>
  1066. <update id="updateStatusByMainId">
  1067. update public_release set status= #{status}
  1068. where main_id= #{mainId}
  1069. <if test="type !=null">
  1070. and type= #{type}
  1071. </if>
  1072. <if test="aid !=null">
  1073. and aid= #{aid}
  1074. </if>
  1075. </update>
  1076. <update id="updateAssist">
  1077. update public_release set assist_aid=null,assist_aid_name=null
  1078. where id= #{id}
  1079. </update>
  1080. <select id="selectCountByaidAndDate" resultType="java.lang.Integer">
  1081. select ifnull(count(*),0)publicReleaseCount
  1082. from (select aid
  1083. from public_release a left join public_release_details b on a.id=b.prid
  1084. where status =2 and aid= #{aid}
  1085. <if test="startTime !=null and endTime !=null">
  1086. and a.release_start BETWEEN #{startTime} and #{endTime}
  1087. </if>
  1088. )x
  1089. group by aid
  1090. </select>
  1091. <select id="selectByaidAndDate" resultType="com.goafanti.admin.bo.OutFinanceCount">
  1092. select aid,dates,sum(publicCount)publicCount
  1093. from (select aid,if(a.`type` in (0,1,2),1,0) publicCount,DATE_FORMAT(a.release_start , '%Y-%m-%d') dates
  1094. from public_release a left join public_release_details b on a.id=b.prid
  1095. where a.status=2 and a.aid= #{aid}
  1096. and a.release_start between #{startTime} and #{endTime})x
  1097. group by x.aid,x.dates
  1098. </select>
  1099. <select id="selectByOrderNo" resultMap="PublicReleaseMap">
  1100. select
  1101. <include refid="PublicReleaseAllSql" />
  1102. from public_release
  1103. where status in (1,2)
  1104. and order_no= #{orderNo}
  1105. </select>
  1106. <select id="selectMyNewPublic" resultMap="PublicReleaseMap">
  1107. select
  1108. <include refid="PublicReleaseAllSql" />
  1109. from public_release
  1110. where status in(1,2) and aid = #{aid}
  1111. and release_start &lt;= now()
  1112. and release_end &gt;= now()
  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 type &lt;5
  1240. and (alone in (0,1) or (alone=2 and assist=2))
  1241. and ( (release_start &gt;= #{start} and release_start &lt;= #{end})
  1242. or (release_start &lt; #{start} and release_end &gt; #{start})
  1243. or (release_start &lt; #{end} and release_end &gt; #{end}))
  1244. </select>
  1245. <select id="checkTech" resultMap="PublicReleaseMap">
  1246. select
  1247. <include refid="PublicReleaseAllSql"/>
  1248. from public_release where status =1 and `type` =0 and assist =1
  1249. and FIND_IN_SET(#{aid},assist_aid)
  1250. and ( (release_start &gt;= #{start} and release_start &lt;= #{end})
  1251. or (release_start &lt; #{start} and release_end &gt; #{start})
  1252. or (release_start &lt; #{end} and release_end &gt; #{end}))
  1253. </select>
  1254. <select id="selectByMonth" resultMap="PublicReleaseMap">
  1255. select
  1256. <include refid="PublicReleaseAllSql"/>
  1257. from public_release where status in (2) and clock_in=1
  1258. <if test="type==null">
  1259. and (release_start &gt; #{start} and release_start &lt; #{end})
  1260. </if>
  1261. <if test="type==1">
  1262. and (release_start &lt; #{start} and release_end &gt; #{start})
  1263. </if>
  1264. </select>
  1265. <select id="selectAllAidUid" resultType="com.goafanti.Interview.bo.OutPublicAidUid">
  1266. select a.id ,a.aid,b.uid ,a.release_start as releaseStart
  1267. from public_release a left join public_release_details b on a.id =b.prid
  1268. where a.status =2 and a.type=0
  1269. </select>
  1270. <select id="findAssistList" resultType="com.goafanti.weChat.bo.OutListAssist">
  1271. select a.id ,a.`type`,c.type assistType,
  1272. c.content_type contentType,c.content ,a.aname,a.assist_aid_name assistAidName,
  1273. a.user_names userNames ,d.sign_number signNumber ,d.public_count publicCount,d.assist_count assistCount ,
  1274. d.public_assist_count publicAssistCount ,d.non_public_count nonPublicCount,a.release_start releaseStart,
  1275. d.task_names taskNames
  1276. from public_release a left join public_release_details b on a.id =b.prid
  1277. left join public_assist_details c on a.id =c.prid
  1278. left join user_mid d on b.uid =d.uid
  1279. where a.assist =1 and a.status =2
  1280. <include refid="findAssistListSql"/>
  1281. order by a.release_start desc
  1282. <if test="page_sql != null">
  1283. ${page_sql}
  1284. </if>
  1285. </select>
  1286. <sql id="findAssistListSql">
  1287. <if test="type==0">
  1288. and a.type &lt; 5
  1289. </if>
  1290. <if test="type==1">
  1291. and a.type &gt; 4
  1292. </if>
  1293. <if test="contentType!=null">
  1294. and
  1295. <foreach item="item" collection="contentType" separator=" or ">
  1296. find_in_set(#{item},c.content_type) &gt; 0
  1297. </foreach>
  1298. </if>
  1299. <if test="aid !=null">
  1300. and a.aid = #{aid}
  1301. </if>
  1302. <if test="assistAid != null">
  1303. and FIND_IN_SET(#{assistAid},a.assist_aid)
  1304. </if>
  1305. <if test="uid !=null">
  1306. and b.uid = #{uid}
  1307. </if>
  1308. <if test="assistType !=null">
  1309. and
  1310. <foreach item="item" collection="assistType" separator=" or ">
  1311. find_in_set(#{item},c.type) &gt; 0
  1312. </foreach>
  1313. </if>
  1314. <if test="startTime !=null and endTime !=null">
  1315. and a.release_start between #{startTime} and #{endTime}
  1316. </if>
  1317. <if test="depId != null">
  1318. </if>
  1319. <if test="assistCount != null">
  1320. <if test="assistCount == 1">
  1321. and d.assist_count &lt; 5
  1322. </if>
  1323. <if test="assistCount == 2">
  1324. and d.assist_count &gt;4 and d.assist_count &lt; 10
  1325. </if>
  1326. <if test="assistCount == 3">
  1327. and d.assist_count &gt;9 and d.assist_count &lt; 15
  1328. </if>
  1329. <if test="assistCount == 4">
  1330. and d.assist_count &gt;14
  1331. </if>
  1332. </if>
  1333. </sql>
  1334. <select id="findAssistCount" resultType="java.lang.Integer">
  1335. select count(*)
  1336. from public_release a left join public_release_details b on a.id =b.prid
  1337. left join public_assist_details c on a.id =c.prid
  1338. left join user_mid d on b.uid =d.uid
  1339. where a.assist =1 and a.status =2
  1340. <include refid="findAssistListSql"/>
  1341. </select>
  1342. </mapper>