package com.kym.admin.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.kym.common.R;
import com.kym.common.annotation.SysLog;
import com.kym.common.controller.IController;
import com.kym.entity.admin.AdminUserStation;
import com.kym.entity.admin.queryParams.CommonQueryParam;
import com.kym.service.admin.AdminUserStationService;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * <p>
 * admin用户站点
 * </p>
 *
 * @author skyline
 * @since 2023-07-11
 */
@RestController
@RequestMapping("/admin-user-station")
public class AdminUserStationController extends IController {

    private final AdminUserStationService adminUserStationService;


    public AdminUserStationController(AdminUserStationService adminUserStationService) {
        this.adminUserStationService = adminUserStationService;
    }


    @GetMapping("/list")
    @SysLog("admin用户站点-查询")
    public R<?> list(@ModelAttribute CommonQueryParam commonQueryParam) {
        return resp(() -> adminUserStationService.listUserStation(commonQueryParam));
    }


    @PostMapping("/save")
    @SaCheckPermission("user.modify")
    @SysLog(value = "admin用户站点-保存", ignoreParams = true)
    public R<?> saveUserStation(@RequestBody List<AdminUserStation> userStationList) {
        return resp((t) -> adminUserStationService.saveUserStation(userStationList));
    }


}
