mirror of https://gitee.com/stylefeng/roses
【7.6.0】【sys】【app】更新批量删除应用
parent
39ac96b22a
commit
0573797792
|
@ -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<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑应用
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue