package com.crm.manager.controller;

import com.crm.manager.service.risk.RiskGroupLeverageSymbolFeignService;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
import com.crm.rely.backend.core.dto.risk.group.leverage.symbol.RiskGroupLeverageSymbolDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.risk.group.leverage.symbol.RiskGroupLeverageSymbolAddEntity;
import com.crm.rely.backend.core.entity.risk.group.leverage.symbol.RiskGroupLeverageSymbolDeleteEntity;
import com.crm.rely.backend.core.entity.risk.group.leverage.symbol.RiskGroupLeverageSymbolSearchEntity;
import com.crm.rely.backend.core.entity.risk.group.leverage.symbol.RiskGroupLeverageSymbolUpdateEntity;
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;

import java.util.List;

/**
 * 货币配设置
 *
 * @author houn
 */
@RestController
@RequestMapping("/risk/group/leverage/symbol")
public class RiskGroupLeverageSymbolController {

    @Autowired
    private RiskGroupLeverageSymbolFeignService feignService;

    /**
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/add")
    public BaseResultDto add(@RequestBody @Validated RiskGroupLeverageSymbolAddEntity entity) throws Exception {

        return feignService.add(entity);
    }

    @PostMapping("/update")
    public BaseResultDto update(@RequestBody @Validated RiskGroupLeverageSymbolUpdateEntity entity) throws Exception {

        return feignService.update(entity);
    }

    @PostMapping("/delete")
    public BaseResultDto delete(@RequestBody @Validated RiskGroupLeverageSymbolDeleteEntity entity) throws Exception {

        return feignService.delete(entity);
    }

    @PostMapping("/search/list")
    public ResultWithPagerDto<RiskGroupLeverageSymbolDto> pageList(@RequestBody @Validated RiskGroupLeverageSymbolSearchEntity entity) throws Exception {

        return feignService.pageList(entity);
    }

    @PostMapping("/search/single")
    public BaseResultDto<RiskGroupLeverageSymbolDto> single(@RequestBody @Validated SingleLongEntity entity) throws Exception {

        return feignService.single(entity);
    }

    @PostMapping("/list")
    public BaseResultDto<List<RiskGroupLeverageSymbolDto>> list() throws Exception {

        return feignService.list();
    }


}
