PublicReleaseMapper.xml 43 KB

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