BdglDiaryMapper.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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.supervision.grassrootsregistration.mapper.BdglDiaryMapper">
  6. <resultMap type="BdglDiary" id="BdglDiaryResult">
  7. <result property="id" column="id" />
  8. <result property="unitId" column="unit_id" />
  9. <result property="peopleId" column="people_id" />
  10. <result property="blogDate" column="blog_date" />
  11. <result property="weather" column="weather" />
  12. <result property="orgcadre" column="orgcadre" />
  13. <result property="orgsoldier" column="orgsoldier" />
  14. <result property="orgcivilian" column="orgcivilian" />
  15. <result property="nowcadre" column="nowcadre" />
  16. <result property="nowsoldier" column="nowsoldier" />
  17. <result property="nowcivilian" column="nowcivilian" />
  18. <result property="tolerance" column="tolerance" />
  19. <result property="transfer" column="transfer" />
  20. <result property="equip" column="equip" />
  21. <result property="internal" column="internal" />
  22. <result property="dutylead" column="dutylead" />
  23. <result property="dutya" column="dutyA" />
  24. <result property="dutyb" column="dutyB" />
  25. <result property="dutyc" column="dutyC" />
  26. <result property="dutyd" column="dutyD" />
  27. <result property="dutye" column="dutyE" />
  28. <result property="dutyf" column="dutyF" />
  29. <result property="dutyinfoa" column="dutyinfoA" />
  30. <result property="dutyinfoc" column="dutyinfoC" />
  31. <result property="dutyinfoe" column="dutyinfoE" />
  32. <result property="dutyDate" column="duty_date" />
  33. <result property="invalid" column="invalid" />
  34. <result property="notice" column="notice" />
  35. <result property="lead" column="lead" />
  36. <result property="weekwork" column="weekwork" />
  37. <result property="examine" column="examine" />
  38. <result property="peopleId1" column="people_id1" />
  39. <result property="contents" column="contents" />
  40. <result property="createId" column="create_id" />
  41. <result property="createName" column="create_name" />
  42. <result property="peopleName" column="people_name" />
  43. <result property="leadName" column="lead_name" />
  44. <result property="unitName" column="unit_name" />
  45. <result property="organizer" column="organizer" />
  46. <result property="diaryTime" column="diary_time" />
  47. </resultMap>
  48. <sql id="selectBdglDiaryVo">
  49. select id, unit_id, people_id, blog_date, weather, orgcadre, orgsoldier, orgcivilian, nowcadre, nowsoldier, nowcivilian, tolerance, transfer, equip, internal, dutylead, dutyA, dutyB, dutyC, dutyD, dutyE, dutyF, dutyinfoA, dutyinfoC, dutyinfoE, duty_date, invalid, notice, lead, weekwork, examine, people_id1, contents, create_id, create_name,people_name,lead_name,unit_name,organizer,diary_time from bdgl_diary
  50. </sql>
  51. <select id="selectBdglDiaryListss" parameterType="BdglDiary" resultMap="BdglDiaryResult">
  52. <include refid="selectBdglDiaryVo"/>
  53. <where>
  54. <if test="unitId != null "> and unit_id = #{unitId}</if>
  55. <if test="peopleId != null "> and people_id = #{peopleId}</if>
  56. <if test="blogDate != null "> and blog_date = #{blogDate}</if>
  57. <if test="weather != null and weather != ''"> and weather = #{weather}</if>
  58. <if test="orgcadre != null "> and orgcadre = #{orgcadre}</if>
  59. <if test="orgsoldier != null "> and orgsoldier = #{orgsoldier}</if>
  60. <if test="orgcivilian != null "> and orgcivilian = #{orgcivilian}</if>
  61. <if test="nowcadre != null "> and nowcadre = #{nowcadre}</if>
  62. <if test="nowsoldier != null "> and nowsoldier = #{nowsoldier}</if>
  63. <if test="nowcivilian != null "> and nowcivilian = #{nowcivilian}</if>
  64. <if test="tolerance != null and tolerance != ''"> and tolerance = #{tolerance}</if>
  65. <if test="transfer != null and transfer != ''"> and transfer = #{transfer}</if>
  66. <if test="equip != null and equip != ''"> and equip = #{equip}</if>
  67. <if test="internal != null and internal != ''"> and internal = #{internal}</if>
  68. <if test="dutylead != null and dutylead != ''"> and dutylead = #{dutylead}</if>
  69. <if test="dutya != null and dutya != ''"> and dutyA = #{dutya}</if>
  70. <if test="dutyb != null and dutyb != ''"> and dutyB = #{dutyb}</if>
  71. <if test="dutyc != null and dutyc != ''"> and dutyC = #{dutyc}</if>
  72. <if test="dutyd != null and dutyd != ''"> and dutyD = #{dutyd}</if>
  73. <if test="dutye != null and dutye != ''"> and dutyE = #{dutye}</if>
  74. <if test="dutyf != null and dutyf != ''"> and dutyF = #{dutyf}</if>
  75. <if test="dutyinfoa != null and dutyinfoa != ''"> and dutyinfoA = #{dutyinfoa}</if>
  76. <if test="dutyinfoc != null and dutyinfoc != ''"> and dutyinfoC = #{dutyinfoc}</if>
  77. <if test="dutyinfoe != null and dutyinfoe != ''"> and dutyinfoE = #{dutyinfoe}</if>
  78. <if test="dutyDate != null "> and duty_date = #{dutyDate}</if>
  79. <if test="invalid != null and invalid != ''"> and invalid = #{invalid}</if>
  80. <if test="notice != null and notice != ''"> and notice = #{notice}</if>
  81. <if test="lead != null "> and lead = #{lead}</if>
  82. <if test="weekwork != null and weekwork != ''"> and weekwork = #{weekwork}</if>
  83. <if test="examine != null "> and examine = #{examine}</if>
  84. <if test="peopleId1 != null "> and people_id1 = #{peopleId1}</if>
  85. <if test="contents != null and contents != ''"> and contents = #{contents}</if>
  86. <if test="createId != null "> and create_id = #{createId}</if>
  87. <if test="createName != null and createName != ''"> and create_name like concat('%', #{createName}, '%')</if>
  88. <if test="peopleName != null and peopleName != ''"> and people_name like concat('%', #{peopleName}, '%')</if>
  89. <if test="leadName != null and leadName != ''"> and lead_name like concat('%', #{leadName}, '%')</if>
  90. <if test="unitName != null and unitName != ''"> and unit_name like concat('%', #{unitName}, '%')</if>
  91. <if test="organizer != null and organizer != ''"> and organizer = #{organizer}</if>
  92. <if test="diaryTime != null and diaryTime != ''"> and diary_time = #{diaryTime}</if>
  93. </where>
  94. order by id desc
  95. </select>
  96. <select id="selectBdglDiaryList" parameterType="BdglDiary" resultMap="BdglDiaryResult">
  97. select d.id, d.unit_id,t.dept_id, people_id,d.blog_date, d.weather, d.orgcadre, d.orgsoldier, d.orgcivilian, d.nowcadre, d.nowsoldier, d.nowcivilian
  98. , tolerance, transfer, equip, internal, dutylead, dutyA, dutyB, dutyC, dutyD, dutyE, dutyF, dutyinfoA, dutyinfoC, dutyinfoE, duty_date, invalid
  99. , d.notice, d.lead,d.weekwork,d.examine, d.people_id1,d.contents,d.create_id, create_name,people_name,lead_name,unit_name,organizer,diary_time
  100. from bdgl_diary d left join sys_dept t
  101. on d.unit_id=t.dept_id
  102. <where>
  103. <if test="peopleId != null "> and d.people_id = #{peopleId}</if>
  104. <if test="blogDate != null "> and d.blog_date = like concat('%', #{blogDate}, '%')</if>
  105. <if test="weather != null and weather != ''"> and d.weather = #{weather}</if>
  106. <if test="orgcadre != null "> and d.orgcadre = #{orgcadre}</if>
  107. <if test="orgsoldier != null "> and d.orgsoldier = #{orgsoldier}</if>
  108. <if test="orgcivilian != null "> and d.orgcivilian = #{orgcivilian}</if>
  109. <if test="nowcadre != null "> and d.nowcadre = #{nowcadre}</if>
  110. <if test="nowsoldier != null "> and d.nowsoldier = #{nowsoldier}</if>
  111. <if test="nowcivilian != null "> and d.nowcivilian = #{nowcivilian}</if>
  112. <if test="tolerance != null and tolerance != ''"> and d.tolerance = #{tolerance}</if>
  113. <if test="transfer != null and transfer != ''"> and d.transfer = #{transfer}</if>
  114. <if test="equip != null and equip != ''"> and d.equip = #{equip}</if>
  115. <if test="internal != null and internal != ''"> and d.internal = #{internal}</if>
  116. <if test="dutylead != null and dutylead != ''"> and d.dutylead = #{dutylead}</if>
  117. <if test="dutya != null and dutya != ''"> and d.dutyA = #{dutya}</if>
  118. <if test="dutyb != null and dutyb != ''"> and d.dutyB = #{dutyb}</if>
  119. <if test="dutyc != null and dutyc != ''"> and d.dutyC = #{dutyc}</if>
  120. <if test="dutyd != null and dutyd != ''"> and d.dutyD = #{dutyd}</if>
  121. <if test="dutye != null and dutye != ''"> and d.dutyE = #{dutye}</if>
  122. <if test="dutyf != null and dutyf != ''"> and d.dutyF = #{dutyf}</if>
  123. <if test="dutyinfoa != null and dutyinfoa != ''"> and d.dutyinfoA = #{dutyinfoa}</if>
  124. <if test="dutyinfoc != null and dutyinfoc != ''"> and d.dutyinfoC = #{dutyinfoc}</if>
  125. <if test="dutyinfoe != null and dutyinfoe != ''"> and d.dutyinfoE = #{dutyinfoe}</if>
  126. <if test="dutyDate != null "> and d.duty_date = #{dutyDate}</if>
  127. <if test="invalid != null and invalid != ''"> and d.invalid = #{invalid}</if>
  128. <if test="notice != null and notice != ''"> and d.notice = #{notice}</if>
  129. <if test="lead != null "> and d.lead = #{lead}</if>
  130. <if test="weekwork != null and weekwork != ''"> and d.weekwork = #{weekwork}</if>
  131. <if test="examine != null "> and d.examine = #{examine}</if>
  132. <if test="peopleId1 != null "> and d.people_id1 = #{peopleId1}</if>
  133. <if test="contents != null and contents != ''"> and d.contents = #{contents}</if>
  134. <if test="createId != null "> and d.create_id = #{createId}</if>
  135. <if test="createName != null and createName != ''"> and d.create_name like concat('%', #{createName}, '%')</if>
  136. <if test="peopleName != null and peopleName != ''"> and d.people_name like concat('%', #{peopleName}, '%')</if>
  137. <if test="leadName != null and leadName != ''"> and d.lead_name like concat('%', #{leadName}, '%')</if>
  138. <if test="unitName != null and unitName != ''"> and d.unit_name like concat('%', #{unitName}, '%')</if>
  139. <if test="organizer != null and organizer != ''"> and d.organizer like concat('%', #{organizer}, '%')</if>
  140. <if test="diaryTime != null and diaryTime != ''"> and d.diary_time like concat('%', #{diaryTime}, '%')</if>
  141. <if test="unitId !=null">
  142. and (d.unit_id=#{unitId} or find_in_set(#{unitId}, t.ancestors))
  143. </if>
  144. </where>
  145. order by d.blog_date desc
  146. </select>
  147. <select id="selectBdglDiaryById" parameterType="Integer" resultMap="BdglDiaryResult">
  148. <include refid="selectBdglDiaryVo"/>
  149. where id = #{id}
  150. </select>
  151. <select id="selectBdglDiaryLists" parameterType="BdglDiary" resultMap="BdglDiaryResult">
  152. <include refid="selectBdglDiaryVo"/>
  153. <where>
  154. <if test="unitId != null">and unit_id=#{unitId}</if>
  155. AND examine =1
  156. </where>
  157. </select>
  158. <select id="selectBdglDiarys" resultMap="BdglDiaryResult">
  159. select distinct (unit_id),id, people_id, blog_date, weather, orgcadre, orgsoldier, orgcivilian, nowcadre, nowsoldier, nowcivilian, tolerance, transfer, equip, internal, dutylead, dutyA, dutyB, dutyC, dutyD, dutyE, dutyF, dutyinfoA, dutyinfoC, dutyinfoE, duty_date, invalid, notice, lead, weekwork, examine, people_id1, contents, create_id, create_name,people_name,lead_name,unit_name,organizer,diary_time from bdgl_diary
  160. where diary_time=#{diary_time}
  161. and examine=1
  162. </select>
  163. <insert id="insertBdglDiary" parameterType="BdglDiary" useGeneratedKeys="true" keyProperty="id">
  164. insert into bdgl_diary
  165. <trim prefix="(" suffix=")" suffixOverrides=",">
  166. <if test="unitId != null">unit_id,</if>
  167. <if test="peopleId != null">people_id,</if>
  168. <if test="blogDate != null">blog_date,</if>
  169. <if test="weather != null">weather,</if>
  170. <if test="orgcadre != null">orgcadre,</if>
  171. <if test="orgsoldier != null">orgsoldier,</if>
  172. <if test="orgcivilian != null">orgcivilian,</if>
  173. <if test="nowcadre != null">nowcadre,</if>
  174. <if test="nowsoldier != null">nowsoldier,</if>
  175. <if test="nowcivilian != null">nowcivilian,</if>
  176. <if test="tolerance != null">tolerance,</if>
  177. <if test="transfer != null">transfer,</if>
  178. <if test="equip != null">equip,</if>
  179. <if test="internal != null">internal,</if>
  180. <if test="dutylead != null">dutylead,</if>
  181. <if test="dutya != null">dutyA,</if>
  182. <if test="dutyb != null">dutyB,</if>
  183. <if test="dutyc != null">dutyC,</if>
  184. <if test="dutyd != null">dutyD,</if>
  185. <if test="dutye != null">dutyE,</if>
  186. <if test="dutyf != null">dutyF,</if>
  187. <if test="dutyinfoa != null">dutyinfoA,</if>
  188. <if test="dutyinfoc != null">dutyinfoC,</if>
  189. <if test="dutyinfoe != null">dutyinfoE,</if>
  190. <if test="dutyDate != null">duty_date,</if>
  191. <if test="invalid != null">invalid,</if>
  192. <if test="notice != null">notice,</if>
  193. <if test="lead != null">lead,</if>
  194. <if test="weekwork != null">weekwork,</if>
  195. <if test="examine != null">examine,</if>
  196. <if test="peopleId1 != null">people_id1,</if>
  197. <if test="contents != null">contents,</if>
  198. <if test="createId != null">create_id,</if>
  199. <if test="createName != null">create_name,</if>
  200. <if test="peopleName != null">people_name,</if>
  201. <if test="leadName != null">lead_name,</if>
  202. <if test="unitName != null">unit_name,</if>
  203. <if test="organizer != null">organizer,</if>
  204. <if test="diaryTime != null">diary_time,</if>
  205. </trim>
  206. <trim prefix="values (" suffix=")" suffixOverrides=",">
  207. <if test="unitId != null">#{unitId},</if>
  208. <if test="peopleId != null">#{peopleId},</if>
  209. <if test="blogDate != null">#{blogDate},</if>
  210. <if test="weather != null">#{weather},</if>
  211. <if test="orgcadre != null">#{orgcadre},</if>
  212. <if test="orgsoldier != null">#{orgsoldier},</if>
  213. <if test="orgcivilian != null">#{orgcivilian},</if>
  214. <if test="nowcadre != null">#{nowcadre},</if>
  215. <if test="nowsoldier != null">#{nowsoldier},</if>
  216. <if test="nowcivilian != null">#{nowcivilian},</if>
  217. <if test="tolerance != null">#{tolerance},</if>
  218. <if test="transfer != null">#{transfer},</if>
  219. <if test="equip != null">#{equip},</if>
  220. <if test="internal != null">#{internal},</if>
  221. <if test="dutylead != null">#{dutylead},</if>
  222. <if test="dutya != null">#{dutya},</if>
  223. <if test="dutyb != null">#{dutyb},</if>
  224. <if test="dutyc != null">#{dutyc},</if>
  225. <if test="dutyd != null">#{dutyd},</if>
  226. <if test="dutye != null">#{dutye},</if>
  227. <if test="dutyf != null">#{dutyf},</if>
  228. <if test="dutyinfoa != null">#{dutyinfoa},</if>
  229. <if test="dutyinfoc != null">#{dutyinfoc},</if>
  230. <if test="dutyinfoe != null">#{dutyinfoe},</if>
  231. <if test="dutyDate != null">#{dutyDate},</if>
  232. <if test="invalid != null">#{invalid},</if>
  233. <if test="notice != null">#{notice},</if>
  234. <if test="lead != null">#{lead},</if>
  235. <if test="weekwork != null">#{weekwork},</if>
  236. <if test="examine != null">#{examine},</if>
  237. <if test="peopleId1 != null">#{peopleId1},</if>
  238. <if test="contents != null">#{contents},</if>
  239. <if test="createId != null">#{createId},</if>
  240. <if test="createName != null">#{createName},</if>
  241. <if test="peopleName != null">#{peopleName},</if>
  242. <if test="leadName != null">#{leadName},</if>
  243. <if test="unitName != null">#{unitName},</if>
  244. <if test="organizer != null">#{organizer},</if>
  245. <if test="diaryTime != null">#{diaryTime},</if>
  246. </trim>
  247. </insert>
  248. <update id="updateBdglDiary" parameterType="BdglDiary">
  249. update bdgl_diary
  250. <trim prefix="SET" suffixOverrides=",">
  251. <if test="unitId != null">unit_id = #{unitId},</if>
  252. <if test="peopleId != null">people_id = #{peopleId},</if>
  253. <if test="blogDate != null">blog_date = #{blogDate},</if>
  254. <if test="weather != null">weather = #{weather},</if>
  255. <if test="orgcadre != null">orgcadre = #{orgcadre},</if>
  256. <if test="orgsoldier != null">orgsoldier = #{orgsoldier},</if>
  257. <if test="orgcivilian != null">orgcivilian = #{orgcivilian},</if>
  258. <if test="nowcadre != null">nowcadre = #{nowcadre},</if>
  259. <if test="nowsoldier != null">nowsoldier = #{nowsoldier},</if>
  260. <if test="nowcivilian != null">nowcivilian = #{nowcivilian},</if>
  261. <if test="tolerance != null">tolerance = #{tolerance},</if>
  262. <if test="transfer != null">transfer = #{transfer},</if>
  263. <if test="equip != null">equip = #{equip},</if>
  264. <if test="internal != null">internal = #{internal},</if>
  265. <if test="dutylead != null">dutylead = #{dutylead},</if>
  266. <if test="dutya != null">dutyA = #{dutya},</if>
  267. <if test="dutyb != null">dutyB = #{dutyb},</if>
  268. <if test="dutyc != null">dutyC = #{dutyc},</if>
  269. <if test="dutyd != null">dutyD = #{dutyd},</if>
  270. <if test="dutye != null">dutyE = #{dutye},</if>
  271. <if test="dutyf != null">dutyF = #{dutyf},</if>
  272. <if test="dutyinfoa != null">dutyinfoA = #{dutyinfoa},</if>
  273. <if test="dutyinfoc != null">dutyinfoC = #{dutyinfoc},</if>
  274. <if test="dutyinfoe != null">dutyinfoE = #{dutyinfoe},</if>
  275. <if test="dutyDate != null">duty_date = #{dutyDate},</if>
  276. <if test="invalid != null">invalid = #{invalid},</if>
  277. <if test="notice != null">notice = #{notice},</if>
  278. <if test="lead != null">lead = #{lead},</if>
  279. <if test="weekwork != null">weekwork = #{weekwork},</if>
  280. <if test="examine != null">examine = #{examine},</if>
  281. <if test="peopleId1 != null">people_id1 = #{peopleId1},</if>
  282. <if test="contents != null">contents = #{contents},</if>
  283. <if test="createId != null">create_id = #{createId},</if>
  284. <if test="createName != null">create_name = #{createName},</if>
  285. <if test="peopleName != null">people_name = #{peopleName},</if>
  286. <if test="leadName != null">lead_name = #{leadName},</if>
  287. <if test="unitName != null">unit_name = #{unitName},</if>
  288. <if test="organizer != null">organizer = #{organizer},</if>
  289. <if test="diaryTime != null">diary_time = #{diaryTime},</if>
  290. </trim>
  291. where id = #{id}
  292. </update>
  293. <delete id="deleteBdglDiaryById" parameterType="Integer">
  294. delete from bdgl_diary where id = #{id}
  295. </delete>
  296. <delete id="deleteBdglDiaryByIds" parameterType="String">
  297. delete from bdgl_diary where id in
  298. <foreach item="id" collection="array" open="(" separator="," close=")">
  299. #{id}
  300. </foreach>
  301. </delete>
  302. <select id="selectBdglDiaryListByTime" resultMap="BdglDiaryResult">
  303. SELECT orgcadre FROM bdgl_diary WHERE blog_date &gt;= #{starttime} AND blog_date &lt;= #{endtime} AND unit_id = #{unitid}
  304. </select>
  305. <select id="selectBdglDailyInspectCountByTime" resultType="int">
  306. SELECT
  307. COUNT(1)
  308. FROM
  309. bdgl_diary
  310. LEFT JOIN bdgl_daily_inspect ON bdgl_diary.id = bdgl_daily_inspect.diary_id
  311. WHERE blog_date &gt;= #{startTime} AND blog_date &lt;= #{endTime} AND bdgl_diary.unit_id = #{unitId}
  312. </select>
  313. <select id="selectDirayStatList" resultType="com.supervision.grassrootsregistration.domain.vo.BdglDiaryVo">
  314. SELECT
  315. a.id as id,
  316. a.unit_id as unitId,
  317. a.blog_date as blogDate,
  318. a.unit_name as unitName,
  319. b.people_name as peopleName,
  320. b.sentry_name as sentryName,
  321. b.foreman_name as foremanName,
  322. b.dialogue as dialogue,
  323. b.examine_date as examineDate
  324. FROM
  325. bdgl_diary a RIGHT JOIN bdgl_daily_inspect b ON a.id = b.diary_id
  326. <where>
  327. <if test="unitId != null ">AND a.unit_id = #{unitId}</if>
  328. <if test="unitName != null and unitName != ''">AND a.unit_name = #{unitName}</if>
  329. <if test="startTime != null and endTime != null ">AND a.blog_date BETWEEN #{startTime} AND #{endTime}</if>
  330. AND b.people_name is NOT NULL
  331. </where>
  332. ORDER BY a.blog_date
  333. </select>
  334. </mapper>