package com.jwipc.supplier.controller.pc;

import com.jwipc.page.PageView;
import com.jwipc.supplier.dto.SupplierSqeScoreBaseDTO;
import com.jwipc.supplier.logic.SupplierSqeScoreLogic;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static com.jwipc.supplier.constant.ModuleConst.MODULE_ROOT;

/**
 * <p> </p>
 *
 * @author ZhangJie
 * @version 1.0
 * @since JDK 1.8
 */
@RestController
@RequestMapping(MODULE_ROOT + "/sqescore/rest")
@RequiredArgsConstructor
public class SupplierSqeScoreRestController {
    private final SupplierSqeScoreLogic supplierSqeScoreLogic;

    @GetMapping("list")
    public PageView list(Long supplierId) {
        return supplierSqeScoreLogic.list(supplierId);
    }

    @PostMapping("saveOrUpdate")
    public ResponseEntity saveOrUpdate(@RequestBody List<SupplierSqeScoreBaseDTO> supplierSqeScoreBaseDTOS,Long supplierId,Integer manufacturerFlag) {
        supplierSqeScoreLogic.saveOrUpdate(supplierSqeScoreBaseDTOS,supplierId,manufacturerFlag);
        return ResponseEntity.ok().build();
    }
}
