package com.njzscloud.dispose.cst.station.controller;

import com.njzscloud.common.core.utils.R;
import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.dispose.cst.station.pojo.entity.StationMemberEntity;
import com.njzscloud.dispose.cst.station.service.StationMemberService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 站点成员
 */
@Slf4j
@RestController
@RequestMapping("/station_member")
@RequiredArgsConstructor
public class StationMemberController {
    private final StationMemberService stationMemberService;

    /**
     * 新增
     */
    @PostMapping("/add")
    public R<?> add(@RequestBody StationMemberEntity stationMemberEntity) {
        stationMemberService.add(stationMemberEntity);
        return R.success();
    }

    /**
     * 修改
     */
    @PostMapping("/modify")
    public R<?> modify(@RequestBody StationMemberEntity stationMemberEntity) {
        stationMemberService.modify(stationMemberEntity);
        return R.success();
    }

    /**
     * 删除
     */
    @PostMapping("/del")
    public R<?> del(@RequestBody List<Long> ids) {
        stationMemberService.del(ids);
        return R.success();
    }

    /**
     * 详情
     */
    @GetMapping("/detail")
    public R<StationMemberEntity> detail(@RequestParam("id") Long id) {
        return R.success(stationMemberService.detail(id));
    }

    /**
     * 分页查询
     */
    @GetMapping("/paging")
    public R<PageResult<StationMemberEntity>> paging(PageParam pageParam, StationMemberEntity stationMemberEntity) {
        return R.success(stationMemberService.paging(pageParam, stationMemberEntity));
    }
}
