SensorStainingRulesMapper.xml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <!DOCTYPE mapper
  2. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.bosshand.virgo.ringzle.dao.SensorStainingRulesDao">
  5. <resultMap type="com.bosshand.virgo.ringzle.model.SensorStainingRules" id="sensorStainingRulesResult">
  6. <id column="id" property="id"/>
  7. <result column="rulesName" property="rulesName"/>
  8. <association property="condition" resultMap="com.bosshand.virgo.ringzle.dao.SensorStainingRulesConditionDao.sensorStainingRulesConditionResult" columnPrefix="sensorStainingRulesCondition_"/>
  9. <association property="action" resultMap="com.bosshand.virgo.ringzle.dao.SensorStainingRulesActionDao.sensorStainingRulesActionResult" columnPrefix="sensorStainingRulesAction_"/>
  10. </resultMap>
  11. <insert id="save" parameterType="com.bosshand.virgo.ringzle.model.SensorStainingRules" useGeneratedKeys="true" keyProperty="id">
  12. INSERT INTO sensor_staining_rules (rulesName) VALUES (#{rulesName})
  13. </insert>
  14. <sql id="query">
  15. select ssr.*,
  16. ssrc.id as sensorStainingRulesCondition_id,
  17. ssrc.sensorId as sensorStainingRulesCondition_sensorId,
  18. ssrc.sensorPhysicalQuantityId as sensorStainingRulesCondition_sensorPhysicalQuantityId,
  19. ssrc.sensorPhysicalQuantityValue as sensorStainingRulesCondition_sensorPhysicalQuantityValue,
  20. ssrc.sensorStainingRulesId as sensorStainingRulesCondition_sensorStainingRulesId,
  21. ssra.id as sensorStainingRulesAction_id,
  22. ssra.sensorStainingRulesId as sensorStainingRulesAction_sensorStainingRulesId,
  23. ssra.color as sensorStainingRulesAction_color
  24. from sensor_staining_rules ssr
  25. left join sensor_staining_rules_condition ssrc on ssr.id = ssrc.sensorStainingRulesId
  26. left join sensor_staining_rules_action ssra on ssr.id = ssra.sensorStainingRulesId
  27. </sql>
  28. <select id="getList" resultMap="sensorStainingRulesResult">
  29. <include refid="query" />
  30. </select>
  31. <select id="get" resultMap="sensorStainingRulesResult">
  32. <include refid="query" />
  33. where ssr.id = #{id}
  34. </select>
  35. <update id="update">
  36. update sensor_staining_rules set rulesName = #{rulesName} where id = #{id}
  37. </update>
  38. <delete id="delete">
  39. delete FROM sensor_staining_rules where id=#{id}
  40. </delete>
  41. </mapper>