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