PatrolCheckPlanMapper.xml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.welampiot.dao.PatrolCheckPlanDao">
  4. <select id="getPatrolCheckPlanList" resultType="PatrolCheckPlanDTO">
  5. select p.id,p.sectionId,p.count,p.check_begin_time checkBeginTime,
  6. p.com_count comCount,p.check_end_time checkEndTime
  7. from patrol_check_plan p
  8. left join section s on p.sectionId = s.id
  9. left join global_location gl on s.pid = gl.id
  10. left join global_location gl1 on gl.pid = gl1.id
  11. left join global_location gl2 on gl1.pid = gl2.id
  12. where 1=1
  13. <if test="keyword != null and keyword != ''">
  14. and p.number like '%${keyword}%'
  15. </if>
  16. <if test="sectionList != null and !sectionList.isEmpty()">
  17. and p.sectionId in
  18. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  19. #{item}
  20. </foreach>
  21. </if>
  22. <if test="areaId != null and areaId != 0">
  23. and gl.id = #{areaId}
  24. </if>
  25. <if test="sectionId != null and sectionId != 0">
  26. and p.sectionId = #{sectionId}
  27. </if>
  28. <if test="cityId != null and cityId != 0">
  29. and gl1.id = #{cityId}
  30. </if>
  31. <if test="provinceId != null and provinceId != 0">
  32. and gl2.id = #{provinceId}
  33. </if>
  34. <if test="page >= 0 and count > 0">
  35. limit #{page},#{count}
  36. </if>
  37. </select>
  38. <select id="getPatrolCheckPlanTotal" resultType="Integer">
  39. select count(p.id)
  40. from patrol_check_plan p
  41. <if test="sectionList != null and !sectionList.isEmpty()">
  42. where p.sectionId in
  43. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  44. #{item}
  45. </foreach>
  46. </if>
  47. </select>
  48. <select id="getPatrolCheckPlanInfo" resultType="PatrolCheckPlanDTO">
  49. select p.sectionId,p.count,p.check_begin_time checkBeginTime,
  50. p.check_end_time checkEndTime
  51. from patrol_check_plan p
  52. where p.id = #{id}
  53. </select>
  54. <insert id="addPatrolCheckPlanData" keyProperty="id" useGeneratedKeys="true" parameterType="PatrolCheckPlanDTO">
  55. insert into patrol_check_plan(sectionId,count,check_begin_time,check_end_time,create_time,create_id)
  56. values
  57. (#{sectionId},#{count},#{checkBeginTime},#{checkEndTime},#{createTime},#{createId})
  58. </insert>
  59. <update id="updatePatrolCheckPlanData" parameterType="PatrolCheckPlanDTO">
  60. update patrol_check_plan p
  61. set
  62. p.sectionId = #{sectionId},
  63. p.count = #{count},
  64. p.check_begin_time = #{checkBeginTime},
  65. p.check_end_time = #{checkEndTime}
  66. where p.id = #{id}
  67. </update>
  68. </mapper>