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
<?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.DeviceRunStateDao">
 
    <resultMap type="com.iailab.module.device.entity.DeviceRunStateEntity" id="deviceRunStateMap">
        <result property="id" column="id"/>
        <result property="totalCount" column="total_count"/>
        <result property="runCount" column="run_count"/>
        <result property="haltCount" column="halt_count"/>
        <result property="offlineCount" column="offline_count"/>
        <result property="creatorDate" column="creator_date"/>
    </resultMap>
    <insert id="insertRunState" parameterType="map">
        insert into `t_device_run_state` (`total_count`, `run_count`, `halt_count`, `offline_count`, `creator_date`)
        VALUES (#{total_count}, #{run_count}, #{halt_count}, #{offline_count}, SYSDATE())
    </insert>
    <update id="updateRunState" parameterType="map">
        update t_device_run_state
        set total_count   = #{total_count},
            run_count     = #{run_count},
            halt_count    = #{halt_count},
            offline_count = #{offline_count},
            creator_date  = SYSDATE()
        where id = #{id}
    </update>
    <select id="getId" resultType="java.lang.Integer">
        select IF(count(1), id, 0)
        from t_device_run_state group by id
    </select>
 
 
</mapper>