CameraControllerMapper.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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.monitoring.mapper.CameraControllerMapper">
  6. <resultMap type="CameraController" id="CameraControllerResult">
  7. <result property="id" column="id" />
  8. <result property="cname" column="cname" />
  9. <result property="caddr" column="caddr" />
  10. <result property="cstatus" column="cstatus" />
  11. <result property="createtime" column="createtime" />
  12. <result property="unitid" column="unitid" />
  13. <result property="unitname" column="unitname" />
  14. <result property="powerArea" column="power_area" />
  15. <result property="belongLocal" column="belong_local" />
  16. </resultMap>
  17. <sql id="selectCameraControllerVo">
  18. select id, cname, caddr, cstatus, createtime, unitid, unitname, power_area,belong_local from camera_controller
  19. </sql>
  20. <select id="selectCameraControllerList" parameterType="CameraController" resultMap="CameraControllerResult">
  21. <include refid="selectCameraControllerVo"/>
  22. <where>
  23. <if test="cname != null and cname != ''"> and cname like concat('%', #{cname}, '%')</if>
  24. <if test="caddr != null and caddr != ''"> and caddr = #{caddr}</if>
  25. <if test="cstatus != null and cstatus != ''"> and cstatus = #{cstatus}</if>
  26. <if test="createtime != null "> and createtime = #{createtime}</if>
  27. <if test="unitid != null "> and unitid = #{unitid}</if>
  28. <if test="unitname != null and unitname != ''"> and unitname like concat('%', #{unitname}, '%')</if>
  29. <if test="powerArea != null "> and power_area = #{powerArea}</if>
  30. <if test="belongLocal != null "> and belong_local = #{belongLocal}</if>
  31. </where>
  32. </select>
  33. <select id="selectCameraControllerById" parameterType="Long" resultMap="CameraControllerResult">
  34. <include refid="selectCameraControllerVo"/>
  35. where id = #{id}
  36. </select>
  37. <insert id="insertCameraController" parameterType="CameraController">
  38. insert into camera_controller
  39. <trim prefix="(" suffix=")" suffixOverrides=",">
  40. <if test="id != null">id,</if>
  41. <if test="cname != null">cname,</if>
  42. <if test="caddr != null">caddr,</if>
  43. <if test="cstatus != null">cstatus,</if>
  44. <if test="createtime != null">createtime,</if>
  45. <if test="unitid != null">unitid,</if>
  46. <if test="unitname != null">unitname,</if>
  47. <if test="powerArea != null">power_area,</if>
  48. <if test="belongLocal != null">belong_local,</if>
  49. </trim>
  50. <trim prefix="values (" suffix=")" suffixOverrides=",">
  51. <if test="id != null">#{id},</if>
  52. <if test="cname != null">#{cname},</if>
  53. <if test="caddr != null">#{caddr},</if>
  54. <if test="cstatus != null">#{cstatus},</if>
  55. <if test="createtime != null">#{createtime},</if>
  56. <if test="unitid != null">#{unitid},</if>
  57. <if test="unitname != null">#{unitname},</if>
  58. <if test="powerArea != null">#{powerArea},</if>
  59. <if test="belongLocal != null">#{belongLocal},</if>
  60. </trim>
  61. </insert>
  62. <update id="updateCameraController" parameterType="CameraController">
  63. update camera_controller
  64. <trim prefix="SET" suffixOverrides=",">
  65. <if test="cname != null">cname = #{cname},</if>
  66. <if test="caddr != null">caddr = #{caddr},</if>
  67. <if test="cstatus != null">cstatus = #{cstatus},</if>
  68. <if test="createtime != null">createtime = #{createtime},</if>
  69. <if test="unitid != null">unitid = #{unitid},</if>
  70. <if test="unitname != null">unitname = #{unitname},</if>
  71. <if test="powerArea != null">power_area = #{powerArea},</if>
  72. <if test="belongLocal != null">belong_local = #{belongLocal},</if>
  73. </trim>
  74. where id = #{id}
  75. </update>
  76. <delete id="deleteCameraControllerById" parameterType="Long">
  77. delete from camera_controller where id = #{id}
  78. </delete>
  79. <delete id="deleteCameraControllerByIds" parameterType="String">
  80. delete from camera_controller where id in
  81. <foreach item="id" collection="array" open="(" separator="," close=")">
  82. #{id}
  83. </foreach>
  84. </delete>
  85. </mapper>