package cn.cecep.talroad.controller;

import cn.cecep.talroad.common.core.web.domain.AjaxResults;
import cn.cecep.talroad.domain.BaseRegionalControlObjectives;
import cn.cecep.talroad.vo.BaseRegionalControlObjectivesVo;
import cn.cecep.talroad.service.BaseRegionalControlObjectivesService;
import cn.cecep.talroad.vo.query.BaseRegionalControlObjectivesQuery;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;

/**
* (base_regional_control_objectives)表控制层---自动生成
*
* @author 李祥厚
*/
@Api(tags = "区域管控目标")
@RestController
@RequestMapping("/regionalControlObj")
public class BaseRegionalControlObjectivesController {

   private static final ReentrantLock lock=new ReentrantLock();
/**
* 服务对象
*/
@Resource
private BaseRegionalControlObjectivesService baseRegionalControlObjectivesService;

    /**
    * 通过主键查询单条数据
    *
    * @param query 主键
    * @return 列表数据
    */
    @ApiOperation(value = "查询区域管控目标列表")
    @GetMapping("/selectList")
    public AjaxResults<IPage<BaseRegionalControlObjectivesVo>>
                    selectList(BaseRegionalControlObjectivesQuery query) {
        return baseRegionalControlObjectivesService.selectList(query);
    }
    /**
     * 通过主键查询单条数据
     *
     * @param data
     * @return 列表数据
     */
    @ApiOperation(value = "区域管控目标保存")
    @PostMapping("/save")
    public AjaxResults<Boolean> saveList(@RequestBody List<BaseRegionalControlObjectives> data) {
        lock.lock();
        AjaxResults<Boolean> save = baseRegionalControlObjectivesService.save(data);
        lock.unlock();
        return save;
    }

}
