为什么mybatis 没有返回指定的列,反而用了count(*) as total


2021-11-12 10:26:44.117  INFO 2846 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
JDBC Connection [HikariProxyConnection@59103257 wrapping com.mysql.cj.jdbc.ConnectionImpl@4315c28c] will not be managed by Spring
==>  Preparing: SELECT COUNT(*) AS total FROM school WHERE province_code = ?
==> Parameters: 310115(String)
<==    Columns: total
<==        Row: 0
<==      Total: 1

/**
     * 
     * @param id
     * @return
     */
    List<School> selectByLocalityId(Page<School> page,  @Param("localityId") String id);
    <sql id="Base_Column_List">
        <!-- WARNING - @mbg.generated This element is automatically generated by 
            MyBatis Generator, do not modify. This element was generated on Tue Nov 09 
            14:02:35 CST 2021. -->
        id, name, country, region, city, area, running_type, level, level_id,
        telephone,
        email, website, address, postcode, schooltype, province_code, province_id,
        city_code,
        city_id, area_code, area_id, subarea_code, subarea_id, headmaster, claimed,
        rated,
        lat, lng, geocode_confidence, geocode_level, status, customized_url,
        foundAt, createdAt,
        updatedAt
    </sql>
    <select id="selectByLocalityId"
        parameterType="java.lang.String" resultMap="BaseResultMap">
        <!-- WARNING - @mbg.generated This element is automatically generated by 
            MyBatis Generator, do not modify. This element was generated on Tue Nov 09 
            14:02:35 CST 2021. -->
        select
        <include refid="Base_Column_List" />
        from school
        where province_code = #{localityId, jdbcType=VARCHAR}
 
    </select>

你用了分页吧 是不是还有日志

用junit 跑单元测试,发现这个问题

这有啥问题,分页插件查询都是先求count,再查列表,你这2查询都出来了;
只是应该你是的Test设置了超时啥的才出现错误

junit 啥也没设置