TwinDeviceRzMapper.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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.jjt.rz.mapper.TwinDeviceRzMapper">
  6. <resultMap type="TwinDeviceRz" id="TwinDeviceRzResult">
  7. <result property="deviceId" column="DEVICE_ID" />
  8. <result property="wsName" column="WS_NAME" />
  9. <result property="line" column="LINE" />
  10. <result property="typeId" column="TYPE_ID" />
  11. <result property="typeName" column="TYPE_NAME" />
  12. <result property="deviceCode" column="DEVICE_CODE" />
  13. <result property="deviceName" column="DEVICE_NAME" />
  14. <result property="devicePath" column="DEVICE_PATH" />
  15. <result property="createdBy" column="CREATED_BY" />
  16. <result property="createdTime" column="CREATED_TIME" />
  17. <result property="updatedBy" column="UPDATED_BY" />
  18. <result property="updatedTime" column="UPDATED_TIME" />
  19. <result property="remark" column="REMARK" />
  20. </resultMap>
  21. <sql id="selectTwinDeviceRzVo">
  22. select DEVICE_ID, WS_NAME, LINE, TYPE_ID, TYPE_NAME, DEVICE_CODE, DEVICE_NAME, DEVICE_PATH, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, REMARK from TWIN_DEVICE_RZ
  23. </sql>
  24. <select id="selectTwinDeviceRzList" parameterType="TwinDeviceRz" resultMap="TwinDeviceRzResult">
  25. <include refid="selectTwinDeviceRzVo"/>
  26. <where>
  27. <if test="wsName != null and wsName != ''"> and WS_NAME like concat('%', #{wsName}, '%')</if>
  28. <if test="line != null and line != ''"> and LINE = #{line}</if>
  29. <if test="typeId != null "> and TYPE_ID = #{typeId}</if>
  30. <if test="typeName != null and typeName != ''"> and TYPE_NAME = #{typeName}</if>
  31. <if test="deviceCode != null and deviceCode != ''"> and DEVICE_CODE = #{deviceCode}</if>
  32. <if test="deviceName != null and deviceName != ''"> and DEVICE_NAME like concat('%', #{deviceName}, '%')</if>
  33. <if test="devicePath != null and devicePath != ''"> and DEVICE_PATH = #{devicePath}</if>
  34. <if test="createdBy != null and createdBy != ''"> and CREATED_BY = #{createdBy}</if>
  35. <if test="createdTime != null "> and CREATED_TIME = #{createdTime}</if>
  36. <if test="updatedBy != null and updatedBy != ''"> and UPDATED_BY = #{updatedBy}</if>
  37. <if test="updatedTime != null "> and UPDATED_TIME = #{updatedTime}</if>
  38. <if test="remark != null and remark != ''"> and REMARK = #{remark}</if>
  39. </where>
  40. </select>
  41. <select id="selectTwinDeviceRzByDeviceId" parameterType="Long" resultMap="TwinDeviceRzResult">
  42. <include refid="selectTwinDeviceRzVo"/>
  43. where DEVICE_ID = #{deviceId}
  44. </select>
  45. <insert id="insertTwinDeviceRz" parameterType="TwinDeviceRz" useGeneratedKeys="true" keyProperty="deviceId">
  46. insert into TWIN_DEVICE_RZ
  47. <trim prefix="(" suffix=")" suffixOverrides=",">
  48. <if test="wsName != null">WS_NAME,</if>
  49. <if test="line != null">LINE,</if>
  50. <if test="typeId != null">TYPE_ID,</if>
  51. <if test="typeName != null">TYPE_NAME,</if>
  52. <if test="deviceCode != null">DEVICE_CODE,</if>
  53. <if test="deviceName != null">DEVICE_NAME,</if>
  54. <if test="devicePath != null">DEVICE_PATH,</if>
  55. <if test="createdBy != null">CREATED_BY,</if>
  56. <if test="createdTime != null">CREATED_TIME,</if>
  57. <if test="updatedBy != null">UPDATED_BY,</if>
  58. <if test="updatedTime != null">UPDATED_TIME,</if>
  59. <if test="remark != null">REMARK,</if>
  60. </trim>
  61. <trim prefix="values (" suffix=")" suffixOverrides=",">
  62. <if test="wsName != null">#{wsName},</if>
  63. <if test="line != null">#{line},</if>
  64. <if test="typeId != null">#{typeId},</if>
  65. <if test="typeName != null">#{typeName},</if>
  66. <if test="deviceCode != null">#{deviceCode},</if>
  67. <if test="deviceName != null">#{deviceName},</if>
  68. <if test="devicePath != null">#{devicePath},</if>
  69. <if test="createdBy != null">#{createdBy},</if>
  70. <if test="createdTime != null">#{createdTime},</if>
  71. <if test="updatedBy != null">#{updatedBy},</if>
  72. <if test="updatedTime != null">#{updatedTime},</if>
  73. <if test="remark != null">#{remark},</if>
  74. </trim>
  75. </insert>
  76. <update id="updateTwinDeviceRz" parameterType="TwinDeviceRz">
  77. update TWIN_DEVICE_RZ
  78. <trim prefix="SET" suffixOverrides=",">
  79. <if test="wsName != null">WS_NAME = #{wsName},</if>
  80. <if test="line != null">LINE = #{line},</if>
  81. <if test="typeId != null">TYPE_ID = #{typeId},</if>
  82. <if test="typeName != null">TYPE_NAME = #{typeName},</if>
  83. <if test="deviceCode != null">DEVICE_CODE = #{deviceCode},</if>
  84. <if test="deviceName != null">DEVICE_NAME = #{deviceName},</if>
  85. <if test="devicePath != null">DEVICE_PATH = #{devicePath},</if>
  86. <if test="createdBy != null">CREATED_BY = #{createdBy},</if>
  87. <if test="createdTime != null">CREATED_TIME = #{createdTime},</if>
  88. <if test="updatedBy != null">UPDATED_BY = #{updatedBy},</if>
  89. <if test="updatedTime != null">UPDATED_TIME = #{updatedTime},</if>
  90. <if test="remark != null">REMARK = #{remark},</if>
  91. </trim>
  92. where DEVICE_ID = #{deviceId}
  93. </update>
  94. <delete id="deleteTwinDeviceRzByDeviceId" parameterType="Long">
  95. delete from TWIN_DEVICE_RZ where DEVICE_ID = #{deviceId}
  96. </delete>
  97. <delete id="deleteTwinDeviceRzByDeviceIds" parameterType="String">
  98. delete from TWIN_DEVICE_RZ where DEVICE_ID in
  99. <foreach item="deviceId" collection="array" open="(" separator="," close=")">
  100. #{deviceId}
  101. </foreach>
  102. </delete>
  103. </mapper>