PublicReleaseMapper.xml 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  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.Integer" 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.Integer">
  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,a.public_type publicType,
  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,c2.name reviewerName,a.tech_start_process techStartProcess
  364. from public_release a left join admin c on a.aid =c.id
  365. left join admin c2 on c.reviewer=c2.id
  366. left join expense_account ea ON a.id = ea.prid AND ea.status IN (0, 1, 2, 3)
  367. <if test="type==2">
  368. left join department d on c.department_id =d.id
  369. </if>
  370. <if test="type==4 or userName !=null">
  371. left join public_release_details b on a.id=b.prid
  372. left join user e on b.uid=e.id
  373. </if>
  374. <if test="type==5">
  375. left join t_order_new ton on a.order_no =ton.order_no
  376. left join t_order_mid tom on a.order_no=tom.order_no
  377. </if>
  378. where 1=1
  379. <include refid="listPublicReleaseSql"/>
  380. ORDER BY (case when a.status=1 then 1 when a.status=2 then 2 when a.status=3 then 5
  381. when a.status=0 then 3 when a.status=4 then 4 else 0 end),a.create_time desc
  382. <if test="page_sql!=null">
  383. ${page_sql}
  384. </if>
  385. </select>
  386. <sql id="listPublicReleaseSql">
  387. <if test="type==0">
  388. and a.public_type in (0,1,2,3)
  389. <if test="assist ==0">
  390. and a.assist in(0,1)
  391. </if>
  392. <if test="assist == 2">
  393. and a.assist =2
  394. </if>
  395. <if test="assist == 3">
  396. and a.assist =3
  397. </if>
  398. <if test="assist ==4">
  399. and a.assist in (2,3)
  400. </if>
  401. <if test="assistType ==1">
  402. and a.assist in(0,1,2)
  403. </if>
  404. <if test="aid !=null">
  405. and a.aid= #{aid}
  406. </if>
  407. <if test="statusType ==1">
  408. and a.status in (0,1,2,4)
  409. </if>
  410. </if>
  411. <if test="type==1">
  412. and a.public_type in (0,2)
  413. and a.assist in(0,1)
  414. and a.tech_start_process in (0,2)
  415. and c.reviewer = #{aid}
  416. </if>
  417. <if test="type==2">
  418. and a.public_type in (0,2)
  419. and a.assist in(0,1)
  420. and d.manager_id = #{aid}
  421. </if>
  422. <if test="type==3">
  423. and a.public_type in (0,2)
  424. and a.assist=2
  425. <if test="aid !=null">
  426. and a.aid= #{aid}
  427. </if>
  428. and a.type = #{type}
  429. </if>
  430. <if test="type==4">
  431. and a.assist in(0,1)
  432. and e.aid = #{aid}
  433. and a.public_type in (1,2)
  434. </if>
  435. <if test="type==5">
  436. and a.tech_start_process=1
  437. and ton.salesman_id =#{aid}
  438. </if>
  439. <if test="clockIn !=null">
  440. and a.clock_in =#{clockIn}
  441. </if>
  442. <if test="clockTime !=null">
  443. and a.release_start &lt; #{clockTime} and a.release_end &gt; #{clockTime}
  444. </if>
  445. <if test="releaseStarts != null and publicEnd != null">
  446. and a.release_start BETWEEN #{releaseStarts} and #{publicEnd}
  447. </if>
  448. <if test="userName !=null">
  449. and e.nickname like concat('%',#{userName},'%')
  450. </if>
  451. <if test="status !=null">
  452. and a.status = #{status}
  453. </if>
  454. </sql>
  455. <select id="countPublicRelease" resultType="java.lang.Integer">
  456. select count(*)
  457. from public_release a left join admin c on a.aid =c.id
  458. <if test="type==2">
  459. left join department d on c.department_id =d.id
  460. </if>
  461. <if test="type==4 or userName !=null">
  462. left join public_release_details b on a.id=b.prid
  463. left join user e on b.uid=e.id
  464. </if>
  465. <if test="type==5">
  466. left join t_order_new ton on a.order_no =ton.order_no
  467. </if>
  468. where 1=1
  469. <include refid="listPublicReleaseSql"/>
  470. </select>
  471. <select id="selectDtails" resultType="com.goafanti.weChat.bo.OutPublicRelease">
  472. 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,
  473. 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,
  474. a.annex_url annexUrl ,a.remarks,a.duration ,a.valid_date validDate ,a.aid ,c.superior_id suprId,a.tech_start_process techStartProcess,
  475. a.plan ,a.expected_effect expectedEffect,a.next_plan nextPlan,c.reviewer,a.type,a.order_no orderNo,d.contract_no contractNo,
  476. 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,
  477. a.main_name mainName,a.assistant_aid assistantAid,a.assistant_name assistantName,a.public_again publicAhain,x.uids,a.public_type publicType,c2.name reviewerName
  478. from public_release a left join admin c on a.aid =c.id left join admin c2 on c.reviewer =c2.id
  479. left join (select prid ,GROUP_CONCAT(uid)uids from public_release_details where prid= #{id} group by prid)x on a.id=x.prid
  480. left join t_order_new d on a.order_no=d.order_no
  481. where 1=1
  482. <if test="id !=null">
  483. and a.id= #{id}
  484. </if>
  485. </select>
  486. <select id="selectDtailsByFid" resultType="com.goafanti.weChat.bo.OutPublicReleaseAndDetails">
  487. 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,
  488. 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,
  489. 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,
  490. a.plan ,a.expected_effect expectedEffect,a.next_plan nextPlan,c.reviewer,a.type,a.order_no orderNo,d.contract_no contractNo,
  491. 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,
  492. a.main_name mainName,a.assistant_aid assistantAid,a.assistant_name assistantName,a.public_again publicAhain
  493. from public_release a left join admin c on a.aid =c.id
  494. left join public_release_details x on a.id=x.prid
  495. left join user u on x.uid=u.id
  496. left join t_order_new d on a.order_no=d.order_no
  497. where 1=1
  498. <if test="ufid !=null">
  499. and x.ufid= #{ufid}
  500. </if>
  501. </select>
  502. <select id="listPublicStatistics" resultType="com.goafanti.weChat.bo.OutPublicStatistics">
  503. 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
  504. 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
  505. from public_release a inner join (select prid ,sum(if(clock_in=1,1,0))dk from public_release_details where 1=1
  506. <if test="clockStart != null and clockEnd != null">
  507. and clock_in_time between #{clockStart} and #{clockEnd}
  508. </if>
  509. group by prid ) b on a.id =b.prid
  510. left join admin c on a.aid=c.id where 1=1
  511. <if test="aid != null">
  512. and a.aid= #{aid}
  513. </if>
  514. <if test="createStart != null and createEnd !=null">
  515. and a.create_time between #{createStart} and #{createEnd}
  516. </if>
  517. <if test="depId != null">
  518. and c.department_id = #{depId}
  519. </if>
  520. )x group by x.aid)y left join admin c on c.id=y.aid
  521. <if test="page_sql!=null">
  522. ${page_sql}
  523. </if>
  524. </select>
  525. <select id="countPublicStatistics" resultType="java.lang.Integer">
  526. select count(*) from (select aid from public_release a
  527. inner join (select prid ,sum(if(clock_in=1,1,0))dk from public_release_details where 1=1
  528. <if test="clockStart != null and clockEnd != null">
  529. and clock_in_time between #{clockStart} and #{clockEnd}
  530. </if>
  531. group by prid ) b on a.id =b.prid
  532. left join admin c on a.aid=c.id
  533. where 1=1
  534. <if test="aid != null">
  535. and a.aid= #{aid}
  536. </if>
  537. <if test="createStart != null and createEnd !=null">
  538. and a.create_time between #{createStart} and #{createEnd}
  539. </if>
  540. <if test="depId != null">
  541. and c.department_id = #{depId}
  542. </if>
  543. group by aid)x
  544. </select>
  545. <select id="listPublicDtails" resultType="com.goafanti.weChat.bo.OutPublicDtails">
  546. select a.id prdId,b.id,a.district_name districtName ,c.name aname,a.duration ,b.status ,b.annex_url annexUrl,a.photo_url photoUrl,d.nickname userName,
  547. 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 ,
  548. 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,
  549. date_format(b.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,date_format(b.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,
  550. b.plan ,b.next_plan nextPlan ,b.expected_effect expectedEffect,b.update_status updateStatus,b.assist_aid_name assistAidName,
  551. b.main_name mainName,b.assist,b.assistant_aid assistantAid, b.assistant_name assistantName,f.contract_no contractNo,
  552. e.name sname,f.total_amount totalAmout,d.sign_bills signBills,date_format(d.sign_time,'%Y-%m-%d')signTime
  553. from public_release_details a left join public_release b on a.prid =b.id
  554. left join admin c on b.aid =c.id left join t_order_new f on b.order_no =f.order_no
  555. left join `user` d on a.uid =d.id left join admin e on d.aid=e.id
  556. where 1=1
  557. <if test="publicType != null">
  558. and b.type= #{publicType}
  559. </if>
  560. <if test="aid != null">
  561. and b.aid= #{aid}
  562. </if>
  563. <if test="sid != null">
  564. and d.aid= #{sid}
  565. </if>
  566. <if test="deps !=null">
  567. and c.department_id in
  568. <foreach close=")" collection="deps" item="dep" open="(" separator=",">
  569. #{dep}
  570. </foreach>
  571. </if>
  572. <if test="uid != null">
  573. and a.uid = #{uid}
  574. </if>
  575. <if test="releaseStart != null and releaseEnd != null">
  576. and (b.release_start between #{releaseStart} and #{releaseEnd} or b.release_end between #{releaseStart} and #{releaseEnd})
  577. </if>
  578. <if test="createStart != null and createEnd != null">
  579. and b.create_time between #{createStart} and #{createEnd}
  580. </if>
  581. <if test="status != null">
  582. and b.status = #{status}
  583. </if>
  584. <if test="statusType == 1">
  585. and b.status in (1,2)
  586. </if>
  587. <if test="clockIn !=null">
  588. and a.clock_in= #{clockIn}
  589. </if>
  590. <if test="contractNo !=null">
  591. and f.contract_no like CONCAT('%',#{contractNo},'%')
  592. </if>
  593. order by b.status,b.create_time desc
  594. <if test="page_sql!=null">
  595. ${page_sql}
  596. </if>
  597. </select>
  598. <select id="countPublicDtails" resultType="java.lang.Integer">
  599. select count(*)
  600. from public_release_details a left join public_release b on a.prid =b.id
  601. left join admin c on b.aid =c.id left join `user` d on a.uid =d.id
  602. <if test="contractNo !=null">
  603. left join t_order_new f on b.order_no =f.order_no
  604. </if>
  605. where 1=1
  606. <if test="publicType != null">
  607. and b.type= #{publicType}
  608. </if>
  609. <if test="aid != null">
  610. and b.aid= #{aid}
  611. </if>
  612. <if test="sid != null">
  613. and d.aid= #{sid}
  614. </if>
  615. <if test="deps !=null">
  616. and c.department_id in
  617. <foreach close=")" collection="deps" item="dep" open="(" separator=",">
  618. #{dep}
  619. </foreach>
  620. </if>
  621. <if test="uid != null">
  622. and a.uid = #{uid}
  623. </if>
  624. <if test="releaseStart != null and releaseEnd != null">
  625. and (b.release_start between #{releaseStart} and #{releaseEnd} or b.release_end between #{releaseStart} and #{releaseEnd})
  626. </if>
  627. <if test="createStart != null and createEnd != null">
  628. and b.create_time between #{createStart} and #{createEnd}
  629. </if>
  630. <if test="status != null">
  631. and b.status = #{status}
  632. </if>
  633. <if test="statusType == 1">
  634. and b.status in (1,2)
  635. </if>
  636. <if test="clockIn !=null">
  637. and a.clock_in= #{clockIn}
  638. </if>
  639. <if test="contractNo !=null">
  640. and f.contract_no like CONCAT('%',#{contractNo},'%')
  641. </if>
  642. </select>
  643. <select id="checkTime" resultType="java.lang.Integer">
  644. select id from public_release where aid=#{aid} and status in (0,1,2)
  645. and ( (release_start &gt;= #{start} and release_start &lt; #{end})
  646. or (release_start &lt; #{start} and release_end &gt; #{start})
  647. or (release_start &lt; #{end} and release_end &gt; #{end}))
  648. </select>
  649. <select id="getTimeUserFollow" resultType="com.goafanti.common.model.OutPublicReleaseCount">
  650. 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
  651. left join public_release_details b on a.id=b.prid
  652. where b.main_status =1 and a.create_time between #{date} and #{now}
  653. group by a.aid,b.uid,b.new_user)a left join admin c on a.aid=c.id
  654. left join department d on c.department_id =d.id left join district_glossory e on d.province =e.id
  655. </select>
  656. <select id="publicByOrder" resultType="com.goafanti.weChat.bo.OutPublicRelease">
  657. select a.id,a.uid,b.aid,b.nickname ,c.name aname,a.duration ,a.district_name districtName,
  658. date_format(pr.release_start,'%Y-%m-%d %H:%i:%S')releaseStarts,
  659. date_format(pr.release_end ,'%Y-%m-%d %H:%i:%S')releaseEnds,
  660. date_format(a.clock_in_time ,'%Y-%m-%d %H:%i:%S')clockInTimes,
  661. pr.remarks
  662. from public_release_details a left join public_release pr on a.prid=pr.id
  663. left join user b on a.uid=b.id left join admin c on pr.aid =c.id
  664. where pr.order_no = #{orderNo}
  665. </select>
  666. <select id="selectByMainId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  667. select
  668. <include refid="Base_Column_List" />
  669. from public_release
  670. where main_id = #{mainId}
  671. <if test="type !=null">
  672. and type= #{type}
  673. </if>
  674. <if test="aid !=null">
  675. and aid= #{aid}
  676. </if>
  677. </select>
  678. <update id="updateStatusByMainId">
  679. update public_release set status= #{status}
  680. where main_id= #{mainId}
  681. <if test="type !=null">
  682. and type= #{type}
  683. </if>
  684. <if test="aid !=null">
  685. and aid= #{aid}
  686. </if>
  687. </update>
  688. <select id="selectCountByaidAndDate" resultType="java.lang.Integer">
  689. select ifnull(count(*),0)publicReleaseCount
  690. from (select aid
  691. from public_release a left join public_release_details b on a.id=b.prid
  692. where status =2 and aid= #{aid}
  693. and a.release_start BETWEEN #{startTime} and #{endTime} )x
  694. group by aid
  695. </select>
  696. <select id="selectByaidAndDate" resultType="com.goafanti.admin.bo.OutFinanceCount">
  697. select aid,dates,sum(publicCount)publicCount
  698. from (select aid,if(a.`type` in (0,1,2),1,0) publicCount,DATE_FORMAT(a.release_start , '%Y-%m-%d') dates
  699. from public_release a left join public_release_details b on a.id=b.prid
  700. where a.status=2 and a.aid= #{aid}
  701. and a.release_start between #{startTime} and #{endTime})x
  702. group by x.aid,x.dates
  703. </select>
  704. <select id="selectByOrderNo" resultMap="BaseResultMap">
  705. select
  706. <include refid="Base_Column_List" />
  707. from public_release
  708. where status in (1,2)
  709. and order_no= #{orderNo}
  710. </select>
  711. <select id="selectMyNewPublic" resultMap="BaseResultMap">
  712. select
  713. <include refid="Base_Column_List" />
  714. from public_release
  715. where status in(1,2) and aid = #{aid}
  716. order by release_start desc limit 10
  717. </select>
  718. <select id="selectOutListBoById" resultType="com.goafanti.weChat.bo.OutPublicReleaseList">
  719. select a.id ,c.name aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.aid,a.public_type publicType,
  720. 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,
  721. date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_status updateStatus,a.district_name districtName,
  722. a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,a.type,a.main_name mainName,a.reject_name rejectName,
  723. a.assistant_aid assistantAid ,a.assistant_name assistantName,a.public_again publicAgain,a.user_names userNames,
  724. ea.total_amount expenseAmount ,a.clock_in clockIn,c2.name reviewerName,a.tech_start_process techStartProcess
  725. from public_release a left join admin c on a.aid =c.id
  726. left join admin c2 on c.reviewer=c2.id
  727. left join (select * from expense_account where status in (0,1,2,3)) ea on a.id =ea.prid
  728. where a.id= #{id}
  729. </select>
  730. <select id="selectAll" resultMap="BaseResultMap">
  731. select
  732. <include refid="Base_Column_List" />
  733. from public_release
  734. where status in (1,2)
  735. </select>
  736. <select id="releaseAndExpenseCount" resultType="com.goafanti.weChat.bo.releaseAndExpenseCountOut">
  737. select
  738. a.order_no orderNo,a.contract_no contractNo,b.buyer_name buyerName,b.salesman_name salesmanName,b.dep_name depName,
  739. toc.max_duration maxDuration ,toc.actual_duration actualDuration ,
  740. toc.exceed_duration exceedDuration, a.total_amount totalAmount,a.settlement_amount settlementAmount,b.bid_type bidType,
  741. c.expenseCount,c.peopleCount,c.notExamine,c.rejectCount,d.paymentAmount,c.days,c.amount expenseAmount
  742. from t_order_new a left join t_order_mid b on a.order_no =b.order_no
  743. left join t_order_public_release_count toc on a.order_no =toc.order_no
  744. left join (select a.order_no,a.expenseCount,b.peopleCount,c.notExamine, c.rejectCount,a.days,a.amount
  745. from (select a.order_no,count(a.id)expenseCount,sum(a.amount) amount,sum(ROUND(a.duration/7.5) )days
  746. from expense_account a where a.target_type = 1 and a.status=2
  747. <if test="startTime !=null and endTime !=null">
  748. and a.create_time BETWEEN #{startTime} and #{endTime}
  749. </if>
  750. group by order_no )a
  751. left join (select order_no,count(aid)peopleCount from (select a.order_no,aid from expense_account a
  752. where a.target_type = 1 and a.status=2 group by order_no,aid )a group by order_no)b on a.order_no=b.order_no
  753. left join (select a.order_no,sum(notExamine)notExamine,sum(rejectCount)rejectCount
  754. from (select a.order_no,status ,IF(status=1,1,0)notExamine,IF(status=3,1,0)rejectCount
  755. from expense_account a where a.target_type=1
  756. )a group by order_no)c on a.order_no=c.order_no )c on a.order_no =c.order_no
  757. left join ( select a.order_no ,sum(c.payment_amount) paymentAmount
  758. from t_order_new a left join t_order_task b on a.order_no =b.order_no left join t_order_payment c on b.id =c.tid
  759. where c.status =3 group by order_no )d on a.order_no=d.order_no
  760. where a.delete_sign in (0,2) and a.process_status >0
  761. <if test="contractNo != null">
  762. and a.contract_no = #{contractNo}
  763. </if>
  764. <if test="buyerName != null">
  765. and b.buyer_name like concat('%',#{buyerName},'%')
  766. </if>
  767. <if test="depId != null">
  768. and a.order_dep = #{depId}
  769. </if>
  770. <if test="aid != null">
  771. and a.salesman_id = #{aid}
  772. </if>
  773. <if test="allStatus == 1">
  774. and toc.exceed_duration =0
  775. </if>
  776. <if test="allStatus == 2">
  777. and toc.exceed_duration >0
  778. </if>
  779. order by contract_no desc
  780. </select>
  781. </mapper>