Merge remote-tracking branch 'origin/master'

This commit is contained in:
wangw 2025-03-01 16:38:41 +08:00
commit ae299466e5
5 changed files with 10 additions and 8 deletions

View File

@ -9,6 +9,7 @@ import com.czg.account.service.ShopInfoService;
import com.czg.annotation.SaAdminCheckPermission; import com.czg.annotation.SaAdminCheckPermission;
import com.czg.annotation.SaAdminCheckRole; import com.czg.annotation.SaAdminCheckRole;
import com.czg.resp.CzgResult; import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -42,10 +43,13 @@ public class ShopInfoController {
* 店铺详情 * 店铺详情
* 权限标识: shopInfo:detail * 权限标识: shopInfo:detail
*/ */
@SaAdminCheckPermission("shopInfo:detail") // @SaAdminCheckPermission("shopInfo:detail")
@GetMapping("/detail") @GetMapping("/detail")
public CzgResult<ShopDetailDTO> detail(Integer id) { public CzgResult<ShopDetailDTO> detail(Long id) {
return CzgResult.success(shopInfoService.detail(id)); if (StpKit.USER.isAdmin() || StpKit.USER.getShopId().equals(id)) {
return CzgResult.success(shopInfoService.detail(id));
}
return CzgResult.failure("店铺信息不存在");
} }
/** /**

View File

@ -16,7 +16,7 @@ public interface ShopInfoService extends IService<ShopInfo> {
Boolean edit(ShopInfoEditDTO shopInfoEditDTO); Boolean edit(ShopInfoEditDTO shopInfoEditDTO);
ShopDetailDTO detail(Integer id); ShopDetailDTO detail(Long id);
ShopInfoByCodeDTO getByCode(String tableCode, String lat, String lng, boolean checkState); ShopInfoByCodeDTO getByCode(String tableCode, String lat, String lng, boolean checkState);

View File

@ -131,7 +131,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
} }
@Override @Override
public ShopDetailDTO detail(Integer id) { public ShopDetailDTO detail(Long id) {
ShopInfo shopInfo = queryChain().eq(ShopInfo::getId, id == null ? StpKit.USER.getShopId() : id).one(); ShopInfo shopInfo = queryChain().eq(ShopInfo::getId, id == null ? StpKit.USER.getShopId() : id).one();
if (shopInfo == null) { if (shopInfo == null) {
throw new ApiNotPrintException("店铺信息不存在"); throw new ApiNotPrintException("店铺信息不存在");

View File

@ -78,7 +78,7 @@ public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff
} }
if (StrUtil.isNotBlank(shopStaffEditDTO.getAccountName()) && !shopStaffEditDTO.getAccountName().equals(sysUser.getAccount())) { if (StrUtil.isNotBlank(shopStaffEditDTO.getAccountName()) && !shopStaffEditDTO.getAccountName().equals(sysUser.getAccount())) {
long count = sysUserService.count(new QueryWrapper().eq(SysUser::getAccount, shopStaffEditDTO.getAccountName())); long count = sysUserService.count(new QueryWrapper().eq(SysUser::getAccount, shopStaffEditDTO.getAccountName()).ne(SysUser::getId, sysUser.getId()));
if (count > 0) { if (count > 0) {
throw new ApiNotPrintException("此账户名已存在"); throw new ApiNotPrintException("此账户名已存在");
} }

View File

@ -150,8 +150,6 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
if (userInfo == null) { if (userInfo == null) {
userInfo = BeanUtil.copyProperties(shopUserAddDTO, UserInfo.class); userInfo = BeanUtil.copyProperties(shopUserAddDTO, UserInfo.class);
userInfoService.save(userInfo); userInfoService.save(userInfo);
} else {
throw new ApiNotPrintException("此用户已存在");
} }
ShopUser shopUser = BeanUtil.copyProperties(shopUserAddDTO, ShopUser.class); ShopUser shopUser = BeanUtil.copyProperties(shopUserAddDTO, ShopUser.class);