员工详情返回角色名称
This commit is contained in:
parent
a16e322a3c
commit
f1456ba34f
|
|
@ -60,7 +60,7 @@ public class ShopStaffController {
|
|||
@SaAdminCheckPermission("shopStaff:detail")
|
||||
@GetMapping("/detail")
|
||||
public CzgResult<ShopStaff> detail(@RequestParam Long id) {
|
||||
return CzgResult.success(shopStaffService.queryChain().eq(ShopStaff::getId, id).eq(ShopStaff::getShopId, StpKit.USER.getShopId()).one());
|
||||
return CzgResult.success(shopStaffService.detail(StpKit.USER.getShopId(), id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -87,4 +87,7 @@ public class ShopStaff implements Serializable {
|
|||
*/
|
||||
private Integer isPc;
|
||||
|
||||
@Column(ignore = true)
|
||||
private String roleName;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,4 +26,6 @@ public interface ShopStaffService extends IService<ShopStaff> {
|
|||
Boolean delete(ShopStaffRemoveDTO shopStaffRemoveDTO);
|
||||
|
||||
List<Long> permission(Long id);
|
||||
|
||||
ShopStaff detail(Long shopId, Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
|||
import com.czg.account.dto.staff.ShopStaffAddDTO;
|
||||
import com.czg.account.dto.staff.ShopStaffEditDTO;
|
||||
import com.czg.account.dto.staff.ShopStaffRemoveDTO;
|
||||
import com.czg.account.entity.ShopPermission;
|
||||
import com.czg.account.entity.ShopStaff;
|
||||
import com.czg.account.entity.ShopStaffPermission;
|
||||
import com.czg.account.entity.SysUser;
|
||||
import com.czg.account.entity.*;
|
||||
import com.czg.account.service.*;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.sa.StpKit;
|
||||
|
|
@ -37,6 +34,8 @@ public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff
|
|||
@Resource
|
||||
private SysUsersRolesService sysUsersRolesService;
|
||||
@Resource
|
||||
private SysRoleService sysRoleService;
|
||||
@Resource
|
||||
private ShopPermissionService shopPermissionService;
|
||||
@Resource
|
||||
private ShopStaffPermissionService shopStaffPermissionService;
|
||||
|
|
@ -128,4 +127,17 @@ public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff
|
|||
public List<Long> permission(Long id) {
|
||||
return shopStaffPermissionService.getPermissionByStaffId(StpKit.USER.getShopId(), id, id).stream().map(ShopPermission::getId).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShopStaff detail(Long shopId, Long id) {
|
||||
ShopStaff shopStaff = queryChain().eq(ShopStaff::getId, id).eq(ShopStaff::getShopId, shopId).one();
|
||||
if (shopStaff == null) {
|
||||
throw new ApiNotPrintException("员工不存在");
|
||||
}
|
||||
|
||||
SysUsersRoles sysUsersRoles = sysUsersRolesService.getOne(new QueryWrapper().eq(SysUsersRoles::getUserId, shopStaff.getId()));
|
||||
SysRole role = sysRoleService.getById(sysUsersRoles.getRoleId());
|
||||
shopStaff.setRoleName(role.getName());
|
||||
return shopStaff;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue