123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?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.diagbot.mapper.DeptInfoMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.diagbot.entity.DeptInfo">
- <id column="id" property="id" />
- <result column="is_deleted" property="isDeleted" />
- <result column="gmt_create" property="gmtCreate" />
- <result column="gmt_modified" property="gmtModified" />
- <result column="creator" property="creator" />
- <result column="modifier" property="modifier" />
- <result column="name" property="name" />
- <result column="remark" property="remark" />
- </resultMap>
- <select id="getAllDeptInfo" resultType="com.diagbot.dto.GetDeptInfoDTO">
- SELECT
- a.id,a.gmt_create,b.gmt_modified,b.creator,b.modifier,a.`name`,a.remark,c.type
- FROM
- `icss_dept_info` a
- LEFT JOIN icss_question_usual b ON a.id = b.dept_id
- LEFT JOIN icss_question_info c ON b.question_id = c.id
- WHERE
- a.is_deleted = 'N' AND b.is_deleted = 'N' AND c.is_deleted = 'N'
- <if test="name != null and name != ''">
- AND a.`name` LIKE CONCAT('%',#{name},'%')
- </if>
- GROUP BY a.id,c.type
- ORDER BY
- b.gmt_modified DESC
- </select>
- <select id="getDeptName" resultType="com.diagbot.dto.DeptInfoDTO">
- SELECT
- *
- FROM
- `icss_dept_info` a
- WHERE
- a.is_deleted = 'N'
- AND a.id NOT IN (
- SELECT
- b.dept_id
- FROM
- icss_question_usual b
- WHERE
- b.is_deleted = 'N'
- AND b.dept_id IN (
- SELECT
- c.id
- FROM
- `icss_dept_info` c
- WHERE c.is_deleted = 'N'
- )
- )
- </select>
- </mapper>
|