【7.6.0】【sys】【app】更新批量删除应用

pull/55/MERGE
fengshuonan 2023-06-12 19:31:57 +08:00
parent 39ac96b22a
commit 0573797792
4 changed files with 54 additions and 8 deletions

View File

@ -1,6 +1,7 @@
package cn.stylefeng.roses.kernel.sys.modular.app.controller;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
@ -52,6 +53,18 @@ public class SysAppController {
return new SuccessResponseData<>();
}
/**
*
*
* @author fengshuonan
* @date 2023/06/10 21:28
*/
@PostResource(name = "批量删除应用", path = "/sysApp/batchDelete")
public ResponseData<?> batchDelete(@RequestBody @Validated(BaseRequest.batchDelete.class) SysAppRequest sysAppRequest) {
sysAppService.batchDelete(sysAppRequest);
return new SuccessResponseData<>();
}
/**
*
*

View File

@ -7,8 +7,10 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Set;
/**
*
@ -82,4 +84,11 @@ public class SysAppRequest extends BaseRequest {
@ChineseDescription("备注")
private String remark;
/**
* id
*/
@NotEmpty(message = "主键id集合不能为空", groups = batchDelete.class)
@ChineseDescription("主键id集合")
private Set<Long> appIdList;
}

View File

@ -15,7 +15,7 @@ import java.util.List;
*/
public interface SysAppService extends IService<SysApp> {
/**
/**
*
*
* @param sysAppRequest
@ -24,7 +24,7 @@ public interface SysAppService extends IService<SysApp> {
*/
void add(SysAppRequest sysAppRequest);
/**
/**
*
*
* @param sysAppRequest
@ -33,7 +33,15 @@ public interface SysAppService extends IService<SysApp> {
*/
void del(SysAppRequest sysAppRequest);
/**
/**
*
*
* @author fengshuonan
* @since 2023/6/12 19:30
*/
void batchDelete(SysAppRequest sysAppRequest);
/**
*
*
* @param sysAppRequest
@ -42,7 +50,7 @@ public interface SysAppService extends IService<SysApp> {
*/
void edit(SysAppRequest sysAppRequest);
/**
/**
*
*
* @param sysAppRequest
@ -51,20 +59,20 @@ public interface SysAppService extends IService<SysApp> {
*/
SysApp detail(SysAppRequest sysAppRequest);
/**
/**
*
*
* @param sysAppRequest
* @param sysAppRequest
* @return List<SysApp>
* @author fengshuonan
* @date 2023/06/10 21:28
*/
List<SysApp> findList(SysAppRequest sysAppRequest);
/**
/**
*
*
* @param sysAppRequest
* @param sysAppRequest
* @return PageResult<SysApp>
* @author fengshuonan
* @date 2023/06/10 21:28

View File

@ -18,9 +18,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.Set;
/**
*
@ -53,6 +55,20 @@ public class SysAppServiceImpl extends ServiceImpl<SysAppMapper, SysApp> impleme
this.removeById(sysApp.getAppId());
}
@Override
@Transactional(rollbackFor = Exception.class)
public void batchDelete(SysAppRequest sysAppRequest) {
Set<Long> appIdList = sysAppRequest.getAppIdList();
// 判断应用下是否有绑定菜单
if (this.sysMenuService.validateMenuBindApp(appIdList)) {
throw new ServiceException(SysAppExceptionEnum.APP_BIND_MENU);
}
this.removeBatchByIds(appIdList);
}
@Override
public void edit(SysAppRequest sysAppRequest) {
SysApp sysApp = this.querySysApp(sysAppRequest);