package io.renren.modules.business.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.business.entity.BusinessProjectEntity;
import io.renren.modules.business.service.BusinessProjectService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
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;

/**
 * @author lsr
 * @version 2022/8/24
 * 工程类别查找
 */

@RestController
@RequestMapping("business/businesssearchbygclbcz")
public class BusinessSearchByGCLBCZController {

    @Autowired
    private BusinessProjectService businessProjectService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("business:businesssearchbygclbcz:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = businessProjectService.queryPage(params);
        return R.ok().put("page", page);
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{projectId}")
    @RequiresPermissions("business:businesssearchbygclbcz:info")
    public R info(@PathVariable("projectId") Integer projectId){
        BusinessProjectEntity businessProject = businessProjectService.getById(projectId);

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