mybatis query count

Mapper.xml

resultType is defined asjava.lang.Integer

   <select id="countCountry"  resultType="java.lang.Integer">
        select count(*) from sys_area where pid=#{streetId};
    </select>

Mapper.java

/**
 * 查询街道中的村的数量
 * @param streetId 街道ID
 * @return
 */
public int countCountry(@Param("streetId") String streetId);

reference

https://blog.csdn.net/weistin/article/details/79864150

Guess you like

Origin blog.csdn.net/lxyoucan/article/details/133363043