Schema(name="ukefu")
    Cube(name="咨询")
        View(alias="agentservice")
            SQL
                |    <![CDATA[
                |        select * from uk_agentservice where 1 = 1 !{skill ? "AND agentskill IN (" + skill + ")" : ""} !{agent ? "AND agentno = '" + agent + "'" : ""} !{orgi ? "AND orgi = '" + orgi + "'" : ""} !{begin ? "AND createtime >= str_to_date('" + begin + "', '%Y-%m-%d %H:%i:%s')" : ""} !{end ? "AND createtime <= str_to_date('" + end + " 23:59:59', '%Y-%m-%d %H:%i:%s')" : ""}
                |    ]]>
        Dimension(name="agent", foreignKey="agentno")
            Hierarchy(hasAll="true", allmemberName="合计", primaryKey="id")
                table(name="cs_user")
                level(name="坐席", column="uname", uniqueMembers="false", type="")
        Dimension(name="skill", foreignKey="agentskill")
            Hierarchy(hasAll="true", allMemberName="合计", primaryKey="id")
                table(name="uk_organ")
                level(name="技能组", column="name", uniqueMembers="false", type="")
        Dimension(name="time")
            Hierarchy(hasAll="true", allMemberName="合计")
                Level(name="日期", column="createtime", uniqueMembers="false")
                    KeyExpression
                        SQL(dialect="generic") date_format(agentservice.createtime,'%Y-%m-%d')
                        SQL(dialect="mysql") date_format(agentservice.createtime,'%Y-%m-%d')
                        SQL(dialect="oracle") TO_DATE(agentservice.createtime,'YYYY-MM-DD')
        Measure(name="咨询数量", column="id", aggregator="count", formatString="")
        Measure(name="平均等待时长_ms", column="waittingtime", aggregator="avg", formatString="")
        Measure(name="平均咨询时长_ms", column="sessiontimes", aggregator="avg", formatString="")
        CalculatedMember(name="平均等待时长（秒）", dimension="Measures", formula="[Measures].[平均等待时长_ms]/1000")
        CalculatedMember(name="平均咨询时长（秒）", dimension="Measures", formula="[Measures].[平均咨询时长_ms]/1000")
