package com.iformall.controller.invest;

import com.iformall.annotation.SystemServiceLog;
import com.iformall.common.InvestResultData;
import com.iformall.domain.po.invest.InvestOperateRecordEntity;
import com.iformall.domain.vo.invest.InvestOperateRecordQuery;
import com.iformall.domain.vo.invest.InvestOperateRecordVo;
import com.iformall.domain.vo.invest.InvestPageQuery;
import com.iformall.domain.vo.invest.InvestPageResult;
import com.iformall.service.invest.InvestBizService;
import com.iformall.service.invest.InvestOperateRecordService;
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/operaterecord")
@Api(tags = "招商模块-操作记录")
public class InvestOperateRecordController extends InvestBaseController {
    @Autowired
    private InvestOperateRecordService investOperateRecordService;
    @Autowired
    private InvestBizService bizService;

    /**
     * 分页列表
     */
    @SystemServiceLog
    @ApiOperation("分页列表接口")
    @GetMapping("/list")
    public InvestResultData<InvestPageResult<InvestOperateRecordEntity>> list(InvestPageQuery<InvestOperateRecordEntity> params) {
        return execute(params, p -> investOperateRecordService.queryPage(p));
    }


    /**
     * 信息
     */
    @GetMapping("/info")
    public InvestResultData info(InvestOperateRecordQuery params) {
        return execute(params, p -> bizService.findOperateById(p));
    }

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

    /**
     * 修改
     */
    @SystemServiceLog
    //@PostMapping("/update")
    public InvestResultData update(@RequestBody InvestOperateRecordEntity investOperateRecord){
        return execute(investOperateRecord, p -> investOperateRecordService.updateById(p));
    }

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

}
