资料文件夹加数量、补正删除按钮
This commit is contained in:
parent
ec43afe316
commit
b0264f1e2a
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.inspection.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.core.controller.BaseController;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionFile;
|
||||
@ -13,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* inspectionFileController
|
||||
@ -105,4 +107,19 @@ public class InspectionFileController extends BaseController
|
||||
}
|
||||
return toAjax(inspectionFileService.deleteInspectionFileById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id统计数量
|
||||
*
|
||||
* @author 小李
|
||||
* @date 14:30 2024/12/14
|
||||
* @param ids ids
|
||||
**/
|
||||
@GetMapping("/getCountByIds")
|
||||
public CommonResult<?> getCountByIds(@RequestParam(value = "ids" ,required = false) List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)){
|
||||
return null;
|
||||
}
|
||||
return success(inspectionFileService.getCountByIds(ids));
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* inspectionFileService接口
|
||||
*
|
||||
@ -63,4 +66,13 @@ public interface IInspectionFileService extends IService<InspectionFile>
|
||||
* @return 分页结果
|
||||
*/
|
||||
IPage<InspectionFile> selectInspectionFileList(Page<InspectionFile> page, InspectionFile inspectionFile);
|
||||
|
||||
/**
|
||||
* 根据id统计数量
|
||||
*
|
||||
* @author 小李
|
||||
* @date 14:30 2024/12/14
|
||||
* @param ids ids
|
||||
**/
|
||||
Map<Long, Long> getCountByIds(List<Long> ids);
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* inspectionFileService业务层处理
|
||||
@ -160,12 +162,29 @@ public class InspectionFileServiceImpl extends ServiceImpl<InspectionFileMapper,
|
||||
@Override
|
||||
public IPage<InspectionFile> selectInspectionFileList(Page<InspectionFile> page, InspectionFile inspectionFile) {
|
||||
// 创建一个空的 QueryWrapper
|
||||
QueryWrapper<InspectionFile> queryWrapper = new QueryWrapper<>();
|
||||
LambdaQueryWrapper<InspectionFile> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (ObjectUtil.isNotEmpty(inspectionFile.getFatherId())) {
|
||||
queryWrapper.eq("father_id", inspectionFile.getFatherId());
|
||||
queryWrapper.eq(InspectionFile::getFatherId, inspectionFile.getFatherId());
|
||||
}
|
||||
|
||||
queryWrapper.orderByAsc(InspectionFile::getType);
|
||||
queryWrapper.orderByDesc(InspectionFile::getCreateTime);
|
||||
// 直接调用 MyBatis-Plus 的 page 方法进行分页查询
|
||||
return this.page(page, queryWrapper); // 返回符合条件的分页查询结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id统计数量
|
||||
*
|
||||
* @author 小李
|
||||
* @date 14:30 2024/12/14
|
||||
* @param ids ids
|
||||
**/
|
||||
@Override
|
||||
public Map<Long, Long> getCountByIds(List<Long> ids){
|
||||
List<InspectionFile> inspectionFiles = baseMapper.selectList(new LambdaQueryWrapper<InspectionFile>().in(InspectionFile::getFatherId, ids));
|
||||
return inspectionFiles.stream().collect(Collectors.groupingBy(
|
||||
InspectionFile::getFatherId,
|
||||
Collectors.counting()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user