12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- package service
- import (
- "ulink-admin/modules/system/dao"
- "ulink-admin/modules/system/models/model"
- "ulink-admin/modules/system/models/req"
- )
- type DeptService struct {
- DeptDao *dao.DeptDao `inject:""`
- RoleDao *dao.RoleDao `inject:""`
- }
- // TreeSelect 根据条件查询部门树
- func (s DeptService) TreeSelect(query req.DeptQuery) *[]model.SysDept {
- treeSelect := s.DeptDao.TreeSelect(query)
- return treeSelect
- }
- // SelectDeptListByRoleId 根据角色ID查询部门树信息
- func (s DeptService) SelectDeptListByRoleId(id int64) *[]int64 {
- role := s.RoleDao.SelectRoleByRoleId(id)
- return s.DeptDao.SelectDeptListByRoleId(id, role.DeptCheckStrictly)
- }
- // GetList 查询部门列表
- func (s DeptService) GetList(query req.DeptQuery) *[]model.SysDept {
- return s.DeptDao.GetList(query)
- }
- // GetDeptById 根据部门编号获取详细信息
- func (s DeptService) GetDeptById(id int64) *model.SysDept {
- return s.DeptDao.GetDeptById(id)
- }
- // Insert 添加部门数据
- func (s DeptService) Insert(dept model.SysDept) int64 {
- return s.DeptDao.Insert(dept)
- }
- // Insert 添加部门数据
- func (s DeptService) Update(dept model.SysDept) int64 {
- return s.DeptDao.Update(dept)
- }
- // CheckDeptNameUnique 校验部门名称是否唯一
- func (s DeptService) CheckDeptNameUnique(dept model.SysDept) bool {
- if s.DeptDao.CheckDeptNameUnique(dept) > 0 {
- return true
- }
- return false
- }
- // Remove 删除部门
- func (s DeptService) Remove(id int64) int64 {
- return s.DeptDao.Delete(id)
- }
- // HasChildByDeptId 是否存在部门子节点
- func (s DeptService) HasChildByDeptId(id int64) int64 {
- return s.DeptDao.HasChildByDeptId(id)
- }
- // CheckDeptExistUser 查询部门是否存在用户
- func (s DeptService) CheckDeptExistUser(id int64) int64 {
- return s.DeptDao.CheckDeptExistUser(id)
- }
|