Merge remote-tracking branch 'origin/master'

This commit is contained in:
Tankaikai
2025-02-20 10:27:50 +08:00
4 changed files with 29 additions and 5 deletions

View File

@@ -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,19 @@ 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()));
shopStaff.setRoleId(sysUsersRoles.getRoleId());
SysUser sysUser = sysUserService.getById(shopStaff.getId());
shopStaff.setAccountName(StrUtil.subAfter(sysUser.getAccount(), "@", true));
shopStaff.setAccountPwd("*******");
return shopStaff;
}
}