feat(bigbrother): 导出后可选删除原数据并记录日志
This commit is contained in:
@@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.tkdata.controller.admin.bigbrother.vo.BigBrotherR
|
||||
import cn.iocoder.yudao.module.tkdata.controller.admin.bigbrother.vo.BigBrotherSaveReqVO;
|
||||
import cn.iocoder.yudao.module.tkdata.dal.dataobject.bigbrother.BigBrotherDO;
|
||||
import cn.iocoder.yudao.module.tkdata.service.bigbrother.BigBrotherService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -36,6 +37,7 @@ import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
@RestController
|
||||
@RequestMapping("/server/big-brother")
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class BigBrotherController {
|
||||
|
||||
@Resource
|
||||
@@ -100,6 +102,10 @@ public class BigBrotherController {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<BigBrotherDO> list = bigBrotherService.getBigBrotherPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
if (pageReqVO.getDeleteFlag()){
|
||||
bigBrotherService.deleteExportData(list);
|
||||
log.info("删除导出数据{}",list.size() );
|
||||
}
|
||||
ExcelUtils.write(response, "大哥数据.xls", "数据", BigBrotherRespVO.class,
|
||||
BeanUtils.toBean(list, BigBrotherRespVO.class));
|
||||
}
|
||||
|
||||
@@ -148,4 +148,8 @@ public class BigBrotherPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "粉丝团等级最小值", example = "0")
|
||||
private Integer fansLevelMin;
|
||||
|
||||
@Schema(description = "是否删除原数据")
|
||||
private Boolean deleteFlag;
|
||||
|
||||
}
|
||||
@@ -60,4 +60,5 @@ public interface BigBrotherService {
|
||||
*/
|
||||
PageResult<BigBrotherDO> getBigBrotherPage(BigBrotherPageReqVO pageReqVO);
|
||||
|
||||
void deleteExportData(List<BigBrotherDO> list);
|
||||
}
|
||||
@@ -99,4 +99,9 @@ public class BigBrotherServiceImpl implements BigBrotherService {
|
||||
return new PageResult<>(bigBrotherDOIPage.getRecords(),bigBrotherDOIPage.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteExportData(List<BigBrotherDO> list) {
|
||||
bigBrotherMapper.deleteByIds(list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -82,7 +82,7 @@ spring:
|
||||
redis:
|
||||
host: 127.0.0.1 # 地址
|
||||
port: 6379 # 端口
|
||||
database: 0 # 数据库索引
|
||||
database: 1 # 数据库索引
|
||||
# password: dev # 密码,建议生产环境开启
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
|
||||
Reference in New Issue
Block a user