| | |
| | | <resultMap id="BaseResultMap" type="com.moral.api.entity.Sensor"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="sensor_key" property="sensorKey" /> |
| | | <result column="unit" property="unit" /> |
| | | <result column="upper" property="upper" /> |
| | | <result column="lower" property="lower" /> |
| | | <result column="desc" property="desc" /> |
| | | <result column="code" property="code" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="is_delete" property="isDelete" /> |
| | | <result column="desc" property="desc" /> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | s.id,s.name,s.sensor_key,s.unit,s.upper,s.lower,s.create_time,s.update_time,s.id_delete,s.desc |
| | | s.id,s.name,s.code,s.desc,s.create_time,s.update_time,s.is_delete |
| | | </sql> |
| | | |
| | | <insert id="insertOne" parameterType="com.moral.api.entity.Sensor"> |
| | |
| | | <if test="name != null"> |
| | | name, |
| | | </if> |
| | | <if test="sensorKey != null"> |
| | | sensor_key, |
| | | </if> |
| | | <if test="unit != null"> |
| | | unit, |
| | | </if> |
| | | <if test="upper != null"> |
| | | upper, |
| | | </if> |
| | | <if test="lower != null"> |
| | | lower, |
| | | <if test="code != null"> |
| | | code, |
| | | </if> |
| | | <if test="desc != null"> |
| | | `desc`, |
| | |
| | | <if test="name != null"> |
| | | #{name}, |
| | | </if> |
| | | <if test="sensorKey != null"> |
| | | #{sensorKey}, |
| | | </if> |
| | | <if test="unit != null"> |
| | | #{unit}, |
| | | </if> |
| | | <if test="upper != null"> |
| | | #{upper}, |
| | | </if> |
| | | <if test="lower != null"> |
| | | #{lower}, |
| | | <if test="code != null"> |
| | | #{code}, |
| | | </if> |
| | | <if test="desc != null"> |
| | | #{desc}, |
| | |
| | | </trim> |
| | | </insert> |
| | | |
| | | <select id="getSensorById" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"></include> |
| | | from sensor s |
| | | where s.id = #{id} |
| | | and s.is_delete = 0 |
| | | </select> |
| | | |
| | | <update id="updateSensor" parameterType="java.util.Map"> |
| | | update sensor |
| | | <set> |
| | | <if test="name != null"> |
| | | name = #{name}, |
| | | </if> |
| | | <if test="desc != null"> |
| | | `desc` = #{desc}, |
| | | </if> |
| | | <if test="code != null"> |
| | | code = #{code}, |
| | | </if> |
| | | <if test="isDelete != null"> |
| | | is_delete = #{isDelete}, |
| | | </if> |
| | | </set> |
| | | where id = #{id} |
| | | </update> |
| | | </mapper> |