package com.fjhx.controller.abnormal;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.base.Condition;
import com.fjhx.params.abnormal.AbnormalDetailsVo;
import com.fjhx.service.abnormal.AbnormalDetailsService;
import org.springblade.core.tool.api.R;
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-12-09
 */
@RestController
@RequestMapping("/abnormalDetails")
public class AbnormalDetailsController {

    @Autowired
    private AbnormalDetailsService abnormalDetailsService;


//
//    @PostMapping("/edit")
//    public R edit(@RequestBody AbnormalDetailsVo abnormalDetailsVo){
//        abnormalDetailsService.edit(abnormalDetailsVo);
//        return R.success();
//    }
//
//    @PostMapping("/delete")
//    public R delete(@RequestBody AbnormalDetailsVo abnormalDetailsVo){
//        abnormalDetailsService.delete(abnormalDetailsVo);
//        return R.success();
//    }


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

    @PostMapping("/add")
    public R add(@RequestBody AbnormalDetailsVo abnormalDetailsVo) {
        abnormalDetailsService.add(abnormalDetailsVo);
        return R.success();
    }

}

