IbmsDeviceControlLogMapper.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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.pm.control.mapper.IbmsDeviceControlLogMapper">
  6. <resultMap type="pd" id="IbmsDeviceControlLogResult">
  7. <result property="id" column="id" />
  8. <result property="deviceId" column="device_id" />
  9. <result property="pointId" column="point_id" />
  10. <result property="controlType" column="control_type" />
  11. <result property="oldValue" column="old_value" />
  12. <result property="newValue" column="new_value" />
  13. <result property="controlResult" column="control_result" />
  14. <result property="operatorId" column="operator_id" />
  15. <result property="operatorName" column="operator_name" />
  16. <result property="operateTime" column="operate_time" />
  17. <result property="remark" column="remark" />
  18. <result property="createTime" column="create_time" />
  19. </resultMap>
  20. <sql id="selectIbmsDeviceControlLogVo">
  21. select id, device_id, point_id, control_type, old_value, new_value, control_result, operator_id, operator_name, operate_time, remark, create_time from ibms_device_control_log
  22. </sql>
  23. <select id="selectIbmsDeviceControlLogList" parameterType="pd" resultMap="IbmsDeviceControlLogResult">
  24. <include refid="selectIbmsDeviceControlLogVo"/>
  25. <where>
  26. <if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
  27. <if test="pointId != null and pointId != ''"> and point_id = #{pointId}</if>
  28. <if test="controlType != null and controlType != ''"> and control_type = #{controlType}</if>
  29. <if test="controlResult != null and controlResult != ''"> and control_result = #{controlResult}</if>
  30. <if test="operatorName != null and operatorName != ''"> and operator_name like concat('%', #{operatorName}, '%')</if>
  31. </where>
  32. </select>
  33. <select id="selectIbmsDeviceControlLogById" parameterType="pd" resultMap="IbmsDeviceControlLogResult">
  34. <include refid="selectIbmsDeviceControlLogVo"/>
  35. where id = #{id}
  36. </select>
  37. <insert id="insertIbmsDeviceControlLog" parameterType="pd" useGeneratedKeys="true" keyProperty="id">
  38. insert into ibms_device_control_log
  39. <trim prefix="(" suffix=")" suffixOverrides=",">
  40. <if test="deviceId != null and deviceId != ''">device_id,</if>
  41. <if test="pointId != null and pointId != ''">point_id,</if>
  42. <if test="controlType != null and controlType != ''">control_type,</if>
  43. <if test="oldValue != null and oldValue != ''">old_value,</if>
  44. <if test="newValue != null and newValue != ''">new_value,</if>
  45. <if test="controlResult != null and controlResult != ''">control_result,</if>
  46. <if test="operatorId != null and operatorId != ''">operator_id,</if>
  47. <if test="operatorName != null and operatorName != ''">operator_name,</if>
  48. <if test="operateTime != null and operateTime != ''">operate_time,</if>
  49. <if test="remark != null and remark != ''">remark,</if>
  50. <if test="createTime != null and createTime != ''">create_time,</if>
  51. </trim>
  52. <trim prefix="values (" suffix=")" suffixOverrides=",">
  53. <if test="deviceId != null and deviceId != ''">#{deviceId},</if>
  54. <if test="pointId != null and pointId != ''">#{pointId},</if>
  55. <if test="controlType != null and controlType != ''">#{controlType},</if>
  56. <if test="oldValue != null and oldValue != ''">#{oldValue},</if>
  57. <if test="newValue != null and newValue != ''">#{newValue},</if>
  58. <if test="controlResult != null and controlResult != ''">#{controlResult},</if>
  59. <if test="operatorId != null and operatorId != ''">#{operatorId},</if>
  60. <if test="operatorName != null and operatorName != ''">#{operatorName},</if>
  61. <if test="operateTime != null and operateTime != ''">#{operateTime},</if>
  62. <if test="remark != null and remark != ''">#{remark},</if>
  63. <if test="createTime != null and createTime != ''">#{createTime},</if>
  64. </trim>
  65. </insert>
  66. <update id="updateIbmsDeviceControlLog" parameterType="pd">
  67. update ibms_device_control_log
  68. <trim prefix="SET" suffixOverrides=",">
  69. <if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
  70. <if test="pointId != null and pointId != ''">point_id = #{pointId},</if>
  71. <if test="controlType != null and controlType != ''">control_type = #{controlType},</if>
  72. <if test="oldValue != null and oldValue != ''">old_value = #{oldValue},</if>
  73. <if test="newValue != null and newValue != ''">new_value = #{newValue},</if>
  74. <if test="controlResult != null and controlResult != ''">control_result = #{controlResult},</if>
  75. <if test="operatorId != null and operatorId != ''">operator_id = #{operatorId},</if>
  76. <if test="operatorName != null and operatorName != ''">operator_name = #{operatorName},</if>
  77. <if test="operateTime != null and operateTime != ''">operate_time = #{operateTime},</if>
  78. <if test="remark != null and remark != ''">remark = #{remark},</if>
  79. <if test="createTime != null and createTime != ''">create_time = #{createTime},</if>
  80. </trim>
  81. where id = #{id}
  82. </update>
  83. <delete id="deleteIbmsDeviceControlLogById" parameterType="Long">
  84. delete from ibms_device_control_log where id = #{id}
  85. </delete>
  86. <delete id="deleteIbmsDeviceControlLogByIds" parameterType="String">
  87. delete from ibms_device_control_log where id in
  88. <foreach item="id" collection="array" open="(" separator="," close=")">
  89. #{id}
  90. </foreach>
  91. </delete>
  92. </mapper>