#
vincent
2020-06-02 41eaaf7f671bc59ec2fc195c299ba158f02b2d45
src/main/java/com/zy/client/controller/SiteController.java
@@ -1,7 +1,14 @@
package com.zy.client.controller;
import com.core.annotations.ManagerAuth;
import com.core.common.R;
import com.zy.client.domain.PlcErrorTable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
 * 输送设备接口
@@ -11,5 +18,28 @@
@RequestMapping("/site")
public class SiteController {
    @PostMapping("/table/plc/errors")
    @ManagerAuth(memo = "输送设备plc异常信息表")
    public R crnLatestData(){
        List<PlcErrorTable> list = new ArrayList<>();
        for (int i=0;i<10;i++){
            PlcErrorTable table = new PlcErrorTable();
            table.setNo(String.valueOf(i));
            table.setError("异常信息");
            table.setPlcDesc("plc异常描述");
            list.add(table);
        }
        list.sort((o1, o2) -> {
            if (o1.getNo().compareTo(o2.getNo()) > 0){
                return 1;
            }else if (o1.getNo().compareTo(o2.getNo()) < 0){
                return 0;
            }else{
                return -1;
            }
        });
        return R.ok().add(list);
    }
}