PublicReleaseMapper.xml 25 KB

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