<?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.sweet.mapper.SweetCityVoteStatMapper">

    <resultMap id="getListResult" type="com.liquidnet.service.sweet.dto.SweetCityVoteStatDto">
        <result column="city_code" property="cityCode"/>
        <result column="city_name" property="cityName"/>
        <result column="vote_num" property="voteNum"/>
        <result column="manual_vote_num" property="manualVoteNum"/>
        <result column="total_num" property="totalNum"/>
    </resultMap>

    <select id="getStatList" resultMap="getListResult">
        select
        *, (vote_num + manual_vote_num) as total_num
        from sweet_city_vote_stat
        ORDER BY total_num DESC
    </select>
</mapper>
