PublicReleaseMapper.xml 37 KB

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