<?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.liquidnet.service.stone.mapper.StoneScoreLogsMapper">

    <resultMap id="StoneScoreListDtoResult" type="com.liquidnet.service.stone.dto.StoneInvalidDto">
        <result column="uid" property="uid"/>
        <result column="invalid_score" property="invalidScore"/>
    </resultMap>

    <select id="getInvalidScore" resultMap="StoneScoreListDtoResult">
        SELECT uid,sum(score) as 'invalid_score' from stone_score_logs
        WHERE
        (created_at <![CDATA[>=]]> #{st} and created_at <![CDATA[<]]> #{et})
        OR
        content = #{strTime}
        GROUP BY uid
        HAVING invalid_score <![CDATA[>]]> 0
        ORDER BY uid
    </select>

</mapper>
