仓库权限问题
This commit is contained in:
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import com.ruoyi.bas.warehouse.domain.BasWarehouse;
|
||||
import com.ruoyi.bas.warehouse.mapper.BasWarehouseMapper;
|
||||
import com.ruoyi.bas.warehouse.service.IBasWarehouseService;
|
||||
import com.ruoyi.common.annotation.DataScope;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
@@ -51,21 +52,10 @@ public class BasWarehouseServiceImpl implements IBasWarehouseService
|
||||
* @return 仓库管理
|
||||
*/
|
||||
@Override
|
||||
@DataScope
|
||||
public List<BasWarehouse> selectBasWarehouseList(BasWarehouse basWarehouse)
|
||||
{
|
||||
List<SysRole> roles = sysRoleService.selectRolesByUserId(SecurityUtils.getUserId());
|
||||
if (roles.stream().anyMatch(SysRole::isAdmin)){
|
||||
return basWarehouseMapper.selectBasWarehouseList(basWarehouse);
|
||||
}else {
|
||||
List<String> dateScope =new ArrayList<>();
|
||||
for (SysRole role : roles) {
|
||||
if (CollUtil.isNotEmpty(role.getWarehouseDataScope())){
|
||||
dateScope.addAll(role.getWarehouseDataScope());
|
||||
}
|
||||
}
|
||||
basWarehouse.setDataScope(dateScope);
|
||||
return basWarehouseMapper.selectBasWarehouseList(basWarehouse);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -121,9 +121,19 @@ public class MydoJobDetail extends BaseEntity
|
||||
private String spare4;
|
||||
|
||||
private String status;
|
||||
@Excel(name = "拣选数量")
|
||||
private String pickQuantity;
|
||||
//额外字段
|
||||
private ExtraField extraField;
|
||||
|
||||
public String getPickQuantity() {
|
||||
return pickQuantity;
|
||||
}
|
||||
|
||||
public void setPickQuantity(String pickQuantity) {
|
||||
this.pickQuantity = pickQuantity;
|
||||
}
|
||||
|
||||
public ExtraField getExtraField() {
|
||||
return extraField;
|
||||
}
|
||||
|
||||
@@ -118,6 +118,17 @@ public class MydoJobDetailFinish extends BaseEntity
|
||||
/** 备用字段4 */
|
||||
@Excel(name = "备用字段4")
|
||||
private String spare4;
|
||||
@Excel(name = "拣选数量")
|
||||
private String pickQuantity;
|
||||
|
||||
public String getPickQuantity() {
|
||||
return pickQuantity;
|
||||
}
|
||||
|
||||
public void setPickQuantity(String pickQuantity) {
|
||||
this.pickQuantity = pickQuantity;
|
||||
}
|
||||
|
||||
|
||||
public void setJobDetailId(String jobDetailId)
|
||||
{
|
||||
|
||||
@@ -11,12 +11,14 @@ import com.ruoyi.in.stockin.domain.InStockin;
|
||||
import com.ruoyi.in.stockin.service.IInStockinService;
|
||||
import com.ruoyi.in.stockindetail.domain.InStockinDetail;
|
||||
import com.ruoyi.in.stockindetail.service.IInStockinDetailService;
|
||||
import com.ruoyi.pda.domain.TrayCodeMakeSure;
|
||||
import com.ruoyi.pda.domain.TrayCodeMsg;
|
||||
import com.ruoyi.pda.service.PdaService;
|
||||
import com.ruoyi.pda.trayMsg.domain.TrayMsg;
|
||||
import com.ruoyi.pda.trayMsg.service.ITrayMsgService;
|
||||
import com.ruoyi.stock.stock.domain.BasStock;
|
||||
import com.ruoyi.stock.stock.service.IBasStockService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -134,6 +136,7 @@ public class PdaController extends BaseController {
|
||||
/**
|
||||
* 绑定托盘物料
|
||||
*/
|
||||
@PreAuthorize("@ss.hasAnyPermi('bas:warehouse:list')")
|
||||
@RequestMapping("/bindTrayMsg")
|
||||
@ResponseBody
|
||||
public AjaxResult bindTrayMsg(@RequestBody TrayCodeMsg trayCodeMsg) {
|
||||
@@ -170,13 +173,13 @@ public class PdaController extends BaseController {
|
||||
|
||||
/**
|
||||
* 出库确认
|
||||
* @param trayCode 托盘码
|
||||
* @param trayCodeMakeSure 托盘信息
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/outMakeSure")
|
||||
@PostMapping("/outMakeSure")
|
||||
@ResponseBody
|
||||
public AjaxResult outMakeSure(String trayCode) {
|
||||
return pdaService.outMakeSure(trayCode);
|
||||
public AjaxResult outMakeSure(@RequestBody TrayCodeMakeSure trayCodeMakeSure) {
|
||||
return pdaService.outMakeSure(trayCodeMakeSure);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ruoyi.pda.domain;
|
||||
|
||||
import com.ruoyi.job.mydojobdetail.domain.MydoJobDetail;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class TrayCodeMakeSure {
|
||||
//托盘码
|
||||
private String trayCode;
|
||||
//容器码
|
||||
private String containerCode;
|
||||
//拣选列表
|
||||
private List<MydoJobDetail> mydoJobDetailList;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.pda.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.pda.domain.TrayCodeMakeSure;
|
||||
import com.ruoyi.pda.domain.TrayCodeMsg;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.aspectj.weaver.loadtime.Aj;
|
||||
@@ -22,5 +23,5 @@ public interface PdaService {
|
||||
public AjaxResult addInJob(TrayCodeMsg trayCodeMsg);
|
||||
|
||||
|
||||
AjaxResult outMakeSure(String trayCode);
|
||||
AjaxResult outMakeSure(TrayCodeMakeSure trayCodeMakeSure);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
package com.ruoyi.pda.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.bas.cargoSpace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargoSpace.service.IBasCargoSpaceService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.job.mydojob.domain.MydoJob;
|
||||
import com.ruoyi.job.mydojob.service.IMydoJobService;
|
||||
import com.ruoyi.job.mydojobdetail.domain.MydoJobDetail;
|
||||
import com.ruoyi.job.mydojobdetail.service.IMydoJobDetailService;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.in.stockin.service.IInStockinService;
|
||||
import com.ruoyi.in.stockindetail.domain.InStockinDetail;
|
||||
import com.ruoyi.in.stockindetail.service.IInStockinDetailService;
|
||||
import com.ruoyi.pda.domain.TrayCodeMakeSure;
|
||||
import com.ruoyi.pda.domain.TrayCodeMsg;
|
||||
import com.ruoyi.pda.mapper.PdaMapper;
|
||||
import com.ruoyi.pda.trayMsg.domain.TrayMsg;
|
||||
@@ -17,7 +23,9 @@ import com.ruoyi.pda.trayMsg.service.ITrayMsgService;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -26,9 +34,14 @@ import java.util.List;
|
||||
@Service
|
||||
public class PdaServiceImp implements PdaService{
|
||||
@Autowired
|
||||
PdaMapper pdaMapper;
|
||||
private PdaMapper pdaMapper;
|
||||
@Autowired
|
||||
IBasCargoSpaceService basCargoSpaceService;
|
||||
private IBasCargoSpaceService basCargoSpaceService;
|
||||
@Autowired
|
||||
private IMydoJobDetailService mydoJobDetailService;;
|
||||
|
||||
@Autowired
|
||||
private IMydoJobService mydoJobService;;
|
||||
@Autowired
|
||||
ISysRoleService sysRoleService;
|
||||
@Autowired
|
||||
@@ -167,9 +180,37 @@ public class PdaServiceImp implements PdaService{
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult outMakeSure(String trayCode) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult outMakeSure(TrayCodeMakeSure trayCodeMakeSure) {
|
||||
//修改拣选数量
|
||||
List<MydoJobDetail> mydoJobDetailList = trayCodeMakeSure.getMydoJobDetailList();
|
||||
for (MydoJobDetail mydoJobDetail : mydoJobDetailList) {
|
||||
MydoJobDetail mydoJobDetailOld = mydoJobDetailService.selectMydoJobDetailByJobDetailId(mydoJobDetail.getJobDetailId());
|
||||
BigDecimal oldPickQuantity = Convert.toBigDecimal(mydoJobDetailOld.getPickQuantity());
|
||||
BigDecimal newPickQuantity = Convert.toBigDecimal(mydoJobDetail.getPickQuantity());
|
||||
mydoJobDetail.setPickQuantity(oldPickQuantity.add(newPickQuantity).toString());
|
||||
mydoJobDetailService.updateMydoJobDetail(mydoJobDetail);
|
||||
}
|
||||
|
||||
//查询当前任务是否已经全部拣选完成
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
mydoJobParam.setTrayCode(trayCodeMakeSure.getTrayCode());
|
||||
List<MydoJob> mydoJobList = mydoJobService.selectMydoJobList(mydoJobParam);
|
||||
if (CollUtil.isEmpty(mydoJobList)){
|
||||
return AjaxResult.warn("任务不存在");
|
||||
}
|
||||
|
||||
MydoJobDetail mydoJobDetailParam = new MydoJobDetail();
|
||||
mydoJobDetailParam.setJobId(mydoJobList.get(0).getJobId());
|
||||
List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailList(mydoJobDetailParam);
|
||||
if (CollUtil.isEmpty(mydoJobDetails)){
|
||||
return AjaxResult.warn("子任务不存在");
|
||||
}
|
||||
|
||||
boolean flag = mydoJobDetails.stream().allMatch(mydoJobDetail -> mydoJobDetail.getPickQuantity().equals(mydoJobDetail.getOutQuantity()));
|
||||
if (flag){
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_tray_code", trayCode);
|
||||
map.put("v_tray_code", trayCodeMakeSure.getTrayCode());
|
||||
pdaMapper.outMakeSure(map);
|
||||
String result = map.get("v_result").toString();
|
||||
if("10".equals(result)){
|
||||
@@ -177,5 +218,8 @@ public class PdaServiceImp implements PdaService{
|
||||
}else{
|
||||
return AjaxResult.warn(map.get("v_resultmsg").toString());
|
||||
}
|
||||
}else {
|
||||
return AjaxResult.warn("拣选完成");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,16 +22,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectBasWarehouseList" parameterType="BasWarehouse" resultMap="BasWarehouseResult">
|
||||
<include refid="selectBasWarehouseVo"/>
|
||||
<where>
|
||||
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
|
||||
<if test="warehouseNo != null and warehouseNo != ''"> and warehouse_no = #{warehouseNo}</if>
|
||||
<if test="projectNo != null and projectNo != ''"> and project_no = #{projectNo}</if>
|
||||
<if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
|
||||
<if test="address != null and address != ''"> and address = #{address}</if>
|
||||
<if test="cDesc != null and cDesc != ''"> and c_desc = #{cDesc}</if>
|
||||
<if test="warehouseKind != null and warehouseKind != ''"> and warehouse_kind = #{warehouseKind}</if>
|
||||
<if test="warehouseType != null and warehouseType != ''"> and warehouse_type = #{warehouseType}</if>
|
||||
<if test="isCurrent != null and isCurrent != ''"> and is_current = #{isCurrent}</if>
|
||||
where
|
||||
1=1
|
||||
<if test="warehouseId != null and warehouseId != ''">and warehouse_id = #{warehouseId}</if>
|
||||
<if test="warehouseNo != null and warehouseNo != ''">and warehouse_no = #{warehouseNo}</if>
|
||||
<if test="projectNo != null and projectNo != ''">and project_no = #{projectNo}</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">and warehouse_name like concat('%',
|
||||
#{warehouseName}, '%')
|
||||
</if>
|
||||
<if test="address != null and address != ''">and address = #{address}</if>
|
||||
<if test="cDesc != null and cDesc != ''">and c_desc = #{cDesc}</if>
|
||||
<if test="warehouseKind != null and warehouseKind != ''">and warehouse_kind = #{warehouseKind}</if>
|
||||
<if test="warehouseType != null and warehouseType != ''">and warehouse_type = #{warehouseType}</if>
|
||||
<if test="isCurrent != null and isCurrent != ''">and is_current = #{isCurrent}</if>
|
||||
<if test="dataScope !=null and dataScope.size()>0">
|
||||
and warehouse_id in
|
||||
<foreach item="item" index="index" collection="dataScope" open="(" separator="," close=")">
|
||||
@@ -44,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
${params.warehouseDataScope}
|
||||
</select>
|
||||
|
||||
<select id="selectBasWarehouseByWarehouseId" parameterType="String" resultMap="BasWarehouseResult">
|
||||
|
||||
@@ -31,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="spare2" column="spare2" />
|
||||
<result property="spare3" column="spare3" />
|
||||
<result property="spare4" column="spare4" />
|
||||
<result property="pickQuantity" column="pick_quantity" />
|
||||
<association property="extraField" javaType="ExtraField">
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="materialDesc" column="product_name" />
|
||||
@@ -70,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
mjd.spare2,
|
||||
mjd.spare3,
|
||||
mjd.spare4,
|
||||
mjd.pick_quantity,
|
||||
bp.product_name, bp.spare1 as englishDesc,
|
||||
bp.spare2 as netWeight,bp.spare5 as length,bp.spare6 as width,bp.spare7 as height,bp.spare8 as volume
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="spare2" column="spare2" />
|
||||
<result property="spare3" column="spare3" />
|
||||
<result property="spare4" column="spare4" />
|
||||
<result property="pickQuantity" column="pick_quantity" />
|
||||
<association property="extraField" javaType="ExtraField">
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="materialDesc" column="product_name" />
|
||||
@@ -70,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
mjd.spare2,
|
||||
mjd.spare3,
|
||||
mjd.spare4,
|
||||
mjd.pick_quantity,
|
||||
bp.product_name, bp.spare1 as englishDesc,
|
||||
bp.spare2 as netWeight,bp.spare5 as length,bp.spare6 as width,bp.spare7 as height,bp.spare8 as volume
|
||||
|
||||
@@ -146,6 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="spare2 != null">spare2,</if>
|
||||
<if test="spare3 != null">spare3,</if>
|
||||
<if test="spare4 != null">spare4,</if>
|
||||
<if test="pickQuantity != null">pick_quantity,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="jobDetailId != null and jobDetailId != ''">#{jobDetailId},</if>
|
||||
@@ -174,6 +177,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="spare2 != null">#{spare2},</if>
|
||||
<if test="spare3 != null">#{spare3},</if>
|
||||
<if test="spare4 != null">#{spare4},</if>
|
||||
<if test="pickQuantity != null">#{pick_quantity},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertHistory">
|
||||
@@ -208,6 +212,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="spare2 != null">spare2 = #{spare2},</if>
|
||||
<if test="spare3 != null">spare3 = #{spare3},</if>
|
||||
<if test="spare4 != null">spare4 = #{spare4},</if>
|
||||
<if test="pickQuantity != null">pick_quantity = #{pickQuantity},</if>
|
||||
</trim>
|
||||
where job_detail_id = #{jobDetailId}
|
||||
</update>
|
||||
|
||||
@@ -26,6 +26,11 @@ public @interface DataScope
|
||||
*/
|
||||
public String userAlias() default "";
|
||||
|
||||
/**
|
||||
* 仓库表的别名
|
||||
*/
|
||||
public String warehouseAlias() default "";
|
||||
|
||||
/**
|
||||
* 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来
|
||||
*/
|
||||
|
||||
@@ -58,6 +58,7 @@ public class DataScopeAspect
|
||||
* 数据权限过滤关键字
|
||||
*/
|
||||
public static final String DATA_SCOPE = "dataScope";
|
||||
public static final String WAREHOUSE_DATA_SCOPE = "warehouseDataScope";
|
||||
|
||||
@Before("@annotation(controllerDataScope)")
|
||||
public void doBefore(JoinPoint point, DataScope controllerDataScope) throws Throwable
|
||||
@@ -77,7 +78,7 @@ public class DataScopeAspect
|
||||
if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin())
|
||||
{
|
||||
String permission = StringUtils.defaultIfEmpty(controllerDataScope.permission(), PermissionContextHolder.getContext());
|
||||
dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), controllerDataScope.userAlias(), permission);
|
||||
dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), controllerDataScope.userAlias(),controllerDataScope.warehouseAlias(), permission);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,7 +92,7 @@ public class DataScopeAspect
|
||||
* @param userAlias 用户别名
|
||||
* @param permission 权限字符
|
||||
*/
|
||||
public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias, String permission)
|
||||
public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias,String warehouseAlias, String permission)
|
||||
{
|
||||
StringBuilder sqlString = new StringBuilder();
|
||||
List<String> conditions = new ArrayList<String>();
|
||||
@@ -170,6 +171,31 @@ public class DataScopeAspect
|
||||
baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
Object params = joinPoint.getArgs()[0];
|
||||
List<String> warehouseList = new ArrayList<String>();
|
||||
StringBuilder warehouseSqlString = new StringBuilder();
|
||||
for (SysRole role : user.getRoles()) {
|
||||
warehouseList.addAll(role.getWarehouseDataScope());
|
||||
if (role.isAdmin()){
|
||||
BaseEntity baseEntity = (BaseEntity) params;
|
||||
if (StringUtils.isNotEmpty(warehouseAlias)) {
|
||||
baseEntity.getParams().put(WAREHOUSE_DATA_SCOPE, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
warehouseSqlString.append(StringUtils.format(" OR {}.warehouse_id IN ({}) ", warehouseAlias,
|
||||
warehouseList.stream().map(s -> "'" + s + "'").collect(Collectors.joining(","))));
|
||||
|
||||
|
||||
if (StringUtils.isNotNull(params) && params instanceof BaseEntity) {
|
||||
BaseEntity baseEntity = (BaseEntity) params;
|
||||
if (StringUtils.isNotEmpty(warehouseAlias)){
|
||||
baseEntity.getParams().put(WAREHOUSE_DATA_SCOPE, " AND (" + warehouseSqlString.substring(4) + ")");
|
||||
}else {
|
||||
baseEntity.getParams().put(WAREHOUSE_DATA_SCOPE, " AND (" + warehouseSqlString.substring(5) + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.stream.Collectors;
|
||||
import javax.validation.Validator;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.ruoyi.system.mapper.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -24,11 +25,6 @@ import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.system.domain.SysPost;
|
||||
import com.ruoyi.system.domain.SysUserPost;
|
||||
import com.ruoyi.system.domain.SysUserRole;
|
||||
import com.ruoyi.system.mapper.SysPostMapper;
|
||||
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.mapper.SysUserPostMapper;
|
||||
import com.ruoyi.system.mapper.SysUserRoleMapper;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
@@ -66,6 +62,8 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
@Autowired
|
||||
protected Validator validator;
|
||||
@Autowired
|
||||
private SysRoleWarehouseMapper roleWarehouseMapper;
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
@@ -115,7 +113,11 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
@Override
|
||||
public SysUser selectUserByUserName(String userName)
|
||||
{
|
||||
return userMapper.selectUserByUserName(userName);
|
||||
SysUser sysUser = userMapper.selectUserByUserName(userName);
|
||||
for (SysRole role : sysUser.getRoles()) {
|
||||
role.setWarehouseDataScope(roleWarehouseMapper.selectRoleWarehouseByRoleId(role.getRoleId()));
|
||||
}
|
||||
return sysUser;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user