package com.fjhx.controller.maintain;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springblade.core.tool.api.R;
import com.fjhx.entity.maintain.MaintainRecords;
import com.fjhx.params.maintain.MaintainRecordsVo;
import com.fjhx.service.maintain.MaintainRecordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 * 维护记录 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-11-02
 */
@RestController
@RequestMapping("/maintainRecords")
public class MaintainRecordsController {

    @Autowired
    private MaintainRecordsService maintainRecordsService;

    @PostMapping("/page")
    public R page(@RequestBody Map<String, String> condition){
        Page<MaintainRecords> result = maintainRecordsService.getPage(condition);
        return R.success(result);
    }

    @PostMapping("/add")
    public R add(@RequestBody MaintainRecordsVo maintainRecordsVo){
        maintainRecordsService.add(maintainRecordsVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody MaintainRecordsVo maintainRecordsVo){
        maintainRecordsService.edit(maintainRecordsVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody MaintainRecordsVo maintainRecordsVo){
        maintainRecordsService.delete(maintainRecordsVo);
        return R.success();
    }

}

