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 class Constants
{ {
/**
* 广州仓储
*/
public static final String CUSTOMER_GZ = "gz";
/**
* 重庆机具
*/
public static final String CUSTOMER_CQ = "cq";
/** /**
* UTF-8 字符集 * UTF-8 字符集
*/ */

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.system.service.impl; 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.constant.UserConstants;
import com.bonus.sgzb.common.core.exception.ServiceException; import com.bonus.sgzb.common.core.exception.ServiceException;
import com.bonus.sgzb.common.core.text.Convert; 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.mapper.SysUserMapper;
import com.bonus.sgzb.system.service.ISysDeptService; import com.bonus.sgzb.system.service.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -33,6 +35,10 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
public class SysDeptServiceImpl implements ISysDeptService { public class SysDeptServiceImpl implements ISysDeptService {
@Value("${sgzb.customer}")
private String customer;
@Resource @Resource
private SysDeptMapper deptMapper; private SysDeptMapper deptMapper;
@ -51,6 +57,11 @@ public class SysDeptServiceImpl implements ISysDeptService {
@Override @Override
@DataScope(deptAlias = "d") @DataScope(deptAlias = "d")
public List<SysDept> selectDeptList(SysDept dept) { 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); return deptMapper.selectDeptList(dept);
} }