员工接口修改

This commit is contained in:
张松
2025-02-19 10:44:53 +08:00
parent 3520a4cc07
commit 019fada4b9

View File

@@ -19,6 +19,7 @@ import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
@@ -41,6 +42,7 @@ public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff
private ShopStaffPermissionService shopStaffPermissionService;
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean add(ShopStaffAddDTO shopStaffAddDTO) {
SysUser sysUser = sysUserService.addUser(shopStaffAddDTO.getName(), StpKit.USER.getLoginIdAsString() + "@" +shopStaffAddDTO.getAccountName(),
shopStaffAddDTO.getAccountPwd(), shopStaffAddDTO.getPhone(), shopStaffAddDTO.getRoleId());
@@ -50,7 +52,9 @@ public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff
save(shopStaff);
// 权限添加
addPermission(shopStaff, shopStaffAddDTO.getShopPermissionIds());
if (shopStaffAddDTO.getShopPermissionIds() != null && !shopStaffAddDTO.getShopPermissionIds().isEmpty()) {
addPermission(shopStaff, shopStaffAddDTO.getShopPermissionIds());
}
return true;
}