DeviceMeasuringPointMapper.xml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.zcxk.smartcity.data.access.dao.DeviceMeasuringPointMapper">
  4. <!--auto generated Code-->
  5. <resultMap id="BaseResultMap" type="com.zcxk.smartcity.data.access.entity.DeviceMeasuringPoint">
  6. <result column="id" property="id" jdbcType="INTEGER"/>
  7. <result column="measuring_point_name" property="measuringPointName" jdbcType="VARCHAR"/>
  8. <result column="code_name" property="codeName" jdbcType="VARCHAR"/>
  9. <result column="data_unit" property="dataUnit" jdbcType="VARCHAR"/>
  10. <result column="measuring_point_type" property="measuringPointType" jdbcType="INTEGER"/>
  11. <result column="status" property="status" jdbcType="INTEGER"/>
  12. <result column="create_date" property="createDate" jdbcType="TIMESTAMP"/>
  13. <result column="create_by" property="createBy" jdbcType="VARCHAR"/>
  14. <result column="update_date" property="updateDate" jdbcType="TIMESTAMP"/>
  15. <result column="update_by" property="updateBy" jdbcType="VARCHAR"/>
  16. </resultMap>
  17. <!--auto generated Code-->
  18. <sql id="Base_Column_List">
  19. id,
  20. measuring_point_name,
  21. code_name,
  22. data_unit,
  23. measuring_point_type,
  24. status,
  25. create_date,
  26. create_by,
  27. update_date,
  28. update_by
  29. </sql>
  30. <!--auto generated Code-->
  31. <insert id="insert" useGeneratedKeys="true" keyProperty="deviceMeasuringPoint.id">
  32. INSERT INTO sc_device_measuring_point (
  33. id,
  34. measuring_point_name,
  35. code_name,
  36. data_unit,
  37. measuring_point_type,
  38. status,
  39. create_date,
  40. create_by,
  41. update_date,
  42. update_by
  43. ) VALUES (
  44. #{deviceMeasuringPoint.id,jdbcType=INTEGER},
  45. #{deviceMeasuringPoint.measuringPointName,jdbcType=VARCHAR},
  46. #{deviceMeasuringPoint.codeName,jdbcType=VARCHAR},
  47. #{deviceMeasuringPoint.dataUnit,jdbcType=VARCHAR},
  48. #{deviceMeasuringPoint.measuringPointType,jdbcType=INTEGER},
  49. #{deviceMeasuringPoint.status,jdbcType=INTEGER},
  50. #{deviceMeasuringPoint.createDate,jdbcType=TIMESTAMP},
  51. #{deviceMeasuringPoint.createBy,jdbcType=VARCHAR},
  52. #{deviceMeasuringPoint.updateDate,jdbcType=TIMESTAMP},
  53. #{deviceMeasuringPoint.updateBy,jdbcType=VARCHAR}
  54. )
  55. </insert>
  56. <!--auto generated Code-->
  57. <insert id="insertSelective" useGeneratedKeys="true" keyProperty="deviceMeasuringPoint.id">
  58. INSERT INTO sc_device_measuring_point
  59. <trim prefix="(" suffix=")" suffixOverrides=",">
  60. <if test="deviceMeasuringPoint.id!=null"> id,</if>
  61. <if test="deviceMeasuringPoint.measuringPointName!=null"> measuring_point_name,</if>
  62. <if test="deviceMeasuringPoint.codeName!=null"> code_name,</if>
  63. <if test="deviceMeasuringPoint.dataUnit!=null"> data_unit,</if>
  64. <if test="deviceMeasuringPoint.measuringPointType!=null"> measuring_point_type,</if>
  65. <if test="deviceMeasuringPoint.status!=null"> status,</if>
  66. <if test="deviceMeasuringPoint.createDate!=null"> create_date,</if>
  67. <if test="deviceMeasuringPoint.createBy!=null"> create_by,</if>
  68. <if test="deviceMeasuringPoint.updateDate!=null"> update_date,</if>
  69. <if test="deviceMeasuringPoint.updateBy!=null"> update_by,</if>
  70. </trim>
  71. VALUES
  72. <trim prefix="(" suffix=")" suffixOverrides=",">
  73. <if test="deviceMeasuringPoint.id!=null">#{deviceMeasuringPoint.id,jdbcType=INTEGER},
  74. </if>
  75. <if test="deviceMeasuringPoint.measuringPointName!=null">#{deviceMeasuringPoint.measuringPointName,jdbcType=VARCHAR},
  76. </if>
  77. <if test="deviceMeasuringPoint.codeName!=null">#{deviceMeasuringPoint.codeName,jdbcType=VARCHAR},
  78. </if>
  79. <if test="deviceMeasuringPoint.dataUnit!=null">#{deviceMeasuringPoint.dataUnit,jdbcType=VARCHAR},
  80. </if>
  81. <if test="deviceMeasuringPoint.measuringPointType!=null">#{deviceMeasuringPoint.measuringPointType,jdbcType=INTEGER},
  82. </if>
  83. <if test="deviceMeasuringPoint.status!=null">#{deviceMeasuringPoint.status,jdbcType=INTEGER},
  84. </if>
  85. <if test="deviceMeasuringPoint.createDate!=null">#{deviceMeasuringPoint.createDate,jdbcType=TIMESTAMP},
  86. </if>
  87. <if test="deviceMeasuringPoint.createBy!=null">#{deviceMeasuringPoint.createBy,jdbcType=VARCHAR},
  88. </if>
  89. <if test="deviceMeasuringPoint.updateDate!=null">#{deviceMeasuringPoint.updateDate,jdbcType=TIMESTAMP},
  90. </if>
  91. <if test="deviceMeasuringPoint.updateBy!=null">#{deviceMeasuringPoint.updateBy,jdbcType=VARCHAR},
  92. </if>
  93. </trim>
  94. </insert>
  95. <!--auto generated Code-->
  96. <insert id="insertList">
  97. INSERT INTO sc_device_measuring_point (
  98. id,
  99. measuring_point_name,
  100. code_name,
  101. data_unit,
  102. measuring_point_type,
  103. status,
  104. create_date,
  105. create_by,
  106. update_date,
  107. update_by
  108. )VALUES
  109. <foreach collection="deviceMeasuringPoints" item="deviceMeasuringPoint" index="index" separator=",">
  110. (
  111. #{deviceMeasuringPoint.id,jdbcType=INTEGER},
  112. #{deviceMeasuringPoint.measuringPointName,jdbcType=VARCHAR},
  113. #{deviceMeasuringPoint.codeName,jdbcType=VARCHAR},
  114. #{deviceMeasuringPoint.dataUnit,jdbcType=VARCHAR},
  115. #{deviceMeasuringPoint.measuringPointType,jdbcType=INTEGER},
  116. #{deviceMeasuringPoint.status,jdbcType=INTEGER},
  117. #{deviceMeasuringPoint.createDate,jdbcType=TIMESTAMP},
  118. #{deviceMeasuringPoint.createBy,jdbcType=VARCHAR},
  119. #{deviceMeasuringPoint.updateDate,jdbcType=TIMESTAMP},
  120. #{deviceMeasuringPoint.updateBy,jdbcType=VARCHAR}
  121. )
  122. </foreach>
  123. </insert>
  124. <!--auto generated Code-->
  125. <update id="updateByPrimaryKeySelective">
  126. UPDATE sc_device_measuring_point
  127. <set>
  128. <if test="deviceMeasuringPoint.measuringPointName != null"> measuring_point_name= #{deviceMeasuringPoint.measuringPointName,jdbcType=VARCHAR},</if>
  129. <if test="deviceMeasuringPoint.codeName != null"> code_name= #{deviceMeasuringPoint.codeName,jdbcType=VARCHAR},</if>
  130. <if test="deviceMeasuringPoint.dataUnit != null"> data_unit= #{deviceMeasuringPoint.dataUnit,jdbcType=VARCHAR},</if>
  131. <if test="deviceMeasuringPoint.measuringPointType != null"> measuring_point_type= #{deviceMeasuringPoint.measuringPointType,jdbcType=INTEGER},</if>
  132. <if test="deviceMeasuringPoint.status != null"> status= #{deviceMeasuringPoint.status,jdbcType=INTEGER},</if>
  133. <if test="deviceMeasuringPoint.createDate != null"> create_date= #{deviceMeasuringPoint.createDate,jdbcType=TIMESTAMP},</if>
  134. <if test="deviceMeasuringPoint.createBy != null"> create_by= #{deviceMeasuringPoint.createBy,jdbcType=VARCHAR},</if>
  135. <if test="deviceMeasuringPoint.updateDate != null"> update_date= #{deviceMeasuringPoint.updateDate,jdbcType=TIMESTAMP},</if>
  136. <if test="deviceMeasuringPoint.updateBy != null"> update_by= #{deviceMeasuringPoint.updateBy,jdbcType=VARCHAR}</if>
  137. </set>
  138. WHERE id = #{deviceMeasuringPoint.id,jdbcType=INTEGER}
  139. </update>
  140. <select id="findByDeviceTypeId" resultMap="BaseResultMap">
  141. SELECT
  142. measuring_id as id,
  143. measuring_code as code_name ,
  144. measuring_unit as data_unit,
  145. measuring_name as measuring_point_name
  146. FROM
  147. sc_tpl_measuring_desc
  148. WHERE
  149. device_type = #{deviceTypeId}
  150. AND `status` = 1
  151. </select>
  152. <select id="findByCodeAndName" resultMap="BaseResultMap">
  153. select
  154. <include refid="Base_Column_List" />
  155. from
  156. sc_device_measuring_point
  157. where status = 1
  158. and measuring_point_name = #{name}
  159. and code_name = #{code}
  160. </select>
  161. </mapper>