123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- package com.flow.dao;
- import com.flow.common.mybatis.dao.BaseDao;
- import com.flow.entity.Dept;
- import com.flow.entity.User;
- import org.apache.ibatis.annotations.Param;
- import org.apache.ibatis.annotations.Select;
- import java.util.List;
- public interface DeptDao extends BaseDao<Dept> {
- @Select("select * from sys_user where username = (select leader from sys_dept where id =#{id})")
- User getLeader(@Param("id") String id);
- @Select({
- "<script>",
- "select * from sys_user where username in (select leader from sys_dept where id in ",
- "<foreach item='id' collection='ids' open='(' separator=',' close=')'>",
- "#{id}",
- "</foreach>)",
- "</script>"
- })
- List<User> getLeader(@Param("ids") List<String> ids);
- @Select("select * from sys_user where dept_id = #{id}")
- List<User> getUsers(@Param("id") String id);
- @Select({
- "<script>",
- "select * from sys_user where dept_id in",
- "<foreach item='id' collection='ids' open='(' separator=',' close=')'>",
- "#{roleId}",
- "</foreach>",
- "</script>"
- })
- List<User> getUsers(@Param("ids") List<String> ids);
- @Select({
- "<script>",
- "select * from sys_user where dept_id in",
- "<foreach item='id' collection='ids' open='(' separator=',' close=')'>",
- "#{id}",
- "</foreach>",
- "and username in",
- "<foreach item='id' collection='roleIds' open='(' separator=',' close=')'>",
- "#{id}",
- "</foreach>",
- "</script>"
- })
- List<User> getRoleUsers(@Param("ids") List<String> ids, @Param("roleIds") List<String> roleIds);
- }
|