Merge remote-tracking branch 'origin/master'

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

View File

@ -60,7 +60,7 @@ public class ShopStaffController {
@SaAdminCheckPermission("shopStaff:detail") @SaAdminCheckPermission("shopStaff:detail")
@GetMapping("/detail") @GetMapping("/detail")
public CzgResult<ShopStaff> detail(@RequestParam Long id) { 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));
} }
/** /**

View File

@ -87,4 +87,12 @@ public class ShopStaff implements Serializable {
*/ */
private Integer isPc; private Integer isPc;
@Column(ignore = true)
private Long roleId;
@Column(ignore = true)
private String accountName;
@Column(ignore = true)
private String accountPwd;
} }

View File

@ -26,4 +26,6 @@ public interface ShopStaffService extends IService<ShopStaff> {
Boolean delete(ShopStaffRemoveDTO shopStaffRemoveDTO); Boolean delete(ShopStaffRemoveDTO shopStaffRemoveDTO);
List<Long> permission(Long id); List<Long> permission(Long id);
ShopStaff detail(Long shopId, Long id);
} }

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.ShopStaffAddDTO;
import com.czg.account.dto.staff.ShopStaffEditDTO; import com.czg.account.dto.staff.ShopStaffEditDTO;
import com.czg.account.dto.staff.ShopStaffRemoveDTO; import com.czg.account.dto.staff.ShopStaffRemoveDTO;
import com.czg.account.entity.ShopPermission; import com.czg.account.entity.*;
import com.czg.account.entity.ShopStaff;
import com.czg.account.entity.ShopStaffPermission;
import com.czg.account.entity.SysUser;
import com.czg.account.service.*; import com.czg.account.service.*;
import com.czg.exception.ApiNotPrintException; import com.czg.exception.ApiNotPrintException;
import com.czg.sa.StpKit; import com.czg.sa.StpKit;
@ -37,6 +34,8 @@ public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff
@Resource @Resource
private SysUsersRolesService sysUsersRolesService; private SysUsersRolesService sysUsersRolesService;
@Resource @Resource
private SysRoleService sysRoleService;
@Resource
private ShopPermissionService shopPermissionService; private ShopPermissionService shopPermissionService;
@Resource @Resource
private ShopStaffPermissionService shopStaffPermissionService; private ShopStaffPermissionService shopStaffPermissionService;
@ -128,4 +127,19 @@ public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff
public List<Long> permission(Long id) { public List<Long> permission(Long id) {
return shopStaffPermissionService.getPermissionByStaffId(StpKit.USER.getShopId(), id, id).stream().map(ShopPermission::getId).toList(); 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;
}
} }