ConfigStationChannelMapper.xml 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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.ufo.project.config.mapper.ConfigStationChannelMapper">
  6. <resultMap type="ConfigStationChannel" id="ConfigStationChannelResult">
  7. <result property="id" column="id" />
  8. <result property="stationId" column="station_id" />
  9. <result property="stationName" column="station_name" />
  10. <result property="channelName" column="channel_name" />
  11. <result property="protocol" column="protocol" />
  12. <result property="host" column="host" />
  13. <result property="port" column="port" />
  14. <result property="collectInterval" column="collect_interval" />
  15. <result property="dataType" column="data_type" />
  16. <result property="status" column="status" />
  17. <result property="lastSyncTime" column="last_sync_time" />
  18. <result property="createBy" column="create_by" />
  19. <result property="createTime" column="create_time" />
  20. <result property="updateBy" column="update_by" />
  21. <result property="updateTime" column="update_time" />
  22. <result property="remark" column="remark" />
  23. </resultMap>
  24. <sql id="selectConfigStationChannelVo">
  25. select t.id, t.station_id, s.station_name, t.channel_name, t.protocol, t.host, t.port, t.collect_interval, t.data_type, t.status, t.last_sync_time, t.create_by, t.create_time, t.update_by, t.update_time, t.remark from config_station_channel t left join config_station s on s.id = t.station_id
  26. </sql>
  27. <select id="selectConfigStationChannelList" parameterType="ConfigStationChannel" resultMap="ConfigStationChannelResult">
  28. <include refid="selectConfigStationChannelVo"/>
  29. <where>
  30. <if test="stationId != null"> and t.station_id = #{stationId}</if>
  31. <if test="channelName != null and channelName != ''"> and t.channel_name like concat('%', #{channelName}, '%')</if>
  32. <if test="protocol != null"> and t.protocol = #{protocol}</if>
  33. <if test="host != null and host != ''"> and t.host like concat('%', #{host}, '%')</if>
  34. <if test="port != null"> and t.port = #{port}</if>
  35. <if test="dataType != null and dataType != ''"> and t.data_type like concat('%', #{dataType}, '%')</if>
  36. <if test="status != null"> and t.status = #{status}</if>
  37. </where>
  38. order by t.id desc
  39. </select>
  40. <select id="selectConfigStationChannelById" parameterType="Long" resultMap="ConfigStationChannelResult">
  41. <include refid="selectConfigStationChannelVo"/>
  42. where t.id = #{id}
  43. </select>
  44. <insert id="insertConfigStationChannel" parameterType="ConfigStationChannel" useGeneratedKeys="true" keyProperty="id">
  45. insert into config_station_channel (station_id, channel_name, protocol, host, port, collect_interval, data_type, status, last_sync_time, create_by, create_time, update_by, update_time, remark)
  46. values (#{stationId}, #{channelName}, #{protocol}, #{host}, #{port}, #{collectInterval}, #{dataType}, #{status}, #{lastSyncTime}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{remark})
  47. </insert>
  48. <update id="updateConfigStationChannel" parameterType="ConfigStationChannel">
  49. update config_station_channel
  50. <trim prefix="SET" suffixOverrides=",">
  51. <if test="stationId != null">station_id = #{stationId},</if>
  52. <if test="channelName != null">channel_name = #{channelName},</if>
  53. <if test="protocol != null">protocol = #{protocol},</if>
  54. <if test="host != null">host = #{host},</if>
  55. <if test="port != null">port = #{port},</if>
  56. <if test="collectInterval != null">collect_interval = #{collectInterval},</if>
  57. <if test="dataType != null">data_type = #{dataType},</if>
  58. <if test="status != null">status = #{status},</if>
  59. <if test="lastSyncTime != null">last_sync_time = #{lastSyncTime},</if>
  60. <if test="updateBy != null">update_by = #{updateBy},</if>
  61. <if test="updateTime != null">update_time = #{updateTime},</if>
  62. <if test="remark != null">remark = #{remark},</if>
  63. </trim>
  64. where id = #{id}
  65. </update>
  66. <delete id="deleteConfigStationChannelById" parameterType="Long">
  67. delete from config_station_channel where id = #{id}
  68. </delete>
  69. <delete id="deleteConfigStationChannelByIds" parameterType="Long">
  70. delete from config_station_channel where id in
  71. <foreach item="id" collection="array" open="(" separator="," close=")">
  72. #{id}
  73. </foreach>
  74. </delete>
  75. </mapper>