package com.dk.mdm.controller.mst;

import com.dk.common.model.pojo.PageList;
import com.dk.common.response.ResponseResultVO;
import com.dk.mdm.model.pojo.mst.CusFollow;
import com.dk.common.controller.BaseController;
import com.dk.common.service.BaseService;
import com.dk.mdm.model.pojo.mst.MeasureReceipt;
import com.dk.mdm.model.query.mst.CusFollowQuery;
import com.dk.mdm.model.query.mst.CustomerQuery;
import com.dk.mdm.model.response.mst.CusFollowResponse;
import com.dk.mdm.model.response.mst.CustomerResponse;
import com.dk.mdm.model.vo.mst.CusFollowVO;
import com.dk.mdm.model.vo.mst.CustomerVO;
import com.dk.mdm.model.vo.mst.MeasureReceiptVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.Api;
import com.dk.mdm.service.mst.CusFollowService;

import javax.validation.Valid;
import java.util.List;

@Api(tags = "客户跟进API接口")
@RestController
@RequestMapping("/mst/cusFollow")
public class CusFollowController{

    public BaseService<CusFollow> getService() {
        return cusFollowService;
    }

    @Autowired
    private CusFollowService cusFollowService;


    /**
     * @desc : 条件查询
     * @author : 于继渤
     * @date : 2024/2/26 10:36
     */
    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
    @PostMapping({"list_by"})
    public ResponseResultVO<PageList<CusFollowResponse>> selectByCond(@RequestBody CusFollowQuery customerQuery) {
        return cusFollowService.selectByCond(customerQuery);
    }

    /**
     * @desc : 新建
     * @author : 于继渤
     * @date : 2023/1/5 9:39
     */
    @ApiOperation( value = "新建", notes = "v" )
    @PostMapping({"insert"})
    public ResponseResultVO<?> insert(@RequestBody CusFollowVO cusFollowVO) {
        return cusFollowService.insert(cusFollowVO);
    }
    /**
     * @desc   : 查询跟进记录
     * @author : 于继渤
     * @date : 2024/2/26 10:36
     */
    @ApiOperation(value = "条件查询", notes = "条件查询")
    @PostMapping({"select_by_list"})
    public ResponseResultVO<List<CusFollowResponse>> selectByList(@RequestBody CusFollowQuery customerQuery) {
        return cusFollowService.selectByList(customerQuery);
    }

    /**
     * @desc : 新建量尺回执
     * @author : 于继渤
     * @date : 2023/1/5 9:39
     */
    @ApiOperation( value = "新建量尺回执", notes = "v" )
    @PostMapping({"save_measure"})
    public ResponseResultVO<?> saveMeasure(@RequestBody CusFollowVO cusFollowVO) {
        return cusFollowService.saveMeasure(cusFollowVO);
    }

    /**
     * @desc : 新建量尺回执
     * @author : 于继渤
     * @date : 2023/1/5 9:39
     */
    @ApiOperation( value = "新建量尺回执", notes = "v" )
    @PostMapping({"update_measure"})
    public ResponseResultVO<?> updateMeasure(@RequestBody MeasureReceiptVO measureReceipt) {
        return cusFollowService.updateMeasure(measureReceipt);
    }


    @ApiOperation(
            value = "编辑",
            notes = "编辑"
    )
    @PostMapping("update")
    public ResponseResultVO<?> update(@Valid @RequestBody CusFollowVO cusFollowVO) {
        return cusFollowService.update(cusFollowVO);
    }

    /**
     * @desc   : 跟进id查询
     * @author : 于继渤
     * @date : 2024/2/26 10:36
     */
    @ApiOperation(value = "跟进id查询", notes = "跟进id查询")
    @PostMapping({"{id}"})
    public ResponseResultVO<?> selectById(@PathVariable String id) {
        return cusFollowService.selectById(new CusFollowQuery().setFollowId(id));
    }

}
