123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.bosshand.virgo.ringzle.dao.IotEntityBimRuleDao">
- <resultMap type="com.bosshand.virgo.ringzle.model.IotEntityBimRule" id="iotEntityBimRuleResult">
- <id column="id" property="id"/>
- <result column="name" property="name"/>
- <result column="state" property="state"/>
- <result column="comment" property="comment"/>
- <result column="attributeValue" property="attributeValue"/>
- <result column="type" property="type"/>
- <result column="chartType" property="chartType"/>
- <result column="data" property="data"/>
- <result column="iotEntityId" property="iotEntityId"/>
- <association property="ruleConditions" resultMap="com.bosshand.virgo.ringzle.dao.RuleConditionDao.ruleConditionResult" columnPrefix="ruleCondition_"/>
- </resultMap>
- <insert id="save" parameterType="com.bosshand.virgo.ringzle.model.IotEntityBimRule" useGeneratedKeys="true" keyProperty="id">
- INSERT INTO iot_entity_bim_rule (iotEntityId,name,state,comment,attributeValue,type,chartType,data) VALUES
- (#{iotEntityId},#{name},#{state},#{comment},#{attributeValue},#{type},#{chartType},#{data})
- </insert>
- <sql id="query">
- select a.*,
- b.ruleId as ruleCondition_ruleId,
- b.elementIds as ruleCondition_elementIds,
- b.color as ruleCondition_color,
- b.lineColor as ruleCondition_lineColor,
- b.image as ruleCondition_image,
- b.propertyName as ruleCondition_propertyName,
- b.propertyValue as ruleCondition_propertyValue,
- b.factor as ruleCondition_factor
- from iot_entity_bim_rule a
- left join iot_entity_bim_rule_condition b on a.id = b.ruleId
- </sql>
- <select id="getList" resultMap="iotEntityBimRuleResult">
- <include refid="query" />
- <where>
- <if test="id != 0">
- and a.id =#{id}
- </if>
- <if test="name != null">
- and a.name =#{name}
- </if>
- <if test="state != null">
- and a.state =#{state}
- </if>
- <if test="iotEntityId != null">
- and a.iotEntityId =#{iotEntityId}
- </if>
- </where>
- </select>
- <select id="getIotEntityId" resultMap="iotEntityBimRuleResult">
- <include refid="query" />
- where a.iotEntityId =#{iotEntityId} and a.state = 1
- </select>
- <update id="update">
- update iot_entity_bim_rule
- <trim prefix="set" suffixOverrides=",">
- <if test="name!=null">name=#{name},</if>
- <if test="state!=null">state=#{state},</if>
- <if test="comment!=null">comment=#{comment},</if>
- <if test="iotEntityId!=null">iotEntityId=#{iotEntityId},</if>
- <if test="attributeValue!=null">attributeValue=#{attributeValue},</if>
- <if test="type!=0">type=#{type},</if>
- <if test="chartType!=0">chartType=#{chartType},</if>
- <if test="data!=null">data=#{data},</if>
- </trim>
- where id=#{id}
- </update>
- <delete id="delete">
- delete FROM iot_entity_bim_rule where id=#{id}
- </delete>
- </mapper>
|