package com.mvc.controller.biz;

import com.mvc.model.ResPageModel;
import com.mvc.model.ResultGeekerModel;
import com.mvc.model.biz.TMaintenanceRecordsV2Model;
import com.mvc.service.TMaintenanceRecordsV2Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

@Api(tags = "维护记录")
@RequestMapping("/TMaintenanceRecordsV2Action")
@Controller
public class TMaintenanceRecordsV2Action {

    @Resource
    private TMaintenanceRecordsV2Service maintenanceRecordsV2Service;

    @ApiOperation("分页查询维护记录")
    @RequestMapping(value = "/findAllTMaintenanceRecordsV2", method = RequestMethod.POST)
    @ResponseBody
    public ResultGeekerModel findAllTMaintenanceRecordsV2(@RequestBody TMaintenanceRecordsV2Model model){
        ResultGeekerModel resultModel;
        try {
            ResPageModel res = maintenanceRecordsV2Service.findAllTMaintenanceRecordsV2(model);
            resultModel = new ResultGeekerModel(res);
        } catch (Exception e) {
            e.printStackTrace();
            resultModel = new ResultGeekerModel(e.getMessage());
        }
        return resultModel;
    }

    @ApiOperation("删除维护记录")
    @RequestMapping(value = "/deleteTMaintenanceRecordsV2", method = RequestMethod.GET)
    @ResponseBody
    public ResultGeekerModel deleteTMaintenanceRecordsV2(int id) {
        ResultGeekerModel resultModel;
        try {
            int res = maintenanceRecordsV2Service.deleteTMaintenanceRecordsV2(id);
            resultModel = new ResultGeekerModel(res);
        } catch (Exception e) {
            e.printStackTrace();
            resultModel = new ResultGeekerModel(e.getMessage());
        }
        return resultModel;
    }
}
