MT8204Controller.java 1.8 KB
package com.tianbo.analysis.controller;

import com.github.pagehelper.PageInfo;
import com.tianbo.analysis.model.MANIFEST_AIR_CHANGE;
import com.tianbo.analysis.model.ResultJson;
import com.tianbo.analysis.service.MT8204Service;
import com.tianbo.util.Date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@Slf4j
@RestController
@RequestMapping("/mt8024/")
public class MT8204Controller {

    @Autowired
    MT8204Service mt8204Service;

    @GetMapping("/")
    public ResultJson index(@RequestParam(value = "page",defaultValue = "1") int page,
                            @RequestParam(value = "limit",defaultValue = "10") int limit,
                            @RequestParam(value = "flightNo",required = false) String flightNo,
                            @RequestParam(value = "flightDate",required = false) String flightDate,
                            @RequestParam(value = "waybillNo",required = false) String waybillNo){
        MANIFEST_AIR_CHANGE manifest_air_change = new MANIFEST_AIR_CHANGE();
        if(StringUtils.isNotEmpty(flightDate)){
           Date flight_Date = DateUtil.parseDate(flightDate,"yyyy-MM-dd");
           manifest_air_change.setFlightDate(flight_Date);
        }
        manifest_air_change.setFlightno(flightNo);
        manifest_air_change.setWaybillnomaster(waybillNo);
        PageInfo<MANIFEST_AIR_CHANGE> result =  mt8204Service.selectList(manifest_air_change,page,limit);
        return new ResultJson("200","success",result);
    }
}