This commit is contained in:
sxu 2024-08-13 13:00:32 +08:00
parent 2aaa299d28
commit ef18dd3dc4
2 changed files with 21 additions and 0 deletions

View File

@ -7,6 +7,16 @@ package com.bonus.sgzb.common.core.constant;
*/
public class Constants
{
/**
* 广州仓储
*/
public static final String CUSTOMER_GZ = "gz";
/**
* 重庆机具
*/
public static final String CUSTOMER_CQ = "cq";
/**
* UTF-8 字符集
*/

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.system.service.impl;
import com.bonus.sgzb.common.core.constant.Constants;
import com.bonus.sgzb.common.core.constant.UserConstants;
import com.bonus.sgzb.common.core.exception.ServiceException;
import com.bonus.sgzb.common.core.text.Convert;
@ -17,6 +18,7 @@ import com.bonus.sgzb.system.mapper.SysRoleMapper;
import com.bonus.sgzb.system.mapper.SysUserMapper;
import com.bonus.sgzb.system.service.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -33,6 +35,10 @@ import java.util.stream.Collectors;
*/
@Service
public class SysDeptServiceImpl implements ISysDeptService {
@Value("${sgzb.customer}")
private String customer;
@Resource
private SysDeptMapper deptMapper;
@ -51,6 +57,11 @@ public class SysDeptServiceImpl implements ISysDeptService {
@Override
@DataScope(deptAlias = "d")
public List<SysDept> selectDeptList(SysDept dept) {
if (Constants.CUSTOMER_GZ.equals(customer)) {
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
dept.setCompanyId(Objects.nonNull(sysUser) ? sysUser.getCompanyId() : null);
}
return deptMapper.selectDeptList(dept);
}