package com.jy.business.contract.controller;

import com.jy.business.contract.model.dto.ContractDetailDto;
import com.jy.business.contract.model.dto.ContractDetailSelectDto;
import com.jy.business.contract.model.vo.ContractDetailVo;
import com.jy.business.contract.service.ContractDetailService;
import com.jy.framework.model.base.BaseSelectDto;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
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.List;

/**
 * <p>
 * 合同明细 前端控制器
 * </p>
 *
 * @author 
 * @since 2025-01-07
 */
@RestController
@RequestMapping("/contractDetail")
public class ContractDetailController {

    @Resource
    private ContractDetailService contractDetailService;

    /**
     * 合同明细列表
     */
    @GetMapping("/getList")
    public List<ContractDetailVo> getList(ContractDetailSelectDto dto) {
        return contractDetailService.getList(dto);
    }

    /**
     * 合同明细明细
     */
    @GetMapping("/getDetail")
    public ContractDetailVo getDetail(BaseSelectDto dto) {
        return contractDetailService.getDetail(dto.getId());
    }

    /**
     * 合同明细新增
     */
    @PostMapping("/add")
    public void add(@RequestBody ContractDetailDto dto) {
        contractDetailService.add(dto);
    }

    /**
     * 合同明细编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody ContractDetailDto dto) {
        contractDetailService.edit(dto);
    }

    /**
     * 合同明细删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        contractDetailService.delete(dto.getIdList());
    }

}
