SensorMapMapper.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  4. <mapper namespace="com.zhyc.xps.goaf.mapper.SensorMapMapper">
  5. <resultMap id="SensorMapMapper" type="com.zhyc.xps.goaf.entity.SensorMap">
  6. <id column="sensor_location_id" property="sensorLocationId" jdbcType="BIGINT"/>
  7. <result column="oc_id" property="ocId" jdbcType="BIGINT"/>
  8. <result column="map_id" property="mapId" jdbcType="BIGINT"/>
  9. <result column="goaf_sensor_id" property="goafSensorId" jdbcType="BIGINT"/>
  10. <result column="goaf_sensor_name" property="goafSensorName" jdbcType="VARCHAR"/>
  11. <result column="sensor_qywzjd" property="sensorQywzjd" jdbcType="DECIMAL"/> <!--传感器部署经度-->
  12. <result column="sensor_qywzwd" property="sensorQywzwd" jdbcType="DECIMAL"/> <!--传感器部署纬度-->
  13. </resultMap>
  14. <select id="getByList" parameterType="java.util.Map" resultMap="SensorMapMapper">
  15. SELECT *
  16. FROM sensor_map
  17. <trim prefix="where" prefixOverrides="AND">
  18. <if test="ocId !=null">
  19. oc_id = #{ocId ,jdbcType=BIGINT}
  20. </if>
  21. <if test="mapId !=null">
  22. map_id = #{mapId ,jdbcType=BIGINT}
  23. </if>
  24. </trim>
  25. </select>
  26. <!--分页查询-->
  27. <select id="getByPage" parameterType="java.util.Map" resultMap="SensorMapMapper">
  28. SELECT *
  29. FROM sensor_map
  30. <trim prefix="where" prefixOverrides="AND">
  31. <if test="ocId !=null">
  32. oc_id = #{ocId ,jdbcType=BIGINT}
  33. </if>
  34. </trim>
  35. </select>
  36. <insert id="create" parameterType="com.zhyc.xps.goaf.entity.SensorMap">
  37. insert into sensor_map
  38. <trim prefix="(" suffix=")" suffixOverrides=",">
  39. <if test="sensorLocationId != null">
  40. sensor_location_id,
  41. </if>
  42. <if test="ocId != null">
  43. oc_id,
  44. </if>
  45. <if test="mapId != null">
  46. map_id,
  47. </if>
  48. <if test="goafSensorId != null">
  49. goaf_sensor_id,
  50. </if>
  51. <if test="goafSensorName != null and goafSensorName != ''">
  52. goaf_sensor_name,
  53. </if>
  54. <if test="sensorQywzjd != null">
  55. sensor_qywzjd,
  56. </if>
  57. <if test="sensorQywzwd != null">
  58. sensor_qywzwd,
  59. </if>
  60. </trim>
  61. <trim prefix="values (" suffix=")" suffixOverrides=",">
  62. <if test="sensorLocationId != null">
  63. #{sensorLocationId, jdbcType=BIGINT},
  64. </if>
  65. <if test="ocId != null">
  66. #{ocId, jdbcType=BIGINT},
  67. </if>
  68. <if test="mapId != null">
  69. #{mapId, jdbcType=BIGINT},
  70. </if>
  71. <if test="goafSensorId != null">
  72. #{goafSensorId, jdbcType=BIGINT},
  73. </if>
  74. <if test="goafSensorName != null and goafSensorName != ''">
  75. #{goafSensorName, jdbcType=VARCHAR},
  76. </if>
  77. <if test="sensorQywzjd != null">
  78. #{sensorQywzjd, jdbcType=DECIMAL},
  79. </if>
  80. <if test="sensorQywzwd != null">
  81. #{sensorQywzwd, jdbcType=DECIMAL},
  82. </if>
  83. </trim>
  84. </insert>
  85. <!--Update更新-->
  86. <update id="update" parameterType="com.zhyc.xps.goaf.entity.SensorMap">
  87. UPDATE sensor_map
  88. <trim suffixOverrides=",">
  89. <set>
  90. <if test="sensorQywzjd != null">
  91. sensor_qywzjd = #{sensorQywzjd, jdbcType=DECIMAL},
  92. </if>
  93. <if test="sensorQywzwd != null">
  94. sensor_qywzwd = #{sensorQywzwd, jdbcType=DECIMAL},
  95. </if>
  96. </set>
  97. </trim>
  98. WHERE sensor_location_id = #{sensorLocationId, jdbcType=BIGINT}
  99. </update>
  100. <delete id="delete" >
  101. DELETE FROM sensor_map
  102. WHERE sensor_location_id = #{sensorLocationId, jdbcType=BIGINT}
  103. </delete>
  104. </mapper>