package com.crm.manager.controller;

import com.crm.manager.service.risk.RiskGroupTypeGroupFeignService;
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.type.group.RiskGroupTypeGroupDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.risk.group.type.group.RiskGroupTypeGroupAddEntity;
import com.crm.rely.backend.core.entity.risk.group.type.group.RiskGroupTypeGroupDeleteEntity;
import com.crm.rely.backend.core.entity.risk.group.type.group.RiskGroupTypeGroupSearchPageEntity;
import com.crm.rely.backend.core.entity.risk.group.type.group.RiskGroupTypeGroupUpdateEntity;
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/type/group")
public class RiskGroupTypeGroupController {

    @Autowired
    private RiskGroupTypeGroupFeignService service;


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


        return service.add(entity);
    }

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


        return service.update(entity);
    }

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


        return service.delete(entity);
    }

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

        return service.pageList(entity);
    }

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

        return service.single(entity);
    }

}
