kongdeqiang
3 天以前 400431e56ba1000fc08ff58684087899cb7ec9d9
src/main/java/com/boying/controller/InspectionController.java
@@ -5,7 +5,9 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.boying.common.R;
import com.boying.entity.Inspection;
import com.boying.entity.Repair;
import com.boying.entity.WhiteList;
import com.boying.service.BarrierService;
import com.boying.service.InspectionService;
import com.boying.service.ParkService;
import com.boying.service.WhiteListService;
@@ -17,6 +19,7 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@RestController
@@ -26,14 +29,23 @@
    private final InspectionService inspectionService;
    private final ParkService parkService;
    private final BarrierService barrierService;
    @PostMapping("/findPage")
    //@Operation(summary = "分页查询" , description = "分页查询" )
    public Object findPage(Page page, String carNo) {
    public Object findPage(Page page,Long parkId) {
        QueryWrapper<Inspection> wrapper = new QueryWrapper<>();
        wrapper.lambda()
                .eq(parkId !=null,Inspection::getParkId,parkId)
                .orderByDesc(Inspection::getId);
        Page<Inspection> page1 = inspectionService.page(page, wrapper);
        List<Inspection> records = page1.getRecords();
        for (Inspection record : records) {
            record.setParkName(parkService.getById(record.getParkId()).getName());
            if(record.getBarrierId()!=null){
                record.setBarrierName(barrierService.getById(record.getBarrierId()).getName());
            }
        }
        page1.setRecords(records);
        return R.ok(page1);
    }