IbmsDeviceMapper.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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.device.mapper.IbmsDeviceMapper">
  6. <resultMap type="pd" id="IbmsDeviceResult">
  7. <result property="id" column="id" />
  8. <result property="deviceCode" column="device_code" />
  9. <result property="deviceName" column="device_name" />
  10. <result property="deviceType" column="device_type" />
  11. <result property="subsystemType" column="subsystem_type" />
  12. <result property="spaceId" column="space_id" />
  13. <result property="spaceName" column="space_name" />
  14. <result property="brand" column="brand" />
  15. <result property="model" column="model" />
  16. <result property="serialNumber" column="serial_number" />
  17. <result property="manufactureDate" column="manufacture_date" />
  18. <result property="installDate" column="install_date" />
  19. <result property="warrantyPeriod" column="warranty_period" />
  20. <result property="status" column="status" />
  21. <result property="isOnline" column="is_online" />
  22. <result property="description" column="description" />
  23. <result property="createTime" column="create_time" />
  24. <result property="updateTime" column="update_time" />
  25. </resultMap>
  26. <sql id="selectIbmsDeviceVo">
  27. select id, device_code, device_name, device_type, subsystem_type, space_id, space_name, brand, model, serial_number, manufacture_date, install_date, warranty_period, status, is_online, description, create_time, update_time from ibms_device
  28. </sql>
  29. <select id="selectIbmsDeviceList" parameterType="pd" resultMap="IbmsDeviceResult">
  30. <include refid="selectIbmsDeviceVo"/>
  31. <where>
  32. <if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode}</if>
  33. <if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
  34. <if test="deviceType != null and deviceType != ''"> and device_type = #{deviceType}</if>
  35. </where>
  36. </select>
  37. <select id="selectIbmsDeviceById" parameterType="pd" resultMap="IbmsDeviceResult">
  38. <include refid="selectIbmsDeviceVo"/>
  39. where id = #{id}
  40. </select>
  41. <insert id="insertIbmsDevice" parameterType="pd" useGeneratedKeys="true" keyProperty="id">
  42. insert into ibms_device
  43. <trim prefix="(" suffix=")" suffixOverrides=",">
  44. <if test="deviceCode != null and deviceCode != ''">device_code,</if>
  45. <if test="deviceName != null and deviceName != ''">device_name,</if>
  46. <if test="deviceType != null and deviceType != ''">device_type,</if>
  47. <if test="subsystemType != null and subsystemType != ''">subsystem_type,</if>
  48. <if test="spaceId != null and spaceId != ''">space_id,</if>
  49. <if test="spaceName != null and spaceName != ''">space_name,</if>
  50. <if test="brand != null and brand != ''">brand,</if>
  51. <if test="model != null and model != ''">model,</if>
  52. <if test="serialNumber != null and serialNumber != ''">serial_number,</if>
  53. <if test="manufactureDate != null and manufactureDate != ''">manufacture_date,</if>
  54. <if test="installDate != null and installDate != ''">install_date,</if>
  55. <if test="warrantyPeriod != null and warrantyPeriod != ''">warranty_period,</if>
  56. <if test="status != null and status != ''">status,</if>
  57. <if test="isOnline != null and isOnline != ''">is_online,</if>
  58. <if test="description != null and description != ''">description,</if>
  59. <if test="createTime != null and createTime != ''">create_time,</if>
  60. <if test="updateTime != null and updateTime != ''">update_time,</if>
  61. </trim>
  62. <trim prefix="values (" suffix=")" suffixOverrides=",">
  63. <if test="deviceCode != null and deviceCode != ''">#{deviceCode},</if>
  64. <if test="deviceName != null and deviceName != ''">#{deviceName},</if>
  65. <if test="deviceType != null and deviceType != ''">#{deviceType},</if>
  66. <if test="subsystemType != null and subsystemType != ''">#{subsystemType},</if>
  67. <if test="spaceId != null and spaceId != ''">#{spaceId},</if>
  68. <if test="spaceName != null and spaceName != ''">#{spaceName},</if>
  69. <if test="brand != null and brand != ''">#{brand},</if>
  70. <if test="model != null and model != ''">#{model},</if>
  71. <if test="serialNumber != null and serialNumber != ''">#{serialNumber},</if>
  72. <if test="manufactureDate != null and manufactureDate != ''">#{manufactureDate},</if>
  73. <if test="installDate != null and installDate != ''">#{installDate},</if>
  74. <if test="warrantyPeriod != null and warrantyPeriod != ''">#{warrantyPeriod},</if>
  75. <if test="status != null and status != ''">#{status},</if>
  76. <if test="isOnline != null and isOnline != ''">#{isOnline},</if>
  77. <if test="description != null and description != ''">#{description},</if>
  78. <if test="createTime != null and createTime != ''">#{createTime},</if>
  79. <if test="updateTime != null and updateTime != ''">#{updateTime},</if>
  80. </trim>
  81. </insert>
  82. <update id="updateIbmsDevice" parameterType="pd">
  83. update ibms_device
  84. <trim prefix="SET" suffixOverrides=",">
  85. <if test="deviceCode != null and deviceCode != ''">device_code = #{deviceCode},</if>
  86. <if test="deviceName != null and deviceName != ''">device_name = #{deviceName},</if>
  87. <if test="deviceType != null and deviceType != ''">device_type = #{deviceType},</if>
  88. <if test="subsystemType != null and subsystemType != ''">subsystem_type = #{subsystemType},</if>
  89. <if test="spaceId != null and spaceId != ''">space_id = #{spaceId},</if>
  90. <if test="spaceName != null and spaceName != ''">space_name = #{spaceName},</if>
  91. <if test="brand != null and brand != ''">brand = #{brand},</if>
  92. <if test="model != null and model != ''">model = #{model},</if>
  93. <if test="serialNumber != null and serialNumber != ''">serial_number = #{serialNumber},</if>
  94. <if test="manufactureDate != null and manufactureDate != ''">manufacture_date = #{manufactureDate},</if>
  95. <if test="installDate != null and installDate != ''">install_date = #{installDate},</if>
  96. <if test="warrantyPeriod != null and warrantyPeriod != ''">warranty_period = #{warrantyPeriod},</if>
  97. <if test="status != null and status != ''">status = #{status},</if>
  98. <if test="isOnline != null and isOnline != ''">is_online = #{isOnline},</if>
  99. <if test="description != null and description != ''">description = #{description},</if>
  100. <if test="createTime != null and createTime != ''">create_time = #{createTime},</if>
  101. <if test="updateTime != null and updateTime != ''">update_time = #{updateTime},</if>
  102. </trim>
  103. where id = #{id}
  104. </update>
  105. <delete id="deleteIbmsDeviceById" parameterType="Long">
  106. delete from ibms_device where id = #{id}
  107. </delete>
  108. <delete id="deleteIbmsDeviceByIds" parameterType="String">
  109. delete from ibms_device where id in
  110. <foreach item="id" collection="array" open="(" separator="," close=")">
  111. #{id}
  112. </foreach>
  113. </delete>
  114. </mapper>