<?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="cn.xluobo.business.stock.category.repo.mapper.StockCategoryMapper">

    <select id="selectCategoryByParentId"
            resultType="cn.xluobo.business.stock.category.domain.resp.RespLazyLoadCategory">
        select a.*,(select count(1) from stock_category b where b.parent_id=a.category_id) as  has_children
        from stock_category a
        where parent_id=#{parentId}
        order by a.sort
    </select>
</mapper>
