houzhongjian
2024-07-23 a6de490948278991e47952e90671ddba4555e9a2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?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>