PublicReleaseMapper.xml 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853
  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. <result property="addressName" column="address_name" jdbcType="VARCHAR"/>
  47. </resultMap>
  48. <sql id="Base_Column_List">
  49. id,aid,release_start,
  50. release_end,remarks,annex_url,
  51. status,create_time,pid,
  52. pname,duration,valid_date,
  53. supplement,audit_info,plan,
  54. expected_effect,next_plan,type,
  55. order_no,update_time,update_status,
  56. assist,assist_aid,assist_aid_name,
  57. main_id,main_name,reject_name,
  58. assistant_aid,assistant_name,public_again,
  59. audit_time,new_user,sign_sum,
  60. user_names,object_type,public_type,
  61. district_name,clock_in,tech_start_process,
  62. address_name
  63. </sql>
  64. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  65. select
  66. <include refid="Base_Column_List" />
  67. from public_release
  68. where id = #{id,jdbcType=INTEGER}
  69. </select>
  70. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  71. delete from public_release
  72. where id = #{id,jdbcType=INTEGER}
  73. </delete>
  74. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicRelease" useGeneratedKeys="true">
  75. insert into public_release
  76. ( id,aid,release_start
  77. ,release_end,remarks,annex_url
  78. ,status,create_time,pid
  79. ,pname,duration,valid_date
  80. ,supplement,audit_info,plan
  81. ,expected_effect,next_plan,type
  82. ,order_no,update_time,update_status
  83. ,assist,assist_aid,assist_aid_name
  84. ,main_id,main_name,reject_name
  85. ,assistant_aid,assistant_name,public_again
  86. ,audit_time,new_user,sign_sum
  87. ,user_names,object_type,public_type
  88. ,district_name,clock_in,tech_start_process
  89. ,address_name)
  90. values (#{id,jdbcType=INTEGER},#{aid,jdbcType=VARCHAR},#{releaseStart,jdbcType=TIMESTAMP}
  91. ,#{releaseEnd,jdbcType=TIMESTAMP},#{remarks,jdbcType=VARCHAR},#{annexUrl,jdbcType=VARCHAR}
  92. ,#{status,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{pid,jdbcType=VARCHAR}
  93. ,#{pname,jdbcType=VARCHAR},#{duration,jdbcType=DOUBLE},#{validDate,jdbcType=VARCHAR}
  94. ,#{supplement,jdbcType=VARCHAR},#{auditInfo,jdbcType=VARCHAR},#{plan,jdbcType=VARCHAR}
  95. ,#{expectedEffect,jdbcType=VARCHAR},#{nextPlan,jdbcType=VARCHAR},#{type,jdbcType=INTEGER}
  96. ,#{orderNo,jdbcType=VARCHAR},#{updateTime,jdbcType=TIMESTAMP},#{updateStatus,jdbcType=INTEGER}
  97. ,#{assist,jdbcType=INTEGER},#{assistAid,jdbcType=VARCHAR},#{assistAidName,jdbcType=VARCHAR}
  98. ,#{mainId,jdbcType=INTEGER},#{mainName,jdbcType=VARCHAR},#{rejectName,jdbcType=VARCHAR}
  99. ,#{assistantAid,jdbcType=VARCHAR},#{assistantName,jdbcType=VARCHAR},#{publicAgain,jdbcType=INTEGER}
  100. ,#{auditTime,jdbcType=TIMESTAMP},#{newUser,jdbcType=VARCHAR},#{signSum,jdbcType=VARCHAR}
  101. ,#{userNames,jdbcType=VARCHAR},#{objectType,jdbcType=INTEGER},#{publicType,jdbcType=INTEGER}
  102. ,#{districtName,jdbcType=VARCHAR},#{clockIn,jdbcType=INTEGER},#{techStartProcess,jdbcType=INTEGER}
  103. ,#{addressName,jdbcType=VARCHAR})
  104. </insert>
  105. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicRelease" useGeneratedKeys="true">
  106. insert into public_release
  107. <trim prefix="(" suffix=")" suffixOverrides=",">
  108. <if test="id != null">id,</if>
  109. <if test="aid != null">aid,</if>
  110. <if test="releaseStart != null">release_start,</if>
  111. <if test="releaseEnd != null">release_end,</if>
  112. <if test="remarks != null">remarks,</if>
  113. <if test="annexUrl != null">annex_url,</if>
  114. <if test="status != null">status,</if>
  115. <if test="createTime != null">create_time,</if>
  116. <if test="pid != null">pid,</if>
  117. <if test="pname != null">pname,</if>
  118. <if test="duration != null">duration,</if>
  119. <if test="validDate != null">valid_date,</if>
  120. <if test="supplement != null">supplement,</if>
  121. <if test="auditInfo != null">audit_info,</if>
  122. <if test="plan != null">plan,</if>
  123. <if test="expectedEffect != null">expected_effect,</if>
  124. <if test="nextPlan != null">next_plan,</if>
  125. <if test="type != null">type,</if>
  126. <if test="orderNo != null">order_no,</if>
  127. <if test="updateTime != null">update_time,</if>
  128. <if test="updateStatus != null">update_status,</if>
  129. <if test="assist != null">assist,</if>
  130. <if test="assistAid != null">assist_aid,</if>
  131. <if test="assistAidName != null">assist_aid_name,</if>
  132. <if test="mainId != null">main_id,</if>
  133. <if test="mainName != null">main_name,</if>
  134. <if test="rejectName != null">reject_name,</if>
  135. <if test="assistantAid != null">assistant_aid,</if>
  136. <if test="assistantName != null">assistant_name,</if>
  137. <if test="publicAgain != null">public_again,</if>
  138. <if test="auditTime != null">audit_time,</if>
  139. <if test="newUser != null">new_user,</if>
  140. <if test="signSum != null">sign_sum,</if>
  141. <if test="userNames != null">user_names,</if>
  142. <if test="objectType != null">object_type,</if>
  143. <if test="publicType != null">public_type,</if>
  144. <if test="districtName != null">district_name,</if>
  145. <if test="clockIn != null">clock_in,</if>
  146. <if test="techStartProcess != null">tech_start_process,</if>
  147. <if test="addressName != null">address_name,</if>
  148. </trim>
  149. <trim prefix="values (" suffix=")" suffixOverrides=",">
  150. <if test="id != null">#{id,jdbcType=INTEGER},</if>
  151. <if test="aid != null">#{aid,jdbcType=VARCHAR},</if>
  152. <if test="releaseStart != null">#{releaseStart,jdbcType=TIMESTAMP},</if>
  153. <if test="releaseEnd != null">#{releaseEnd,jdbcType=TIMESTAMP},</if>
  154. <if test="remarks != null">#{remarks,jdbcType=VARCHAR},</if>
  155. <if test="annexUrl != null">#{annexUrl,jdbcType=VARCHAR},</if>
  156. <if test="status != null">#{status,jdbcType=INTEGER},</if>
  157. <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
  158. <if test="pid != null">#{pid,jdbcType=VARCHAR},</if>
  159. <if test="pname != null">#{pname,jdbcType=VARCHAR},</if>
  160. <if test="duration != null">#{duration,jdbcType=DOUBLE},</if>
  161. <if test="validDate != null">#{validDate,jdbcType=VARCHAR},</if>
  162. <if test="supplement != null">#{supplement,jdbcType=VARCHAR},</if>
  163. <if test="auditInfo != null">#{auditInfo,jdbcType=VARCHAR},</if>
  164. <if test="plan != null">#{plan,jdbcType=VARCHAR},</if>
  165. <if test="expectedEffect != null">#{expectedEffect,jdbcType=VARCHAR},</if>
  166. <if test="nextPlan != null">#{nextPlan,jdbcType=VARCHAR},</if>
  167. <if test="type != null">#{type,jdbcType=INTEGER},</if>
  168. <if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if>
  169. <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
  170. <if test="updateStatus != null">#{updateStatus,jdbcType=INTEGER},</if>
  171. <if test="assist != null">#{assist,jdbcType=INTEGER},</if>
  172. <if test="assistAid != null">#{assistAid,jdbcType=VARCHAR},</if>
  173. <if test="assistAidName != null">#{assistAidName,jdbcType=VARCHAR},</if>
  174. <if test="mainId != null">#{mainId,jdbcType=INTEGER},</if>
  175. <if test="mainName != null">#{mainName,jdbcType=VARCHAR},</if>
  176. <if test="rejectName != null">#{rejectName,jdbcType=VARCHAR},</if>
  177. <if test="assistantAid != null">#{assistantAid,jdbcType=VARCHAR},</if>
  178. <if test="assistantName != null">#{assistantName,jdbcType=VARCHAR},</if>
  179. <if test="publicAgain != null">#{publicAgain,jdbcType=INTEGER},</if>
  180. <if test="auditTime != null">#{auditTime,jdbcType=TIMESTAMP},</if>
  181. <if test="newUser != null">#{newUser,jdbcType=VARCHAR},</if>
  182. <if test="signSum != null">#{signSum,jdbcType=VARCHAR},</if>
  183. <if test="userNames != null">#{userNames,jdbcType=VARCHAR},</if>
  184. <if test="objectType != null">#{objectType,jdbcType=INTEGER},</if>
  185. <if test="publicType != null">#{publicType,jdbcType=INTEGER},</if>
  186. <if test="districtName != null">#{districtName,jdbcType=VARCHAR},</if>
  187. <if test="clockIn != null">#{clockIn,jdbcType=INTEGER},</if>
  188. <if test="techStartProcess != null">#{techStartProcess,jdbcType=INTEGER},</if>
  189. <if test="addressName != null">#{addressName,jdbcType=VARCHAR},</if>
  190. </trim>
  191. </insert>
  192. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PublicRelease">
  193. update public_release
  194. <set>
  195. <if test="aid != null">
  196. aid = #{aid,jdbcType=VARCHAR},
  197. </if>
  198. <if test="releaseStart != null">
  199. release_start = #{releaseStart,jdbcType=TIMESTAMP},
  200. </if>
  201. <if test="releaseEnd != null">
  202. release_end = #{releaseEnd,jdbcType=TIMESTAMP},
  203. </if>
  204. <if test="remarks != null">
  205. remarks = #{remarks,jdbcType=VARCHAR},
  206. </if>
  207. <if test="annexUrl != null">
  208. annex_url = #{annexUrl,jdbcType=VARCHAR},
  209. </if>
  210. <if test="status != null">
  211. status = #{status,jdbcType=INTEGER},
  212. </if>
  213. <if test="createTime != null">
  214. create_time = #{createTime,jdbcType=TIMESTAMP},
  215. </if>
  216. <if test="pid != null">
  217. pid = #{pid,jdbcType=VARCHAR},
  218. </if>
  219. <if test="pname != null">
  220. pname = #{pname,jdbcType=VARCHAR},
  221. </if>
  222. <if test="duration != null">
  223. duration = #{duration,jdbcType=DOUBLE},
  224. </if>
  225. <if test="validDate != null">
  226. valid_date = #{validDate,jdbcType=VARCHAR},
  227. </if>
  228. <if test="supplement != null">
  229. supplement = #{supplement,jdbcType=VARCHAR},
  230. </if>
  231. <if test="auditInfo != null">
  232. audit_info = #{auditInfo,jdbcType=VARCHAR},
  233. </if>
  234. <if test="plan != null">
  235. plan = #{plan,jdbcType=VARCHAR},
  236. </if>
  237. <if test="expectedEffect != null">
  238. expected_effect = #{expectedEffect,jdbcType=VARCHAR},
  239. </if>
  240. <if test="nextPlan != null">
  241. next_plan = #{nextPlan,jdbcType=VARCHAR},
  242. </if>
  243. <if test="type != null">
  244. type = #{type,jdbcType=INTEGER},
  245. </if>
  246. <if test="orderNo != null">
  247. order_no = #{orderNo,jdbcType=VARCHAR},
  248. </if>
  249. <if test="updateTime != null">
  250. update_time = #{updateTime,jdbcType=TIMESTAMP},
  251. </if>
  252. <if test="updateStatus != null">
  253. update_status = #{updateStatus,jdbcType=INTEGER},
  254. </if>
  255. <if test="assist != null">
  256. assist = #{assist,jdbcType=INTEGER},
  257. </if>
  258. <if test="assistAid != null">
  259. assist_aid = #{assistAid,jdbcType=VARCHAR},
  260. </if>
  261. <if test="assistAidName != null">
  262. assist_aid_name = #{assistAidName,jdbcType=VARCHAR},
  263. </if>
  264. <if test="mainId != null">
  265. main_id = #{mainId,jdbcType=INTEGER},
  266. </if>
  267. <if test="mainName != null">
  268. main_name = #{mainName,jdbcType=VARCHAR},
  269. </if>
  270. <if test="rejectName != null">
  271. reject_name = #{rejectName,jdbcType=VARCHAR},
  272. </if>
  273. <if test="assistantAid != null">
  274. assistant_aid = #{assistantAid,jdbcType=VARCHAR},
  275. </if>
  276. <if test="assistantName != null">
  277. assistant_name = #{assistantName,jdbcType=VARCHAR},
  278. </if>
  279. <if test="publicAgain != null">
  280. public_again = #{publicAgain,jdbcType=INTEGER},
  281. </if>
  282. <if test="auditTime != null">
  283. audit_time = #{auditTime,jdbcType=TIMESTAMP},
  284. </if>
  285. <if test="newUser != null">
  286. new_user = #{newUser,jdbcType=VARCHAR},
  287. </if>
  288. <if test="signSum != null">
  289. sign_sum = #{signSum,jdbcType=VARCHAR},
  290. </if>
  291. <if test="userNames != null">
  292. user_names = #{userNames,jdbcType=VARCHAR},
  293. </if>
  294. <if test="objectType != null">
  295. object_type = #{objectType,jdbcType=INTEGER},
  296. </if>
  297. <if test="publicType != null">
  298. public_type = #{publicType,jdbcType=INTEGER},
  299. </if>
  300. <if test="districtName != null">
  301. district_name = #{districtName,jdbcType=VARCHAR},
  302. </if>
  303. <if test="clockIn != null">
  304. clock_in = #{clockIn,jdbcType=INTEGER},
  305. </if>
  306. <if test="techStartProcess != null">
  307. tech_start_process = #{techStartProcess,jdbcType=INTEGER},
  308. </if>
  309. <if test="addressName != null">
  310. address_name = #{addressName,jdbcType=VARCHAR},
  311. </if>
  312. </set>
  313. where id = #{id,jdbcType=INTEGER}
  314. </update>
  315. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.PublicRelease">
  316. update public_release
  317. set
  318. aid = #{aid,jdbcType=VARCHAR},
  319. release_start = #{releaseStart,jdbcType=TIMESTAMP},
  320. release_end = #{releaseEnd,jdbcType=TIMESTAMP},
  321. remarks = #{remarks,jdbcType=VARCHAR},
  322. annex_url = #{annexUrl,jdbcType=VARCHAR},
  323. status = #{status,jdbcType=INTEGER},
  324. create_time = #{createTime,jdbcType=TIMESTAMP},
  325. pid = #{pid,jdbcType=VARCHAR},
  326. pname = #{pname,jdbcType=VARCHAR},
  327. duration = #{duration,jdbcType=DOUBLE},
  328. valid_date = #{validDate,jdbcType=VARCHAR},
  329. supplement = #{supplement,jdbcType=VARCHAR},
  330. audit_info = #{auditInfo,jdbcType=VARCHAR},
  331. plan = #{plan,jdbcType=VARCHAR},
  332. expected_effect = #{expectedEffect,jdbcType=VARCHAR},
  333. next_plan = #{nextPlan,jdbcType=VARCHAR},
  334. type = #{type,jdbcType=INTEGER},
  335. order_no = #{orderNo,jdbcType=VARCHAR},
  336. update_time = #{updateTime,jdbcType=TIMESTAMP},
  337. update_status = #{updateStatus,jdbcType=INTEGER},
  338. assist = #{assist,jdbcType=INTEGER},
  339. assist_aid = #{assistAid,jdbcType=VARCHAR},
  340. assist_aid_name = #{assistAidName,jdbcType=VARCHAR},
  341. main_id = #{mainId,jdbcType=INTEGER},
  342. main_name = #{mainName,jdbcType=VARCHAR},
  343. reject_name = #{rejectName,jdbcType=VARCHAR},
  344. assistant_aid = #{assistantAid,jdbcType=VARCHAR},
  345. assistant_name = #{assistantName,jdbcType=VARCHAR},
  346. public_again = #{publicAgain,jdbcType=INTEGER},
  347. audit_time = #{auditTime,jdbcType=TIMESTAMP},
  348. new_user = #{newUser,jdbcType=VARCHAR},
  349. sign_sum = #{signSum,jdbcType=VARCHAR},
  350. user_names = #{userNames,jdbcType=VARCHAR},
  351. object_type = #{objectType,jdbcType=INTEGER},
  352. public_type = #{publicType,jdbcType=INTEGER},
  353. district_name = #{districtName,jdbcType=VARCHAR},
  354. clock_in = #{clockIn,jdbcType=INTEGER},
  355. tech_start_process = #{techStartProcess,jdbcType=INTEGER},
  356. address_name = #{addressName,jdbcType=VARCHAR}
  357. where id = #{id,jdbcType=INTEGER}
  358. </update>
  359. <update id="updateSignByAidAndUid">
  360. update public_release_details a left join public_release b on a.prid =b.id
  361. left join `user` c on a.uid=c.id
  362. set a.sign_sum =a.sign_sum +1
  363. where a.uid= #{uid} and a.main_status =1 and b.aid= #{aid}
  364. </update>
  365. <select id="listPublicRelease" resultType="com.goafanti.weChat.bo.OutPublicReleaseList">
  366. select a.id ,c.name aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.aid,a.public_type publicType,
  367. 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,
  368. date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_status updateStatus,a.district_name districtName,
  369. a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,a.type,a.main_name mainName,a.reject_name rejectName,
  370. a.assistant_aid assistantAid ,a.assistant_name assistantName,a.public_again publicAgain,a.user_names userNames,
  371. ea.total_amount expenseAmount ,a.clock_in clockIn,c2.name reviewerName,
  372. <if test="type==4 or type==5">
  373. ad.name userAdminName,
  374. </if>
  375. a.tech_start_process techStartProcess
  376. from public_release a left join admin c on a.aid =c.id
  377. left join admin c2 on c.reviewer=c2.id
  378. left join expense_account ea ON a.id = ea.prid AND ea.status IN (0, 1, 2, 3)
  379. <if test="type==2">
  380. left join department d on c.department_id =d.id
  381. </if>
  382. <if test="type==4 or type==5 or userName !=null">
  383. left join public_release_details b on a.id=b.prid
  384. left join user e on b.uid=e.id left join admin ad on e.aid=ad.id
  385. </if>
  386. <if test="type==5">
  387. left join t_order_new ton on a.order_no =ton.order_no
  388. left join t_order_mid tom on a.order_no=tom.order_no
  389. </if>
  390. <if test="type==6">
  391. left join admin_public_reviewer apr on a.aid=apr.aid and apr.reviewer_id= #{aid}
  392. </if>
  393. where 1=1
  394. <include refid="listPublicReleaseSql"/>
  395. ORDER BY (case when a.status=1 then 1 when a.status=2 then 2 when a.status=3 then 5
  396. when a.status=0 then 3 when a.status=4 then 4 else 0 end),a.create_time desc
  397. <if test="page_sql!=null">
  398. ${page_sql}
  399. </if>
  400. </select>
  401. <sql id="listPublicReleaseSql">
  402. <if test="type==0">
  403. and a.public_type in (0,1,2,3)
  404. <if test="assist ==0">
  405. and a.assist in(0,1)
  406. </if>
  407. <if test="assist == 2">
  408. and a.assist =2
  409. </if>
  410. <if test="assist == 3">
  411. and a.assist =3
  412. </if>
  413. <if test="assist ==4">
  414. and a.assist in (2,3)
  415. </if>
  416. <if test="assistType ==1">
  417. and a.assist in(0,1,2)
  418. </if>
  419. <if test="aid !=null">
  420. and a.aid= #{aid}
  421. </if>
  422. <if test="statusType ==1">
  423. and a.status in (0,1,2,4)
  424. </if>
  425. </if>
  426. <if test="type==1">
  427. and a.public_type in (0,2)
  428. and a.assist in(0,1)
  429. and a.tech_start_process in (0,2)
  430. and c.reviewer = #{aid}
  431. </if>
  432. <if test="type==2">
  433. and a.public_type in (0,2)
  434. and a.assist in(0,1)
  435. and d.manager_id = #{aid}
  436. </if>
  437. <if test="type==3">
  438. and a.public_type in (0,2)
  439. and a.assist=2
  440. <if test="aid !=null">
  441. and a.aid= #{aid}
  442. </if>
  443. and a.type = #{type}
  444. </if>
  445. <if test="type==4">
  446. and a.assist in(0,1)
  447. and e.aid = #{aid}
  448. and a.status=1
  449. <if test="status==null">and a.public_type in (1,2) </if>
  450. <if test="status==1">and a.public_type in (1) </if>
  451. <if test="status==2">and a.public_type in (2) </if>
  452. </if>
  453. <if test="type==5">
  454. and e.aid =#{aid}
  455. and a.status=1
  456. <if test="status==null">and a.tech_start_process in (1,2) </if>
  457. <if test="status==1">and a.tech_start_process in (1) </if>
  458. <if test="status==2">and a.tech_start_process in (2) </if>
  459. </if>
  460. <if test="type==6">
  461. and a.type=3 and a.assist=2
  462. </if>
  463. <if test="clockIn !=null">
  464. and a.clock_in =#{clockIn}
  465. </if>
  466. <if test="clockTime !=null">
  467. and a.release_start &lt; #{clockTime} and a.release_end &gt; #{clockTime}
  468. </if>
  469. <if test="releaseStarts != null and publicEnd != null">
  470. and a.release_start BETWEEN #{releaseStarts} and #{publicEnd}
  471. </if>
  472. <if test="userName !=null">
  473. and e.nickname like concat('%',#{userName},'%')
  474. </if>
  475. <if test="type!=4 and type !=5">
  476. <if test="status !=null ">
  477. and a.status = #{status}
  478. </if>
  479. </if>
  480. </sql>
  481. <select id="countPublicRelease" resultType="java.lang.Integer">
  482. select count(*)
  483. from public_release a left join admin c on a.aid =c.id
  484. <if test="type==2">
  485. left join department d on c.department_id =d.id
  486. </if>
  487. <if test="type==4 or type==5 or userName !=null">
  488. left join public_release_details b on a.id=b.prid
  489. left join user e on b.uid=e.id left join admin ad on e.aid=ad.id
  490. </if>
  491. where 1=1
  492. <include refid="listPublicReleaseSql"/>
  493. </select>
  494. <select id="selectDtails" resultType="com.goafanti.weChat.bo.OutPublicRelease">
  495. 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,
  496. 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,
  497. a.annex_url annexUrl ,a.remarks,a.duration ,a.valid_date validDate ,a.aid ,c.superior_id suprId,a.tech_start_process techStartProcess,
  498. a.plan ,a.expected_effect expectedEffect,a.next_plan nextPlan,c.reviewer,a.type,a.order_no orderNo,d.contract_no contractNo,a.address_name addressName,
  499. 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,
  500. 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
  501. from public_release a left join admin c on a.aid =c.id left join admin c2 on c.reviewer =c2.id
  502. left join (select prid ,GROUP_CONCAT(uid)uids from public_release_details where prid= #{id} group by prid)x on a.id=x.prid
  503. left join t_order_new d on a.order_no=d.order_no
  504. where 1=1
  505. <if test="id !=null">
  506. and a.id= #{id}
  507. </if>
  508. </select>
  509. <select id="selectDtailsByFid" resultType="com.goafanti.weChat.bo.OutPublicReleaseAndDetails">
  510. 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,
  511. 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,
  512. 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,
  513. a.plan ,a.expected_effect expectedEffect,a.next_plan nextPlan,c.reviewer,a.type,a.order_no orderNo,d.contract_no contractNo,
  514. 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,
  515. a.main_name mainName,a.assistant_aid assistantAid,a.assistant_name assistantName,a.public_again publicAhain
  516. from public_release a left join admin c on a.aid =c.id
  517. left join public_release_details x on a.id=x.prid
  518. left join user u on x.uid=u.id
  519. left join t_order_new d on a.order_no=d.order_no
  520. where 1=1
  521. <if test="ufid !=null">
  522. and x.ufid= #{ufid}
  523. </if>
  524. </select>
  525. <select id="listPublicStatistics" resultType="com.goafanti.weChat.bo.OutPublicStatistics">
  526. 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
  527. 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
  528. from public_release a inner join (select prid ,sum(if(clock_in=1,1,0))dk from public_release_details where 1=1
  529. <if test="clockStart != null and clockEnd != null">
  530. and clock_in_time between #{clockStart} and #{clockEnd}
  531. </if>
  532. group by prid ) b on a.id =b.prid
  533. left join admin c on a.aid=c.id 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. )x group by x.aid)y left join admin c on c.id=y.aid
  544. <if test="page_sql!=null">
  545. ${page_sql}
  546. </if>
  547. </select>
  548. <select id="countPublicStatistics" resultType="java.lang.Integer">
  549. select count(*) from (select aid from public_release a
  550. inner join (select prid ,sum(if(clock_in=1,1,0))dk from public_release_details where 1=1
  551. <if test="clockStart != null and clockEnd != null">
  552. and clock_in_time between #{clockStart} and #{clockEnd}
  553. </if>
  554. group by prid ) b on a.id =b.prid
  555. left join admin c on a.aid=c.id
  556. where 1=1
  557. <if test="aid != null">
  558. and a.aid= #{aid}
  559. </if>
  560. <if test="createStart != null and createEnd !=null">
  561. and a.create_time between #{createStart} and #{createEnd}
  562. </if>
  563. <if test="depId != null">
  564. and c.department_id = #{depId}
  565. </if>
  566. group by aid)x
  567. </select>
  568. <select id="listPublicDtails" resultType="com.goafanti.weChat.bo.OutPublicDtails">
  569. 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,
  570. 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 ,
  571. 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,
  572. date_format(b.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,date_format(b.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,a.address_name addressName,
  573. b.plan ,b.next_plan nextPlan ,b.expected_effect expectedEffect,b.update_status updateStatus,b.assist_aid_name assistAidName,
  574. b.main_name mainName,b.assist,b.assistant_aid assistantAid, b.assistant_name assistantName,f.contract_no contractNo,
  575. e.name sname,f.total_amount totalAmout,d.sign_bills signBills,date_format(d.sign_time,'%Y-%m-%d')signTime
  576. from public_release_details a left join public_release b on a.prid =b.id
  577. left join admin c on b.aid =c.id left join t_order_new f on b.order_no =f.order_no
  578. left join `user` d on a.uid =d.id left join admin e on d.aid=e.id
  579. where 1=1
  580. <if test="publicType != null">
  581. and b.type= #{publicType}
  582. </if>
  583. <if test="aid != null">
  584. and b.aid= #{aid}
  585. </if>
  586. <if test="sid != null">
  587. and d.aid= #{sid}
  588. </if>
  589. <if test="deps !=null">
  590. and c.department_id in
  591. <foreach close=")" collection="deps" item="dep" open="(" separator=",">
  592. #{dep}
  593. </foreach>
  594. </if>
  595. <if test="uid != null">
  596. and a.uid = #{uid}
  597. </if>
  598. <if test="releaseStart != null and releaseEnd != null">
  599. and (b.release_start between #{releaseStart} and #{releaseEnd} or b.release_end between #{releaseStart} and #{releaseEnd})
  600. </if>
  601. <if test="createStart != null and createEnd != null">
  602. and b.create_time between #{createStart} and #{createEnd}
  603. </if>
  604. <if test="status != null">
  605. and b.status = #{status}
  606. </if>
  607. <if test="statusType == 1">
  608. and b.status in (1,2)
  609. </if>
  610. <if test="clockIn !=null">
  611. and a.clock_in= #{clockIn}
  612. </if>
  613. <if test="contractNo !=null">
  614. and f.contract_no like CONCAT('%',#{contractNo},'%')
  615. </if>
  616. order by b.status,b.create_time desc
  617. <if test="page_sql!=null">
  618. ${page_sql}
  619. </if>
  620. </select>
  621. <select id="countPublicDtails" resultType="java.lang.Integer">
  622. select count(*)
  623. from public_release_details a left join public_release b on a.prid =b.id
  624. left join admin c on b.aid =c.id left join `user` d on a.uid =d.id
  625. <if test="contractNo !=null">
  626. left join t_order_new f on b.order_no =f.order_no
  627. </if>
  628. where 1=1
  629. <if test="publicType != null">
  630. and b.type= #{publicType}
  631. </if>
  632. <if test="aid != null">
  633. and b.aid= #{aid}
  634. </if>
  635. <if test="sid != null">
  636. and d.aid= #{sid}
  637. </if>
  638. <if test="deps !=null">
  639. and c.department_id in
  640. <foreach close=")" collection="deps" item="dep" open="(" separator=",">
  641. #{dep}
  642. </foreach>
  643. </if>
  644. <if test="uid != null">
  645. and a.uid = #{uid}
  646. </if>
  647. <if test="releaseStart != null and releaseEnd != null">
  648. and (b.release_start between #{releaseStart} and #{releaseEnd} or b.release_end between #{releaseStart} and #{releaseEnd})
  649. </if>
  650. <if test="createStart != null and createEnd != null">
  651. and b.create_time between #{createStart} and #{createEnd}
  652. </if>
  653. <if test="status != null">
  654. and b.status = #{status}
  655. </if>
  656. <if test="statusType == 1">
  657. and b.status in (1,2)
  658. </if>
  659. <if test="clockIn !=null">
  660. and a.clock_in= #{clockIn}
  661. </if>
  662. <if test="contractNo !=null">
  663. and f.contract_no like CONCAT('%',#{contractNo},'%')
  664. </if>
  665. </select>
  666. <select id="checkTime" resultType="java.lang.Integer">
  667. select id from public_release where aid=#{aid} and status in (0,1,2)
  668. and ( (release_start &gt;= #{start} and release_start &lt; #{end})
  669. or (release_start &lt; #{start} and release_end &gt; #{start})
  670. or (release_start &lt; #{end} and release_end &gt; #{end}))
  671. </select>
  672. <select id="getTimeUserFollow" resultType="com.goafanti.common.model.OutPublicReleaseCount">
  673. 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
  674. left join public_release_details b on a.id=b.prid
  675. where b.main_status =1 and a.create_time between #{date} and #{now}
  676. group by a.aid,b.uid,b.new_user)a left join admin c on a.aid=c.id
  677. left join department d on c.department_id =d.id left join district_glossory e on d.province =e.id
  678. </select>
  679. <select id="publicByOrder" resultType="com.goafanti.weChat.bo.OutPublicRelease">
  680. select a.id,a.uid,b.aid,b.nickname ,c.name aname,a.duration ,a.district_name districtName,
  681. date_format(pr.release_start,'%Y-%m-%d %H:%i:%S')releaseStarts,
  682. date_format(pr.release_end ,'%Y-%m-%d %H:%i:%S')releaseEnds,
  683. date_format(a.clock_in_time ,'%Y-%m-%d %H:%i:%S')clockInTimes,
  684. pr.remarks
  685. from public_release_details a left join public_release pr on a.prid=pr.id
  686. left join user b on a.uid=b.id left join admin c on pr.aid =c.id
  687. where pr.order_no = #{orderNo}
  688. </select>
  689. <select id="selectByMainId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  690. select
  691. <include refid="Base_Column_List" />
  692. from public_release
  693. where main_id = #{mainId}
  694. <if test="type !=null">
  695. and type= #{type}
  696. </if>
  697. <if test="aid !=null">
  698. and aid= #{aid}
  699. </if>
  700. </select>
  701. <update id="updateStatusByMainId">
  702. update public_release set status= #{status}
  703. where main_id= #{mainId}
  704. <if test="type !=null">
  705. and type= #{type}
  706. </if>
  707. <if test="aid !=null">
  708. and aid= #{aid}
  709. </if>
  710. </update>
  711. <select id="selectCountByaidAndDate" resultType="java.lang.Integer">
  712. select ifnull(count(*),0)publicReleaseCount
  713. from (select aid
  714. from public_release a left join public_release_details b on a.id=b.prid
  715. where status =2 and aid= #{aid}
  716. and a.release_start BETWEEN #{startTime} and #{endTime} )x
  717. group by aid
  718. </select>
  719. <select id="selectByaidAndDate" resultType="com.goafanti.admin.bo.OutFinanceCount">
  720. select aid,dates,sum(publicCount)publicCount
  721. from (select aid,if(a.`type` in (0,1,2),1,0) publicCount,DATE_FORMAT(a.release_start , '%Y-%m-%d') dates
  722. from public_release a left join public_release_details b on a.id=b.prid
  723. where a.status=2 and a.aid= #{aid}
  724. and a.release_start between #{startTime} and #{endTime})x
  725. group by x.aid,x.dates
  726. </select>
  727. <select id="selectByOrderNo" resultMap="BaseResultMap">
  728. select
  729. <include refid="Base_Column_List" />
  730. from public_release
  731. where status in (1,2)
  732. and order_no= #{orderNo}
  733. </select>
  734. <select id="selectMyNewPublic" resultMap="BaseResultMap">
  735. select
  736. <include refid="Base_Column_List" />
  737. from public_release
  738. where status in(1,2) and aid = #{aid}
  739. order by release_start desc limit 10
  740. </select>
  741. <select id="selectOutListBoById" resultType="com.goafanti.weChat.bo.OutPublicReleaseList">
  742. select a.id ,c.name aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.aid,a.public_type publicType,
  743. 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,
  744. date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_status updateStatus,a.district_name districtName,
  745. a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,a.type,a.main_name mainName,a.reject_name rejectName,
  746. a.assistant_aid assistantAid ,a.assistant_name assistantName,a.public_again publicAgain,a.user_names userNames,
  747. ea.total_amount expenseAmount ,a.clock_in clockIn,c2.name reviewerName,a.tech_start_process techStartProcess
  748. from public_release a left join admin c on a.aid =c.id
  749. left join admin c2 on c.reviewer=c2.id
  750. left join (select * from expense_account where status in (0,1,2,3)) ea on a.id =ea.prid
  751. where a.id= #{id}
  752. </select>
  753. <select id="selectAll" resultMap="BaseResultMap">
  754. select
  755. <include refid="Base_Column_List" />
  756. from public_release
  757. where status in (1,2)
  758. </select>
  759. <select id="releaseAndExpenseCount" resultType="com.goafanti.weChat.bo.releaseAndExpenseCountOut">
  760. select
  761. a.order_no orderNo,a.contract_no contractNo,b.buyer_name buyerName,b.salesman_name salesmanName,b.dep_name depName,
  762. toc.actual_duration actualDuration ,
  763. a.total_amount totalAmount,a.settlement_amount settlementAmount,b.bid_type bidType,
  764. c.expenseCount,c.peopleCount,c.notExamine,c.rejectCount,d.paymentAmount,c.days,c.amount expenseAmount
  765. from t_order_new a left join t_order_mid b on a.order_no =b.order_no
  766. left join t_order_public_release_count toc on a.order_no =toc.order_no
  767. inner join (select a.order_no,a.expenseCount,b.peopleCount,c.notExamine, c.rejectCount,a.days,a.amount
  768. from (select a.order_no,count(a.id)expenseCount,sum(a.amount) amount,sum(ROUND(a.duration/7.5) )days
  769. from expense_account a where a.target_type = 1 and a.status=2
  770. <if test="startTime !=null and endTime !=null">
  771. and a.create_time BETWEEN #{startTime} and #{endTime}
  772. </if>
  773. group by order_no )a
  774. left join (select order_no,count(aid)peopleCount from (select a.order_no,aid from expense_account a
  775. 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
  776. left join (select a.order_no,sum(notExamine)notExamine,sum(rejectCount)rejectCount
  777. from (select a.order_no,status ,IF(status=1,1,0)notExamine,IF(status=3,1,0)rejectCount
  778. from expense_account a where a.target_type=1
  779. )a group by order_no)c on a.order_no=c.order_no )c on a.order_no =c.order_no
  780. left join ( select a.order_no ,sum(c.payment_amount) paymentAmount
  781. 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
  782. where c.status =3 group by order_no )d on a.order_no=d.order_no
  783. where a.delete_sign in (0,2) and a.process_status >0
  784. <if test="contractNo != null">
  785. and a.contract_no = #{contractNo}
  786. </if>
  787. <if test="buyerName != null">
  788. and b.buyer_name like concat('%',#{buyerName},'%')
  789. </if>
  790. <if test="depId != null">
  791. and a.order_dep = #{depId}
  792. </if>
  793. <if test="aid != null">
  794. and a.salesman_id = #{aid}
  795. </if>
  796. <if test="allStatus == 1">
  797. and toc.exceed_duration =0
  798. </if>
  799. <if test="allStatus == 2">
  800. and toc.exceed_duration >0
  801. </if>
  802. order by contract_no desc
  803. </select>
  804. <select id="selectSonIdByMain" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  805. select
  806. b.id, b.aid, b.release_start, b.release_end, b.remarks, b.annex_url, b.status, b.create_time, b.pid, b.pname, b.duration, b.valid_date, b.supplement, b.audit_info, b.plan, b.expected_effect, b.next_plan, b.type, b.order_no, b.update_time, b.update_status, b.assist, b.assist_aid, b.assist_aid_name, b.main_id, b.main_name, b.reject_name, b.assistant_aid, b.assistant_name, b.public_again, b.audit_time, b.new_user, b.sign_sum, b.user_names, b.object_type, b.public_type, b.district_name, b.clock_in, b.tech_start_process, b.address_name
  807. from public_release a left join public_release b on a.main_id=b.id
  808. where a.id = #{id,jdbcType=INTEGER}
  809. </select>
  810. <select id="selectCountByAssistUnaudited" resultType="java.lang.Integer">
  811. SELECT count(*)
  812. from public_release a left join admin_public_reviewer b on a.aid =b.aid
  813. where a.`type`=3 and a.assist =2 and a.status =1 and b.type =1
  814. and b.reviewer_id = #{aid}
  815. </select>
  816. <select id="selectCountByUnaudited" resultType="java.lang.Integer">
  817. select COUNT(*)
  818. from public_release a left join admin c on a.aid =c.id
  819. where a.public_type in (0,2)
  820. and a.assist in(0,1)
  821. and a.tech_start_process in (0,2)
  822. and a.status =1
  823. and c.reviewer = #{aid}
  824. </select>
  825. <select id="selectCountByOtherUnaudited" resultType="java.lang.Integer">
  826. select count(*)
  827. from public_release a
  828. left join public_release_details b on a.id=b.prid
  829. left join `user` e on b.uid=e.id
  830. where a.assist in(0,1)
  831. and(a.public_type =1 or a.tech_start_process=1)
  832. and a.status =1
  833. and e.aid = #{aid}
  834. </select>
  835. </mapper>