PublicReleaseMapper.xml 25 KB

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