mirror of
https://gitee.com/elegant_wings/xiongan-meeting.git
synced 2025-06-22 03:49:36 +08:00
125 lines
3.3 KiB
Java
125 lines
3.3 KiB
Java
![]() |
package com.ics.admin.controller;
|
||
|
|
||
|
import com.ics.admin.domain.Park;
|
||
|
import com.ics.admin.service.IParkService;
|
||
|
import com.ics.common.core.controller.BaseController;
|
||
|
import com.ics.common.core.domain.R;
|
||
|
import com.ics.common.utils.DateUtils;
|
||
|
import com.ics.common.utils.ValidatorUtils;
|
||
|
import com.ics.system.domain.Dept;
|
||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
import org.springframework.web.bind.annotation.*;
|
||
|
import org.wf.jwtp.annotation.Logical;
|
||
|
import org.wf.jwtp.annotation.RequiresPermissions;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* 园区管理 提供者
|
||
|
*
|
||
|
* @author zzm
|
||
|
* @date 2021-03-23
|
||
|
*/
|
||
|
@RestController
|
||
|
@RequestMapping("admin/park")
|
||
|
public class ParkController extends BaseController {
|
||
|
|
||
|
@Autowired
|
||
|
private IParkService parkService;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* 查询园区管理
|
||
|
*/
|
||
|
@RequiresPermissions("admin:park:view")
|
||
|
@GetMapping("get/{id}")
|
||
|
public Park get(@PathVariable("id") Long id) {
|
||
|
return parkService.selectParkById(id);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 查询当前园区
|
||
|
*/
|
||
|
@RequiresPermissions("admin:park:setting")
|
||
|
@GetMapping("getCurrentPark")
|
||
|
public Park getCurrentPark(Park park) {
|
||
|
return parkService.selectCurrentParkByDeptId(park);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 查询园区管理列表
|
||
|
*/
|
||
|
@RequiresPermissions(value = {"admin:park:list", "system:user:list"}, logical = Logical.OR)
|
||
|
@GetMapping("list")
|
||
|
public R list(Park park) {
|
||
|
startPage();
|
||
|
return result(parkService.selectParkList(park));
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* 新增保存园区管理
|
||
|
*/
|
||
|
@RequiresPermissions("admin:park:add")
|
||
|
@PostMapping("save")
|
||
|
public R addSave(@RequestBody Park park) {
|
||
|
ValidatorUtils.validateEntity(park);
|
||
|
if (parkService.exists("name", park.getName())) {
|
||
|
return R.error("园区名称重复!");
|
||
|
}
|
||
|
park.setIsMarketable(false);
|
||
|
return toAjax(parkService.insertPark(park));
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 修改保存园区管理
|
||
|
*/
|
||
|
@RequiresPermissions("admin:park:edit")
|
||
|
@PostMapping("update")
|
||
|
public R editSave(@RequestBody Park park) {
|
||
|
ValidatorUtils.validateEntity(park);
|
||
|
if (parkService.unique(park.getId(), "name", park.getName())) {
|
||
|
return R.error("园区名称重复!");
|
||
|
}
|
||
|
return toAjax(parkService.updatePark(park));
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* 园区状态修改
|
||
|
*/
|
||
|
@RequiresPermissions("admin:park:edit")
|
||
|
@PostMapping("/changeMarketable")
|
||
|
public R changeMarketable(@RequestBody Park park) {
|
||
|
Park newPark = parkService.selectParkById(park.getId());
|
||
|
if (newPark == null) {
|
||
|
return R.error("园区不存在!");
|
||
|
}
|
||
|
park.setMarketableTime(DateUtils.getNowDate());
|
||
|
return toAjax(parkService.updatePark(park));
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 删除园区管理
|
||
|
*/
|
||
|
@RequiresPermissions("admin:park:remove")
|
||
|
@PostMapping("remove")
|
||
|
public R remove(String ids) {
|
||
|
return toAjax(parkService.deleteParkByIds(ids));
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* 初始化园区信息
|
||
|
*/
|
||
|
@RequiresPermissions("admin:park:add")
|
||
|
@PostMapping("initSavePark")
|
||
|
public R initSavePark(@RequestBody Dept dept) {
|
||
|
dept.setCreateBy(getLoginName());
|
||
|
if (parkService.exists("name", dept.getDeptName())) {
|
||
|
return R.error("园区名称重复!");
|
||
|
}
|
||
|
return toAjax(parkService.initPark(dept));
|
||
|
}
|
||
|
|
||
|
}
|