package com.iformall.controller.invest;

import com.iformall.annotation.SystemServiceLog;
import com.iformall.common.InvestResultData;
import com.iformall.domain.po.invest.InvestFollowRecordEntity;
import com.iformall.domain.vo.invest.InvestFollowQuery;
import com.iformall.domain.vo.invest.InvestFollowRecordVo;
import com.iformall.domain.vo.invest.InvestPageResult;
import com.iformall.service.invest.InvestBizService;
import com.iformall.service.invest.InvestFollowRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;



/**
 * 招商模块-跟踪记录
 *
 * @author
 * @email
 * @date 2019-09-23 18:40:43
 */
@Slf4j
@RestController
@RequestMapping("invest/followrecord")
@Api(tags = "招商模块-跟踪记录")
public class InvestFollowRecordController extends InvestBaseController {
    @Autowired
    private InvestFollowRecordService investFollowRecordService;
    @Autowired
    private InvestBizService bizService ;

    /**
     * 分页列表
     */
    @SystemServiceLog
    @ApiOperation("分页列表接口")
    @GetMapping("/list")
    public InvestResultData<InvestPageResult<InvestFollowRecordVo>> list(InvestFollowQuery params) {
        return execute(params, p -> bizService.queryPageFollowRecord(p));
    }


    /**
     * 信息
     */
    @SystemServiceLog
    @GetMapping("/info/{id}")
    public InvestResultData<InvestFollowRecordVo> info(@PathVariable("id") Long id){
        return execute(id, p -> bizService.findFollowRecordById(p));
    }

    /**
     * 保存
     */
    @SystemServiceLog
    @PostMapping("/save")
    public InvestResultData save(@RequestBody InvestFollowRecordEntity investFollowRecord){
        return execute(investFollowRecord, p -> investFollowRecordService.save(p));
    }

    /**
     * 修改
     */
    //@PostMapping("/update")
    public InvestResultData update(@RequestBody InvestFollowRecordEntity investFollowRecord){
        return execute(investFollowRecord, p -> investFollowRecordService.updateById(p));
    }

    /**
     * 删除
     */
    //@GetMapping("/delete")
    public InvestResultData delete(@RequestBody Long[] ids){
        return execute(ids, p -> investFollowRecordService.removeByIds(Arrays.asList(p)));
    }

}
