package com.jwipc.sys.controller.pc;

import com.jwipc.page.PageView;
import com.jwipc.supplier.dto.SupplierNameConvertDTO;
import com.jwipc.supplier.model.query.SupplierNameConvertQuery;
import com.jwipc.sys.logic.SupplierNameConvertLogic;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

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


@RestController
@RequestMapping(MODULE_ROOT +"/supplierNameConvert/rest")
@RequiredArgsConstructor
public class SupplierNameConvertRestController {

    private final SupplierNameConvertLogic supplierNameConvertLogic;
    /**
     * 列表
     *
     * @param query
     * @return
     */
    @RequestMapping("/list")
    public PageView list(SupplierNameConvertQuery query) {
        return supplierNameConvertLogic.findByPage(query);
    }


    /**
     * 保存更新
     * @param param 参数
     */
    @PostMapping("/saveOrUpdate")
    public ResponseEntity saveOrUpdate(SupplierNameConvertDTO param){
        supplierNameConvertLogic.saveOrUpdate(param);
        return ResponseEntity.ok(true);
    }


    @PostMapping("/remove")
    public ResponseEntity remove(Long id) {
        supplierNameConvertLogic.removeById(id);
        return ResponseEntity.ok(true);
    }
}
