PublicReleaseMapper.xml 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782
  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 id="BaseResultMap" type="com.goafanti.common.model.PublicRelease">
  5. <id column="id" jdbcType="INTEGER" property="id" />
  6. <result column="uid" jdbcType="VARCHAR" property="uid" />
  7. <result column="aid" jdbcType="VARCHAR" property="aid" />
  8. <result column="release_start" jdbcType="TIMESTAMP" property="releaseStart" />
  9. <result column="release_end" jdbcType="TIMESTAMP" property="releaseEnd" />
  10. <result column="remarks" jdbcType="VARCHAR" property="remarks" />
  11. <result column="annex_url" jdbcType="VARCHAR" property="annexUrl" />
  12. <result column="user_name" jdbcType="VARCHAR" property="userName" />
  13. <result column="longitude" jdbcType="VARCHAR" property="longitude" />
  14. <result column="latitude" jdbcType="VARCHAR" property="latitude" />
  15. <result column="status" jdbcType="INTEGER" property="status" />
  16. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  17. <result column="clock_in" jdbcType="INTEGER" property="clockIn" />
  18. <result column="clock_in_time" jdbcType="TIMESTAMP" property="clockInTime" />
  19. <result column="photo_url" jdbcType="VARCHAR" property="photoUrl" />
  20. <result column="pid" jdbcType="VARCHAR" property="pid" />
  21. <result column="pname" jdbcType="VARCHAR" property="pname" />
  22. <result column="ufid" jdbcType="VARCHAR" property="ufid" />
  23. <result column="duration" jdbcType="DOUBLE" property="duration" />
  24. <result column="valid_date" jdbcType="VARCHAR" property="validDate" />
  25. <result column="new_user" jdbcType="INTEGER" property="newUser" />
  26. <result column="sign_sum" jdbcType="INTEGER" property="signSum" />
  27. <result column="main_status" jdbcType="INTEGER" property="mainStatus" />
  28. <result column="supplement" jdbcType="VARCHAR" property="supplement" />
  29. <result column="audit_info" jdbcType="VARCHAR" property="auditInfo" />
  30. <result column="plan" jdbcType="VARCHAR" property="plan" />
  31. <result column="expected_effect" jdbcType="VARCHAR" property="expectedEffect" />
  32. <result column="next_plan" jdbcType="VARCHAR" property="nextPlan" />
  33. <result column="type" jdbcType="INTEGER" property="type" />
  34. <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
  35. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  36. <result column="update_status" jdbcType="INTEGER" property="updateStatus" />
  37. <result column="assist" jdbcType="INTEGER" property="assist" />
  38. <result column="assist_aid" jdbcType="VARCHAR" property="assistAid" />
  39. <result column="assist_aid_name" jdbcType="VARCHAR" property="assistAidName" />
  40. <result column="main_id" jdbcType="INTEGER" property="mainId" />
  41. <result column="main_name" jdbcType="VARCHAR" property="mainName" />
  42. </resultMap>
  43. <sql id="Base_Column_List">
  44. id, `uid`, aid, release_start, release_end, remarks, annex_url, user_name, longitude,
  45. latitude, `status`, create_time, clock_in, clock_in_time, photo_url, pid, pname,
  46. ufid, duration, valid_date, new_user, sign_sum, main_status, supplement, audit_info,
  47. `plan`, expected_effect, next_plan, `type`, order_no, update_time, update_status,
  48. assist, assist_aid, assist_aid_name, main_id, main_name
  49. </sql>
  50. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  51. select
  52. <include refid="Base_Column_List" />
  53. from public_release
  54. where id = #{id,jdbcType=INTEGER}
  55. </select>
  56. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  57. delete from public_release
  58. where id = #{id,jdbcType=INTEGER}
  59. </delete>
  60. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicRelease" useGeneratedKeys="true">
  61. insert into public_release (id, `uid`, aid,
  62. release_start, release_end, remarks,
  63. annex_url, user_name, longitude,
  64. latitude, `status`, create_time,
  65. clock_in, clock_in_time, photo_url,
  66. pid, pname, ufid, duration,
  67. valid_date, new_user, sign_sum,
  68. main_status, supplement, audit_info,
  69. `plan`, expected_effect, next_plan,
  70. `type`, order_no, update_time,
  71. update_status, assist, assist_aid,
  72. assist_aid_name, main_id, main_name
  73. )
  74. values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR},
  75. #{releaseStart,jdbcType=TIMESTAMP}, #{releaseEnd,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR},
  76. #{annexUrl,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, #{longitude,jdbcType=VARCHAR},
  77. #{latitude,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
  78. #{clockIn,jdbcType=INTEGER}, #{clockInTime,jdbcType=TIMESTAMP}, #{photoUrl,jdbcType=VARCHAR},
  79. #{pid,jdbcType=VARCHAR}, #{pname,jdbcType=VARCHAR}, #{ufid,jdbcType=VARCHAR}, #{duration,jdbcType=DOUBLE},
  80. #{validDate,jdbcType=VARCHAR}, #{newUser,jdbcType=INTEGER}, #{signSum,jdbcType=INTEGER},
  81. #{mainStatus,jdbcType=INTEGER}, #{supplement,jdbcType=VARCHAR}, #{auditInfo,jdbcType=VARCHAR},
  82. #{plan,jdbcType=VARCHAR}, #{expectedEffect,jdbcType=VARCHAR}, #{nextPlan,jdbcType=VARCHAR},
  83. #{type,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
  84. #{updateStatus,jdbcType=INTEGER}, #{assist,jdbcType=INTEGER}, #{assistAid,jdbcType=VARCHAR},
  85. #{assistAidName,jdbcType=VARCHAR}, #{mainId,jdbcType=INTEGER}, #{mainName,jdbcType=VARCHAR}
  86. )
  87. </insert>
  88. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicRelease" useGeneratedKeys="true">
  89. insert into public_release
  90. <trim prefix="(" suffix=")" suffixOverrides=",">
  91. <if test="id != null">
  92. id,
  93. </if>
  94. <if test="uid != null">
  95. `uid`,
  96. </if>
  97. <if test="aid != null">
  98. aid,
  99. </if>
  100. <if test="releaseStart != null">
  101. release_start,
  102. </if>
  103. <if test="releaseEnd != null">
  104. release_end,
  105. </if>
  106. <if test="remarks != null">
  107. remarks,
  108. </if>
  109. <if test="annexUrl != null">
  110. annex_url,
  111. </if>
  112. <if test="userName != null">
  113. user_name,
  114. </if>
  115. <if test="longitude != null">
  116. longitude,
  117. </if>
  118. <if test="latitude != null">
  119. latitude,
  120. </if>
  121. <if test="status != null">
  122. `status`,
  123. </if>
  124. <if test="createTime != null">
  125. create_time,
  126. </if>
  127. <if test="clockIn != null">
  128. clock_in,
  129. </if>
  130. <if test="clockInTime != null">
  131. clock_in_time,
  132. </if>
  133. <if test="photoUrl != null">
  134. photo_url,
  135. </if>
  136. <if test="pid != null">
  137. pid,
  138. </if>
  139. <if test="pname != null">
  140. pname,
  141. </if>
  142. <if test="ufid != null">
  143. ufid,
  144. </if>
  145. <if test="duration != null">
  146. duration,
  147. </if>
  148. <if test="validDate != null">
  149. valid_date,
  150. </if>
  151. <if test="newUser != null">
  152. new_user,
  153. </if>
  154. <if test="signSum != null">
  155. sign_sum,
  156. </if>
  157. <if test="mainStatus != null">
  158. main_status,
  159. </if>
  160. <if test="supplement != null">
  161. supplement,
  162. </if>
  163. <if test="auditInfo != null">
  164. audit_info,
  165. </if>
  166. <if test="plan != null">
  167. `plan`,
  168. </if>
  169. <if test="expectedEffect != null">
  170. expected_effect,
  171. </if>
  172. <if test="nextPlan != null">
  173. next_plan,
  174. </if>
  175. <if test="type != null">
  176. `type`,
  177. </if>
  178. <if test="orderNo != null">
  179. order_no,
  180. </if>
  181. <if test="updateTime != null">
  182. update_time,
  183. </if>
  184. <if test="updateStatus != null">
  185. update_status,
  186. </if>
  187. <if test="assist != null">
  188. assist,
  189. </if>
  190. <if test="assistAid != null">
  191. assist_aid,
  192. </if>
  193. <if test="assistAidName != null">
  194. assist_aid_name,
  195. </if>
  196. <if test="mainId != null">
  197. main_id,
  198. </if>
  199. <if test="mainName != null">
  200. main_name,
  201. </if>
  202. </trim>
  203. <trim prefix="values (" suffix=")" suffixOverrides=",">
  204. <if test="id != null">
  205. #{id,jdbcType=INTEGER},
  206. </if>
  207. <if test="uid != null">
  208. #{uid,jdbcType=VARCHAR},
  209. </if>
  210. <if test="aid != null">
  211. #{aid,jdbcType=VARCHAR},
  212. </if>
  213. <if test="releaseStart != null">
  214. #{releaseStart,jdbcType=TIMESTAMP},
  215. </if>
  216. <if test="releaseEnd != null">
  217. #{releaseEnd,jdbcType=TIMESTAMP},
  218. </if>
  219. <if test="remarks != null">
  220. #{remarks,jdbcType=VARCHAR},
  221. </if>
  222. <if test="annexUrl != null">
  223. #{annexUrl,jdbcType=VARCHAR},
  224. </if>
  225. <if test="userName != null">
  226. #{userName,jdbcType=VARCHAR},
  227. </if>
  228. <if test="longitude != null">
  229. #{longitude,jdbcType=VARCHAR},
  230. </if>
  231. <if test="latitude != null">
  232. #{latitude,jdbcType=VARCHAR},
  233. </if>
  234. <if test="status != null">
  235. #{status,jdbcType=INTEGER},
  236. </if>
  237. <if test="createTime != null">
  238. #{createTime,jdbcType=TIMESTAMP},
  239. </if>
  240. <if test="clockIn != null">
  241. #{clockIn,jdbcType=INTEGER},
  242. </if>
  243. <if test="clockInTime != null">
  244. #{clockInTime,jdbcType=TIMESTAMP},
  245. </if>
  246. <if test="photoUrl != null">
  247. #{photoUrl,jdbcType=VARCHAR},
  248. </if>
  249. <if test="pid != null">
  250. #{pid,jdbcType=VARCHAR},
  251. </if>
  252. <if test="pname != null">
  253. #{pname,jdbcType=VARCHAR},
  254. </if>
  255. <if test="ufid != null">
  256. #{ufid,jdbcType=VARCHAR},
  257. </if>
  258. <if test="duration != null">
  259. #{duration,jdbcType=DOUBLE},
  260. </if>
  261. <if test="validDate != null">
  262. #{validDate,jdbcType=VARCHAR},
  263. </if>
  264. <if test="newUser != null">
  265. #{newUser,jdbcType=INTEGER},
  266. </if>
  267. <if test="signSum != null">
  268. #{signSum,jdbcType=INTEGER},
  269. </if>
  270. <if test="mainStatus != null">
  271. #{mainStatus,jdbcType=INTEGER},
  272. </if>
  273. <if test="supplement != null">
  274. #{supplement,jdbcType=VARCHAR},
  275. </if>
  276. <if test="auditInfo != null">
  277. #{auditInfo,jdbcType=VARCHAR},
  278. </if>
  279. <if test="plan != null">
  280. #{plan,jdbcType=VARCHAR},
  281. </if>
  282. <if test="expectedEffect != null">
  283. #{expectedEffect,jdbcType=VARCHAR},
  284. </if>
  285. <if test="nextPlan != null">
  286. #{nextPlan,jdbcType=VARCHAR},
  287. </if>
  288. <if test="type != null">
  289. #{type,jdbcType=INTEGER},
  290. </if>
  291. <if test="orderNo != null">
  292. #{orderNo,jdbcType=VARCHAR},
  293. </if>
  294. <if test="updateTime != null">
  295. #{updateTime,jdbcType=TIMESTAMP},
  296. </if>
  297. <if test="updateStatus != null">
  298. #{updateStatus,jdbcType=INTEGER},
  299. </if>
  300. <if test="assist != null">
  301. #{assist,jdbcType=INTEGER},
  302. </if>
  303. <if test="assistAid != null">
  304. #{assistAid,jdbcType=VARCHAR},
  305. </if>
  306. <if test="assistAidName != null">
  307. #{assistAidName,jdbcType=VARCHAR},
  308. </if>
  309. <if test="mainId != null">
  310. #{mainId,jdbcType=INTEGER},
  311. </if>
  312. <if test="mainName != null">
  313. #{mainName,jdbcType=VARCHAR},
  314. </if>
  315. </trim>
  316. </insert>
  317. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PublicRelease">
  318. update public_release
  319. <set>
  320. <if test="uid != null">
  321. `uid` = #{uid,jdbcType=VARCHAR},
  322. </if>
  323. <if test="aid != null">
  324. aid = #{aid,jdbcType=VARCHAR},
  325. </if>
  326. <if test="releaseStart != null">
  327. release_start = #{releaseStart,jdbcType=TIMESTAMP},
  328. </if>
  329. <if test="releaseEnd != null">
  330. release_end = #{releaseEnd,jdbcType=TIMESTAMP},
  331. </if>
  332. <if test="remarks != null">
  333. remarks = #{remarks,jdbcType=VARCHAR},
  334. </if>
  335. <if test="annexUrl != null">
  336. annex_url = #{annexUrl,jdbcType=VARCHAR},
  337. </if>
  338. <if test="userName != null">
  339. user_name = #{userName,jdbcType=VARCHAR},
  340. </if>
  341. <if test="longitude != null">
  342. longitude = #{longitude,jdbcType=VARCHAR},
  343. </if>
  344. <if test="latitude != null">
  345. latitude = #{latitude,jdbcType=VARCHAR},
  346. </if>
  347. <if test="status != null">
  348. `status` = #{status,jdbcType=INTEGER},
  349. </if>
  350. <if test="createTime != null">
  351. create_time = #{createTime,jdbcType=TIMESTAMP},
  352. </if>
  353. <if test="clockIn != null">
  354. clock_in = #{clockIn,jdbcType=INTEGER},
  355. </if>
  356. <if test="clockInTime != null">
  357. clock_in_time = #{clockInTime,jdbcType=TIMESTAMP},
  358. </if>
  359. <if test="photoUrl != null">
  360. photo_url = #{photoUrl,jdbcType=VARCHAR},
  361. </if>
  362. <if test="pid != null">
  363. pid = #{pid,jdbcType=VARCHAR},
  364. </if>
  365. <if test="pname != null">
  366. pname = #{pname,jdbcType=VARCHAR},
  367. </if>
  368. <if test="ufid != null">
  369. ufid = #{ufid,jdbcType=VARCHAR},
  370. </if>
  371. <if test="duration != null">
  372. duration = #{duration,jdbcType=DOUBLE},
  373. </if>
  374. <if test="validDate != null">
  375. valid_date = #{validDate,jdbcType=VARCHAR},
  376. </if>
  377. <if test="newUser != null">
  378. new_user = #{newUser,jdbcType=INTEGER},
  379. </if>
  380. <if test="signSum != null">
  381. sign_sum = #{signSum,jdbcType=INTEGER},
  382. </if>
  383. <if test="mainStatus != null">
  384. main_status = #{mainStatus,jdbcType=INTEGER},
  385. </if>
  386. <if test="supplement != null">
  387. supplement = #{supplement,jdbcType=VARCHAR},
  388. </if>
  389. <if test="auditInfo != null">
  390. audit_info = #{auditInfo,jdbcType=VARCHAR},
  391. </if>
  392. <if test="plan != null">
  393. `plan` = #{plan,jdbcType=VARCHAR},
  394. </if>
  395. <if test="expectedEffect != null">
  396. expected_effect = #{expectedEffect,jdbcType=VARCHAR},
  397. </if>
  398. <if test="nextPlan != null">
  399. next_plan = #{nextPlan,jdbcType=VARCHAR},
  400. </if>
  401. <if test="type != null">
  402. `type` = #{type,jdbcType=INTEGER},
  403. </if>
  404. <if test="orderNo != null">
  405. order_no = #{orderNo,jdbcType=VARCHAR},
  406. </if>
  407. <if test="updateTime != null">
  408. update_time = #{updateTime,jdbcType=TIMESTAMP},
  409. </if>
  410. <if test="updateStatus != null">
  411. update_status = #{updateStatus,jdbcType=INTEGER},
  412. </if>
  413. <if test="assist != null">
  414. assist = #{assist,jdbcType=INTEGER},
  415. </if>
  416. <if test="assistAid != null">
  417. assist_aid = #{assistAid,jdbcType=VARCHAR},
  418. </if>
  419. <if test="assistAidName != null">
  420. assist_aid_name = #{assistAidName,jdbcType=VARCHAR},
  421. </if>
  422. <if test="mainId != null">
  423. main_id = #{mainId,jdbcType=INTEGER},
  424. </if>
  425. <if test="mainName != null">
  426. main_name = #{mainName,jdbcType=VARCHAR},
  427. </if>
  428. </set>
  429. where id = #{id,jdbcType=INTEGER}
  430. </update>
  431. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.PublicRelease">
  432. update public_release
  433. set `uid` = #{uid,jdbcType=VARCHAR},
  434. aid = #{aid,jdbcType=VARCHAR},
  435. release_start = #{releaseStart,jdbcType=TIMESTAMP},
  436. release_end = #{releaseEnd,jdbcType=TIMESTAMP},
  437. remarks = #{remarks,jdbcType=VARCHAR},
  438. annex_url = #{annexUrl,jdbcType=VARCHAR},
  439. user_name = #{userName,jdbcType=VARCHAR},
  440. longitude = #{longitude,jdbcType=VARCHAR},
  441. latitude = #{latitude,jdbcType=VARCHAR},
  442. `status` = #{status,jdbcType=INTEGER},
  443. create_time = #{createTime,jdbcType=TIMESTAMP},
  444. clock_in = #{clockIn,jdbcType=INTEGER},
  445. clock_in_time = #{clockInTime,jdbcType=TIMESTAMP},
  446. photo_url = #{photoUrl,jdbcType=VARCHAR},
  447. pid = #{pid,jdbcType=VARCHAR},
  448. pname = #{pname,jdbcType=VARCHAR},
  449. ufid = #{ufid,jdbcType=VARCHAR},
  450. duration = #{duration,jdbcType=DOUBLE},
  451. valid_date = #{validDate,jdbcType=VARCHAR},
  452. new_user = #{newUser,jdbcType=INTEGER},
  453. sign_sum = #{signSum,jdbcType=INTEGER},
  454. main_status = #{mainStatus,jdbcType=INTEGER},
  455. supplement = #{supplement,jdbcType=VARCHAR},
  456. audit_info = #{auditInfo,jdbcType=VARCHAR},
  457. `plan` = #{plan,jdbcType=VARCHAR},
  458. expected_effect = #{expectedEffect,jdbcType=VARCHAR},
  459. next_plan = #{nextPlan,jdbcType=VARCHAR},
  460. `type` = #{type,jdbcType=INTEGER},
  461. order_no = #{orderNo,jdbcType=VARCHAR},
  462. update_time = #{updateTime,jdbcType=TIMESTAMP},
  463. update_status = #{updateStatus,jdbcType=INTEGER},
  464. assist = #{assist,jdbcType=INTEGER},
  465. assist_aid = #{assistAid,jdbcType=VARCHAR},
  466. assist_aid_name = #{assistAidName,jdbcType=VARCHAR},
  467. main_id = #{mainId,jdbcType=INTEGER},
  468. main_name = #{mainName,jdbcType=VARCHAR}
  469. where id = #{id,jdbcType=INTEGER}
  470. </update>
  471. <update id="updateSignByAidAndUid">
  472. update public_release a ,(select max(create_time)create_time from public_release
  473. where aid= #{aid} and uid=#{uid} and main_status =1 group by aid,uid)b
  474. set a.sign_sum =a.sign_sum +1
  475. where a.aid =#{aid} and a.uid =#{uid} and a.main_status =1 and a.create_time =b.create_time
  476. </update>
  477. <select id="listPublicRelease" resultType="com.goafanti.weChat.bo.OutPublicReleaseList">
  478. select a.id,b.nickname ,c.name aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.user_name userName,a.aid,
  479. 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,
  480. a.latitude ,a.longitude ,a.clock_in clockIn,date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_status updateStatus,
  481. a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,a.type,a.main_name mainName
  482. from public_release a left join `user` b on a.uid =b.id left join admin c on a.aid =c.id
  483. <if test="type==2">
  484. left join department d on c.department_id =d.id
  485. </if>
  486. where 1=1
  487. <if test="assist !=null">
  488. and a.assist = #{assist}
  489. </if>
  490. <if test="type==0">
  491. <if test="assist == 2">
  492. and a.assist =2
  493. </if>
  494. <if test="assist ==0">
  495. and a.assist in(0,1)
  496. </if>
  497. <if test="assist ==1">
  498. and a.assist in(0,1,2)
  499. </if>
  500. <if test="aid !=null">
  501. and a.aid= #{aid}
  502. </if>
  503. </if>
  504. <if test="type==1">
  505. and a.assist in(0,1)
  506. and c.reviewer = #{aid}
  507. </if>
  508. <if test="type==2">
  509. and a.assist in(0,1)
  510. and d.manager_id = #{aid}
  511. </if>
  512. <if test="type==3">
  513. and a.assist=2
  514. <if test="aid !=null">
  515. and a.aid= #{aid}
  516. </if>
  517. and a.type = #{type}
  518. </if>
  519. <if test="clockTime !=null">
  520. and a.release_start &lt; #{clockTime} and a.release_end &gt; #{clockTime}
  521. </if>
  522. <if test="releaseStarts != null and publicEnd != null">
  523. and a.release_start BETWEEN #{releaseStarts} and #{publicEnd}
  524. </if>
  525. <if test="userName !=null">
  526. and b.nickname like CONCAT('%',#{userName},'%')
  527. </if>
  528. <if test="status !=null">
  529. and a.status = #{status}
  530. </if>
  531. <if test="clockIn !=null">
  532. and a.clock_in = #{clockIn}
  533. </if>
  534. ORDER BY (case when a.status=1 then 1 else 2 end),a.status ,a.create_time desc
  535. <if test="page_sql!=null">
  536. ${page_sql}
  537. </if>
  538. </select>
  539. <select id="countPublicRelease" resultType="java.lang.Integer">
  540. select count(*)
  541. from public_release a left join `user` b on a.uid =b.id left join admin c on a.aid =c.id
  542. <if test="type==2">
  543. left join department d on c.department_id =d.id
  544. </if>
  545. where 1=1
  546. <if test="assist !=null">
  547. and a.assist = #{assist}
  548. </if>
  549. <if test="type==0">
  550. <if test="assist == 2">
  551. and a.assist =2
  552. </if>
  553. <if test="assist ==0">
  554. and a.assist in(0,1)
  555. </if>
  556. <if test="assist ==1">
  557. and a.assist in(0,1,2)
  558. </if>
  559. <if test="aid !=null">
  560. and a.aid= #{aid}
  561. </if>
  562. </if>
  563. <if test="type==1">
  564. and a.assist in(0,1)
  565. and c.reviewer = #{aid}
  566. </if>
  567. <if test="type==2">
  568. and a.assist in(0,1)
  569. and d.manager_id = #{aid}
  570. </if>
  571. <if test="type==3">
  572. and a.assist=2
  573. <if test="aid !=null">
  574. and a.aid= #{aid}
  575. </if>
  576. and a.type = #{type}
  577. </if>
  578. <if test="clockTime !=null">
  579. and a.release_start &lt; #{clockTime} and a.release_end &gt; #{clockTime}
  580. </if>
  581. <if test="releaseStarts != null and publicEnd != null">
  582. and a.release_start BETWEEN #{releaseStarts} and #{publicEnd}
  583. </if>
  584. <if test="userName !=null">
  585. and b.nickname like CONCAT('%',#{userName},'%')
  586. </if>
  587. <if test="status !=null">
  588. and a.status = #{status}
  589. </if>
  590. <if test="clockIn !=null">
  591. and a.clock_in = #{clockIn}
  592. </if>
  593. </select>
  594. <select id="selectDtails" resultType="com.goafanti.weChat.bo.OutPublicRelease">
  595. select a.id,b.nickname ,c.name aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.user_name userName,a.update_time updateTime,
  596. 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,
  597. a.annex_url annexUrl ,a.remarks,a.duration ,a.valid_date validDate ,a.latitude ,a.longitude ,a.aid ,c.superior_id suprId,a.uid,
  598. a.clock_in clockIn ,a.plan ,a.expected_effect expectedEffect,a.next_plan nextPlan,c.reviewer,a.type,a.order_no orderNo,d.contract_no contractNo,
  599. 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,
  600. a.main_name mainName
  601. from public_release a left join `user` b on a.uid =b.id left join admin c on a.aid =c.id
  602. left join t_order_new d on a.order_no=d.order_no
  603. where 1=1
  604. <if test="id !=null">
  605. and a.id= #{id}
  606. </if>
  607. <if test="ufid !=null">
  608. and a.ufid= #{ufid}
  609. </if>
  610. </select>
  611. <select id="listPublicStatistics" resultType="com.goafanti.weChat.bo.OutPublicStatistics">
  612. 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
  613. from (select if(a.status=0,1,0)bh ,if(a.status=1,1,0)wsh,if(a.status=2,1,0)tg,if(a.clock_in=1,1,0) dk,a.aid
  614. ,if(a.status=2,a.duration,0)duration from public_release a left join admin b on a.aid=b.id
  615. where 1=1
  616. <if test="aid != null">
  617. and a.aid= #{aid}
  618. </if>
  619. <if test="clockStart != null and clockEnd != null">
  620. and a.clock_in_time between #{clockStart} and #{clockEnd}
  621. </if>
  622. <if test="createStart != null and createEnd !=null">
  623. and a.create_time between #{createStart} and #{createEnd}
  624. </if>
  625. <if test="depId != null">
  626. and b.department_id = #{depId}
  627. </if>
  628. )x group by x.aid)y left join admin c on c.id=y.aid
  629. <if test="page_sql!=null">
  630. ${page_sql}
  631. </if>
  632. </select>
  633. <select id="countPublicStatistics" resultType="java.lang.Integer">
  634. select count(*) from (select aid from public_release a left join admin b on a.aid=b.id
  635. where 1=1
  636. <if test="aid != null">
  637. and a.aid= #{aid}
  638. </if>
  639. <if test="clockStart != null and clockEnd != null">
  640. and a.clock_in_time between #{clockStart} and #{clockEnd}
  641. </if>
  642. <if test="createStart != null and createEnd !=null">
  643. and a.create_time between #{createStart} and #{createEnd}
  644. </if>
  645. <if test="depId != null">
  646. and b.department_id = #{depId}
  647. </if>
  648. group by aid)x
  649. </select>
  650. <select id="listPublicDtails" resultType="com.goafanti.weChat.bo.OutPublicDtails">
  651. select a.id,b.nickname ,a.user_name userName,c.name aname,a.duration ,a.status,a.annex_url annexUrl,a.photo_url photoUrl,
  652. date_format(a.clock_in_time ,'%Y-%m-%d %H:%i:%S') clockInTimes,a.clock_in clockIn,a.remarks,a.supplement,a.type,
  653. date_format(a.create_time ,'%Y-%m-%d %H:%i:%S') createTimes,a.audit_info auditInfo,d.name sname,
  654. date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,date_format(a.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,
  655. a.plan ,a.next_plan nextPlan ,a.expected_effect expectedEffect,a.update_status updateStatus,a.assist_aid_name assistAidName,
  656. a.main_name mainName,a.assist
  657. from public_release a left join `user` b on a.uid=b.id left join admin c on a.aid =c.id
  658. left join admin d on b.aid=d.id where 1=1
  659. <if test="publicType != null">
  660. and a.type= #{publicType}
  661. </if>
  662. <if test="aid != null">
  663. and a.aid= #{aid}
  664. </if>
  665. <if test="sid != null">
  666. and d.id= #{sid}
  667. </if>
  668. <if test="depId != null">
  669. and c.department_id = #{depId}
  670. </if>
  671. <if test="type==1 and deps !=null">
  672. and c.department_id in
  673. <foreach close=")" collection="deps" item="deps" open="(" separator=",">
  674. #{deps.id}
  675. </foreach>
  676. </if>
  677. <if test="uid != null">
  678. and a.uid = #{uid}
  679. </if>
  680. <if test="releaseStart != null and releaseEnd != null">
  681. and (a.release_start between #{releaseStart} and #{releaseEnd} or a.release_end between #{releaseStart} and #{releaseEnd})
  682. </if>
  683. <if test="createStart != null and createEnd != null">
  684. and a.create_time between #{createStart} and #{createEnd}
  685. </if>
  686. <if test="status != null">
  687. and a.status = #{status}
  688. </if>
  689. <if test="clockIn !=null">
  690. and a.clock_in= #{clockIn}
  691. </if>
  692. order by a.status,a.create_time desc
  693. <if test="page_sql!=null">
  694. ${page_sql}
  695. </if>
  696. </select>
  697. <select id="countPublicDtails" resultType="java.lang.Integer">
  698. select count(*)
  699. from public_release a left join `user` b on a.uid=b.id left join admin c on a.aid =c.id
  700. left join admin d on b.aid=d.id
  701. where 1=1
  702. <if test="publicType != null">
  703. and a.type= #{publicType}
  704. </if>
  705. <if test="aid != null">
  706. and a.aid= #{aid}
  707. </if>
  708. <if test="sid != null">
  709. and d.id= #{sid}
  710. </if>
  711. <if test="depId != null">
  712. and c.department_id = #{depId}
  713. </if>
  714. <if test="type==1 and deps !=null">
  715. and c.department_id in
  716. <foreach close=")" collection="deps" item="deps" open="(" separator=",">
  717. #{deps.id}
  718. </foreach>
  719. </if>
  720. <if test="uid != null">
  721. and a.uid = #{uid}
  722. </if>
  723. <if test="releaseStart != null and releaseEnd != null">
  724. and (a.release_start between #{releaseStart} and #{releaseEnd} or a.release_end between #{releaseStart} and #{releaseEnd})
  725. </if>
  726. <if test="createStart != null and createEnd != null">
  727. and a.create_time between #{createStart} and #{createEnd}
  728. </if>
  729. <if test="status != null">
  730. and a.status = #{status}
  731. </if>
  732. <if test="clockIn !=null">
  733. and a.clock_in= #{clockIn}
  734. </if>
  735. </select>
  736. <select id="checkTime" resultType="java.lang.Integer">
  737. select id from public_release where aid=#{aid} and status in (0,1,2)
  738. and ( (release_start &gt;= #{start} and release_start &lt; #{end})
  739. or (release_start &lt; #{start} and release_end &gt; #{start})
  740. or (release_start &lt; #{end} and release_end &gt; #{end}))
  741. </select>
  742. <select id="getTimeUserFollow" resultType="com.goafanti.common.model.OutPublicReleaseCount">
  743. select e.id province,d.id depId,a.aid,a.uid,a.new_user newUser ,1 quantity from (select aid,uid,new_user from public_release
  744. where main_status =1 and create_time between #{date} and #{now}
  745. group by aid,uid,new_user)a left join admin c on a.aid=c.id
  746. left join department d on c.department_id =d.id left join district_glossory e on d.province =e.id
  747. </select>
  748. <select id="publicByOrder" resultType="com.goafanti.weChat.bo.OutPublicRelease">
  749. select a.id,a.uid,a.aid,b.nickname ,c.name aname,a.duration ,a.user_name userName,
  750. date_format(a.release_start,'%Y-%m-%d %H:%i:%S')releaseStarts,
  751. date_format(a.release_end ,'%Y-%m-%d %H:%i:%S')releaseEnds,
  752. date_format(a.clock_in_time ,'%Y-%m-%d %H:%i:%S')clockInTimes,
  753. a.remarks
  754. from public_release a left join user b on a.uid=b.id
  755. left join admin c on a.aid =c.id
  756. where a.order_no = #{orderNo}
  757. </select>
  758. <select id="selectByMainId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  759. select
  760. <include refid="Base_Column_List" />
  761. from public_release
  762. where main_id = #{mainId}
  763. </select>
  764. <update id="updateStatusByMainId">
  765. update public_release set status= #{status}
  766. where main_id= #{mainId}
  767. </update>
  768. </mapper>