package com.fjhx.common.controller.documentary;

import com.fjhx.common.entity.documentary.dto.DocumentaryRecordDto;
import com.fjhx.common.entity.documentary.dto.DocumentaryRecordSelectDto;
import com.fjhx.common.entity.documentary.vo.DocumentaryRecordInfoVo;
import com.fjhx.common.service.documentary.DocumentaryRecordService;
import com.ruoyi.common.core.domain.BaseSelectDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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;


/**
 * <p>
 * 跟单记录 前端控制器
 * </p>
 *
 * @author
 * @since 2023-04-20
 */
@RestController
@RequestMapping("/documentaryRecord")
public class DocumentaryRecordController {

    @Autowired
    private DocumentaryRecordService documentaryRecordService;

    /**
     * 跟单记录信息
     */
    @PostMapping("/info")
    public DocumentaryRecordInfoVo page(@RequestBody DocumentaryRecordSelectDto dto) {
        return documentaryRecordService.getInfo(dto);
    }

    /**
     * 添加跟单记录
     */
    @PostMapping("/add")
    public void add(@Validated @RequestBody DocumentaryRecordDto dto) {
        documentaryRecordService.add(dto);
    }

    /**
     * 编辑跟单记录
     */
    @PostMapping("/edit")
    public void edit(@RequestBody DocumentaryRecordDto dto) {
        documentaryRecordService.edit(dto);
    }

    /**
     * 删除跟单记录
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        documentaryRecordService.delete(dto.getId());
    }

}
