com.base4j.mvc.sys.mapper.xml.SysDeptMapper.xml Maven / Gradle / Ivy
<?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.base4j.mvc.sys.mapper.SysDeptMapper"> <resultMap id="ChildNumResultMap" extends="BaseResultMap" type="com.base4j.mvc.sys.entity.SysDept"> <result column="CHILD_NUM" property="childNum"/> </resultMap> <select id="selectChildNumListByParentId" resultMap="ChildNumResultMap" parameterType="long"> SELECT T.*, (SELECT COUNT(0) FROM SEED_SYS_DEPT SSD WHERE SSD.PARENT_ID = T.ID) AS CHILD_NUM FROM SEED_SYS_DEPT T where T.PARENT_ID=#{parentId} </select> </mapper>