<?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.zcxk.dao.ReportDimensionSettingMapper">

    <insert id="saveDimensionSetting" parameterType="com.zcxk.dto.ReportStatisticalDimensionDto">
        insert into sms_report_dimension_setting(user_id,tenant_id,device_parm_id,classify,show_on_off,show_min_value,show_avg_value,
                                                 show_max_value,show_sum_value,show_latest_value,type)
        values (#{userId},#{tenantId},#{deviceParmId},#{classify},#{showOnOff},#{showMinValue},
                #{showAvgValue},#{showMaxValue},#{showSumValue},#{showLatestValue},#{type})
    </insert>

    <update id="updateDimensionSetting">
        update sms_report_dimension_setting
        set
            classify=#{classify},
            show_on_off=#{showOnOff},
            show_min_value=#{showMinValue},
            show_avg_value=#{showAvgValue},
            show_max_value=#{showMaxValue},
            show_sum_value=#{showSumValue},
            show_latest_value=#{showLatestValue}
        where
            id =#{dimensionId}
    </update>

    <select id="findDimensionSetting" resultType="com.zcxk.entity.ReportDimensionSettingEntity">
        select * from  sms_report_dimension_setting where user_id =#{userId}
    </select>

    <select id="findHistoryDataDimensionSetting" resultType="com.zcxk.entity.ReportDimensionSettingEntity">
        select * from  sms_report_dimension_setting where user_id =#{userId} and type=1
    </select>


</mapper>