12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <!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.SensorComponentGroupsDao">
- <resultMap type="com.bosshand.virgo.ringzle.model.SensorComponentGroups" id="sensorComponentGroupsResult">
- <id column="id" property="id"/>
- <result column="name" property="name"/>
- <result column="integrateId" property="integrateId"/>
- <collection property="componentSet" ofType="com.bosshand.virgo.ringzle.model.SensorComponentSet" resultMap="com.bosshand.virgo.ringzle.dao.SensorComponentSetDao.sensorComponentSetResult" columnPrefix="sensorComponentSet_"/>
- </resultMap>
- <insert id="save" parameterType="com.bosshand.virgo.ringzle.model.SensorComponentGroups" useGeneratedKeys="true" keyProperty="id">
- INSERT INTO sensor_component_groups (name,integrateId) VALUES (#{name},#{integrateId})
- </insert>
- <sql id="query">
- select s.*,
- sc.id as sensorComponentSet_id,
- sc.componentId as sensorComponentSet_componentId,
- sc.componentName as sensorComponentSet_componentName,
- sc.componentGroupId as sensorComponentSet_componentGroupId
- from sensor_component_groups s left join sensor_component_set sc on s.id = sc.componentGroupId
- </sql>
- <select id="getList" resultMap="sensorComponentGroupsResult">
- <include refid="query" />
- <where>
- <if test="id != 0">
- and s.id = #{id}
- </if>
- <if test="name != null">
- and s.name = #{name}
- </if>
- <if test="integrateId != null">
- and s.integrateId = #{integrateId}
- </if>
- </where>
- </select>
- <update id="update">
- update sensor_component_groups set name =#{name},integrateId =#{integrateId} where id=#{id}
- </update>
- <delete id="delete">
- delete FROM sensor_component_groups where id=#{id}
- </delete>
- </mapper>
|