package com.crm.manager.controller;

import com.crm.manager.service.risk.RiskGroupLeverageScheduledFeignService;
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.scheduled.RiskGroupLeverageScheduledDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.risk.group.leverage.scheduled.RiskGroupLeverageScheduledAddEntity;
import com.crm.rely.backend.core.entity.risk.group.leverage.scheduled.RiskGroupLeverageScheduledDeleteEntity;
import com.crm.rely.backend.core.entity.risk.group.leverage.scheduled.RiskGroupLeverageScheduledSearchEntity;
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;

/**
 * 风控杠杠定时任务
 *
 * @author houn
 */
@RestController
@RequestMapping("/risk/group/leverage/scheduled")
public class RiskGroupLeverageScheduledController {

    @Autowired
    private RiskGroupLeverageScheduledFeignService feignService;

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

        return feignService.add(entity);
    }

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

        return feignService.delete(entity);
    }

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

        return feignService.pageList(entity);
    }

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

        return feignService.single(entity);
    }
    
}
