|
@@ -0,0 +1,46 @@
|
|
|
|
|
+<?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="org.sky.scientific.mapper.SubjectMapper">
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 通用查询映射结果 -->
|
|
|
|
|
+ <resultMap id="ResultMap" type="org.sky.scientific.pojo.entity.DepartmentEntity">
|
|
|
|
|
+ <id column="id" property="id"/>
|
|
|
|
|
+ <result column="parent_id" property="parentId"/>
|
|
|
|
|
+ <result column="tenantId" property="tenantId"/>
|
|
|
|
|
+ <result column="name" property="name"/>
|
|
|
|
|
+ <result column="acc_subject" property="accSubject"/>
|
|
|
|
|
+ <result column="rd_subject" property="rdSubject"/>
|
|
|
|
|
+ <result column="ad_subject" property="adSubject"/>
|
|
|
|
|
+ </resultMap>
|
|
|
|
|
+
|
|
|
|
|
+ <resultMap id="treeNodeResultMap" type="org.sky.core.tool.node.TreeNode">
|
|
|
|
|
+ <id column="id" property="id"/>
|
|
|
|
|
+ <result column="parent_id" property="parentId"/>
|
|
|
|
|
+ <result column="title" property="title"/>
|
|
|
|
|
+ <result column="value" property="value"/>
|
|
|
|
|
+ <result column="key" property="key"/>
|
|
|
|
|
+ </resultMap>
|
|
|
|
|
+
|
|
|
|
|
+ <resultMap id="ResultVoMap" type="org.sky.scientific.pojo.vo.SubjectVO" extends="ResultMap">
|
|
|
|
|
+ <result column="has_children" property="hasChildren"/>
|
|
|
|
|
+ </resultMap>
|
|
|
|
|
+
|
|
|
|
|
+ <delete id="deleteDepartment">
|
|
|
|
|
+ delete from kd_department where id = #{subjectId}
|
|
|
|
|
+ </delete>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="lazyList" resultMap="ResultVoMap">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ d.*,
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END
|
|
|
|
|
+ FROM
|
|
|
|
|
+ kd_department
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ parent_id = d.id
|
|
|
|
|
+ ) AS "has_children"
|
|
|
|
|
+ FROM
|
|
|
|
|
+ kd_department d
|
|
|
|
|
+ </select>
|
|
|
|
|
+</mapper>
|