package io.renren.modules.sys.controller.dataset;


import io.renren.common.utils.Constant;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.sys.service.DataSetDyService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

import static io.renren.common.utils.ShiroUtils.getUserId;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author allen
 * @since 2021-08-04
 */
@RestController
@RequestMapping("/datasetdy")
public class DataSetDyController {
    @Autowired
    DataSetDyService dataSetDyService;

    @GetMapping("/list")
    @RequiresPermissions("dataset:list")
    public R list(@RequestParam Map<String, Object> params){
        //只有超级管理员，才能查看所有模板列表
        //先这样写，之后去掉
        if(getUserId() != Constant.SUPER_ADMIN){
            params.put("createUserId", getUserId());
        }
        PageUtils page = dataSetDyService.queryPageOnUse(params);


        return R.ok().put("page", page);
    }
}

