<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.iailab.module.device.dao.DeviceHealthStateDao"> <resultMap type="com.iailab.module.device.entity.DeviceHealthStateEntity" id="deviceHealthStateMap"> <result property="id" column="id"/> <result property="totalCount" column="total_count"/> <result property="normal" column="normal"/> <result property="common" column="common"/> <result property="heavy" column="heavy"/> <result property="serious" column="serious"/> <result property="espserious" column="espSerious"/> <result property="creatorDate" column="creator_date"/> </resultMap> <insert id="insertHealthState" parameterType="map"> insert into `t_device_health_state` (`total_count`, `normal`, `common`, `heavy`, `serious`, `espserious`, `creator_date`) VALUES (#{total_count}, #{normal}, #{common}, #{heavy}, #{serious}, #{espSerious}, SYSDATE()) </insert> <update id="updateHealthState" parameterType="map"> update t_device_health_state set total_count = #{total_count}, normal = #{normal}, common = #{common}, heavy = #{heavy}, serious = #{serious}, espserious = #{espSerious}, creator_date = SYSDATE() where id = #{id} </update> <select id="getId" resultType="java.lang.Integer"> select IF(count(1),id,0) from t_device_health_state group by id </select> </mapper>