89314c26e10cf8cc024a4d5980873d22a7c1d84b.svn-base 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package org.jeecg.modules.system.mapper;
  2. import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  3. import org.apache.ibatis.annotations.Select;
  4. import org.jeecg.modules.system.entity.SysDepart;
  5. import org.jeecg.modules.system.model.SysDepartTreeModel;
  6. import org.jeecg.modules.system.model.TreeModel;
  7. import org.springframework.data.repository.query.Param;
  8. import java.util.List;
  9. /**
  10. * <p>
  11. * 部门 Mapper 接口
  12. * <p>
  13. *
  14. * @Author: Steve
  15. * @Since: 2019-01-22
  16. */
  17. public interface SysDepartMapper extends BaseMapper<SysDepart> {
  18. /**
  19. * 根据用户ID查询部门集合
  20. */
  21. public List<SysDepart> queryUserDeparts(@Param("userId") String userId);
  22. /**
  23. * 根据用户名查询部门
  24. *
  25. * @param username
  26. * @return
  27. */
  28. public List<SysDepart> queryDepartsByUsername(@Param("username") String username);
  29. @Select("select id from sys_depart where org_code=#{orgCode}")
  30. public String queryDepartIdByOrgCode(@Param("orgCode") String orgCode);
  31. @Select("select id,parent_id from sys_depart where id=#{departId}")
  32. public SysDepart getParentDepartId(@Param("departId") String departId);
  33. /**
  34. * 根据部门Id查询,当前和下级所有部门IDS
  35. * @param departId
  36. * @return
  37. */
  38. List<String> getSubDepIdsByDepId(@Param("departId") String departId);
  39. /**
  40. * 根据部门编码获取部门下所有IDS
  41. * @param orgCodes
  42. * @return
  43. */
  44. List<String> getSubDepIdsByOrgCodes(@org.apache.ibatis.annotations.Param("orgCodes") String[] orgCodes);
  45. List<SysDepart> queryTreeListByPid(@Param("parentId") String parentId);
  46. /**
  47. * 根据id下级部门数量
  48. * @param parentId
  49. * @return
  50. */
  51. @Select("SELECT count(*) FROM sys_depart where del_flag ='0' AND parent_id = #{parentId,jdbcType=VARCHAR}")
  52. Integer queryCountByPid(@Param("parentId")String parentId);
  53. /**
  54. * 根据OrgCod查询所属公司信息
  55. * @param orgCode
  56. * @return
  57. */
  58. SysDepart queryCompByOrgCode(@Param("orgCode")String orgCode);
  59. /**
  60. * 根据id下级部门
  61. * @param parentId
  62. * @return
  63. */
  64. @Select("SELECT * FROM sys_depart where del_flag ='0' AND parent_id = #{parentId,jdbcType=VARCHAR}")
  65. List<SysDepart> queryDeptByPid(@Param("parentId")String parentId);
  66. }