package com.kcim.web;

import com.kcim.common.util.Result;
import com.kcim.dao.model.CostCostingCollection;
import com.kcim.service.CostCostingCollectionService;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;


/**
 * 成本数据归集后列表
 *
 * @author KCYG
 * @date 2021-08-18 15:27:02
 */
@RestController
@RequestMapping("costcostingcollection")
public class CostCostingCollectionController {


    private final CostCostingCollectionService costCostingCollectionService;

    public CostCostingCollectionController(CostCostingCollectionService costCostingCollectionService) {
        this.costCostingCollectionService = costCostingCollectionService;
    }

    /**
     * 分页查询列表
     * 查询的是
     */
    @RequestMapping("/list")
    public Result list(@RequestParam(value = "current", defaultValue = "1") Integer current,
                       @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
//        User user = (User) SecurityUtils.getSubject().getPrincipal();
        return Result.ok();
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public Result info(@PathVariable("id") Long id){
		CostCostingCollection costCostingCollection = costCostingCollectionService.getById(id);
        return Result.ok(costCostingCollection);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public Result save(@RequestBody CostCostingCollection costCostingCollection){
		costCostingCollectionService.save(costCostingCollection);
        return Result.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public Result update(@RequestBody CostCostingCollection costCostingCollection){
		costCostingCollectionService.updateById(costCostingCollection);
        return Result.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    public Result delete(@RequestBody Long[] ids){
        costCostingCollectionService.deleteByIds(Arrays.asList(ids));
        return Result.ok();
    }
    /**
     * 科室计算
     */

}
