package com.sckw.mine.controller;

import com.sckw.core.web.response.HttpResult;
import com.sckw.mine.entity.req.MineralAggPageListParam;
import com.sckw.mine.entity.req.MineralAggregateInsertParam;
import com.sckw.mine.entity.req.MineralAggregateUpdateParam;
import com.sckw.mine.service.MineralAggregateService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @desc: 矿料管理
 * @author: Lt
 * @date: 2024-05-30
 */
@RestController
@RequestMapping("mine/aggregate")
public class MineralAggregateController {

    @Autowired
    MineralAggregateService mineralAggregateService;


    /**
     * 新增
     * @author lt
     * @date 2024/05/30
     **/
    @RequestMapping("/insert")
    public HttpResult insert(@RequestBody @Valid MineralAggregateInsertParam mineralAggregateInsertParam){
        return mineralAggregateService.insert(mineralAggregateInsertParam);
    }

    /**
     * 刪除
     * @author lt
     * @date 2024/05/30
     **/
    @PostMapping("/delete")
    public HttpResult delete(@RequestParam("id") String id){
        return mineralAggregateService.AggreDelete(id);
    }

    /**
     * 更新
     * @author lt
     * @date 2024/05/30
     **/
    @RequestMapping("/update")
    public HttpResult update(@RequestBody @Valid MineralAggregateUpdateParam mineralAggregateUpdateParam){
        return mineralAggregateService.update(mineralAggregateUpdateParam);
    }

    /**
     * 查询 根据主键 id 查询
     * @author lt
     * @date 2024/05/30
     **/
    @GetMapping("/detail")
    public HttpResult detail(@RequestParam("id") String id){
        return HttpResult.ok(mineralAggregateService.detail(id));
    }

    /**
     * 查询 分页查询
     * @author lt
     * @date 2024/05/30
     **/
    @RequestMapping("/pageList")
    public HttpResult pageList(@RequestBody @Valid MineralAggPageListParam mineralAggPageListParam) {
        return mineralAggregateService.pageList(mineralAggPageListParam);
    }





}
