package com.crm.manager.controller;

import com.crm.manager.service.ib.SysPointFeignService;
import com.crm.rely.backend.core.dto.base.BaseDropDownDto;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.base.BaseResultWithPagerDto;
import com.crm.rely.backend.core.dto.ib.point.SysPointDto;
import com.crm.rely.backend.core.dto.ib.point.SysPointPointsDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.custom.info.InfoEntity;
import com.crm.rely.backend.core.entity.ib.point.SysPointAddEntity;
import com.crm.rely.backend.core.entity.ib.point.SysPointListEntity;
import com.crm.rely.backend.core.entity.ib.point.SysPointUpdateEntity;
import org.springframework.beans.factory.annotation.Autowired;
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;

/**
 * Created by max on 2020/8/25.
 */
@RestController
@RequestMapping("/sys/point")
public class SysPointController {

    @Autowired
    private SysPointFeignService sysPointFeignService;


    @PostMapping("/list")
    public BaseResultWithPagerDto<List<SysPointDto>> getList(@RequestBody SysPointListEntity entity, InfoEntity infoEntity) throws Exception {
        return sysPointFeignService.getList(entity);
    }

    @PostMapping("/single")
    public BaseResultDto<SysPointDto> getOne(@RequestBody SingleLongEntity entity, InfoEntity infoEntity) throws Exception {
        return sysPointFeignService.getOne(entity);
    }

    @PostMapping("/update")
    public BaseResultDto<Object> update(@RequestBody SysPointUpdateEntity entity, InfoEntity infoEntity) throws Exception {
        return sysPointFeignService.update(entity);
    }

    @PostMapping("/points")
    public BaseResultDto<SysPointPointsDto> points() throws Exception {
        return sysPointFeignService.points();
    }

    @PostMapping("/ddList")
    public BaseResultDto<List<BaseDropDownDto>> ddList() throws Exception {
        return sysPointFeignService.areaDdList();
    }

    @PostMapping("/add")
    public BaseResultDto<Object> add(@RequestBody SysPointAddEntity entity) throws Exception {
        return sysPointFeignService.add(entity);
    }
}
