PublicReleaseMapper.xml 22 KB

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