You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
140 lines
4.8 KiB
Java
140 lines
4.8 KiB
Java
package com.ruoyi.base.controller;
|
|
|
|
import java.util.List;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import com.ruoyi.base.domain.CabinetAndBusbarTree;
|
|
import com.ruoyi.base.domain.baseCabinetInfoTreeSelects;
|
|
import com.ruoyi.base.service.ICabinetAndBusbarTreeService;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import com.ruoyi.common.annotation.Log;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
import com.ruoyi.base.domain.BaseCabinetInfo;
|
|
import com.ruoyi.base.service.IBaseCabinetInfoService;
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
/**
|
|
* 电柜信息Controller
|
|
*
|
|
* @author ruoyi
|
|
* @date 2024-10-31
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/base/baseCabinetInfo")
|
|
public class BaseCabinetInfoController extends BaseController
|
|
{
|
|
@Autowired
|
|
private IBaseCabinetInfoService baseCabinetInfoService;
|
|
|
|
@Autowired
|
|
private ICabinetAndBusbarTreeService cabinetAndBusbarTreeService;
|
|
|
|
/**
|
|
* 查询电柜信息列表
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('base:baseCabinetInfo:list')")
|
|
@GetMapping("/list")
|
|
public TableDataInfo list(BaseCabinetInfo baseCabinetInfo)
|
|
{
|
|
startPage();
|
|
List<BaseCabinetInfo> list = baseCabinetInfoService.selectBaseCabinetInfoList(baseCabinetInfo);
|
|
return getDataTable(list);
|
|
}
|
|
|
|
/**
|
|
* 导出电柜信息列表
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('base:baseCabinetInfo:export')")
|
|
@Log(title = "电柜信息", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
public void export(HttpServletResponse response, BaseCabinetInfo baseCabinetInfo)
|
|
{
|
|
List<BaseCabinetInfo> list = baseCabinetInfoService.selectBaseCabinetInfoList(baseCabinetInfo);
|
|
ExcelUtil<BaseCabinetInfo> util = new ExcelUtil<BaseCabinetInfo>(BaseCabinetInfo.class);
|
|
util.exportExcel(response, list, "电柜信息数据");
|
|
}
|
|
|
|
/**
|
|
* 获取电柜信息详细信息
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('base:baseCabinetInfo:query')")
|
|
@GetMapping(value = "/{objId}")
|
|
public AjaxResult getInfo(@PathVariable("objId") Long objId)
|
|
{
|
|
return success(baseCabinetInfoService.selectBaseCabinetInfoByObjId(objId));
|
|
}
|
|
|
|
/**
|
|
* 新增电柜信息
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('base:baseCabinetInfo:add')")
|
|
@Log(title = "电柜信息", businessType = BusinessType.INSERT)
|
|
@PostMapping
|
|
public AjaxResult add(@RequestBody BaseCabinetInfo baseCabinetInfo)
|
|
{
|
|
return toAjax(baseCabinetInfoService.insertBaseCabinetInfo(baseCabinetInfo));
|
|
}
|
|
|
|
/**
|
|
* 修改电柜信息
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('base:baseCabinetInfo:edit')")
|
|
@Log(title = "电柜信息", businessType = BusinessType.UPDATE)
|
|
@PutMapping
|
|
public AjaxResult edit(@RequestBody BaseCabinetInfo baseCabinetInfo)
|
|
{
|
|
return toAjax(baseCabinetInfoService.updateBaseCabinetInfo(baseCabinetInfo));
|
|
}
|
|
|
|
/**
|
|
* 删除电柜信息
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('base:baseCabinetInfo:remove')")
|
|
@Log(title = "电柜信息", businessType = BusinessType.DELETE)
|
|
@DeleteMapping("/{objIds}")
|
|
public AjaxResult remove(@PathVariable Long[] objIds)
|
|
{
|
|
return toAjax(baseCabinetInfoService.deleteBaseCabinetInfoByObjIds(objIds));
|
|
}
|
|
|
|
/**
|
|
* 查询电柜信息下拉树结构
|
|
* */
|
|
@PostMapping("/getBaseCabinetInfoTree")
|
|
public AjaxResult getBaseCabinetInfoTree(@RequestBody BaseCabinetInfo baseCabinetInfo) {
|
|
List<baseCabinetInfoTreeSelects> list = baseCabinetInfoService.selectCabinetInfoTreeList(baseCabinetInfo);
|
|
return success(list);
|
|
}
|
|
/**
|
|
* 查询电柜和母排信息下拉树结构
|
|
* 电柜信息的子节点是母排信息
|
|
* */
|
|
@PostMapping("/CabinetAndBusbarTree")
|
|
public AjaxResult CabinetAndBusbarTree(@RequestBody BaseCabinetInfo baseCabinetInfo) {
|
|
List<CabinetAndBusbarTree> list = cabinetAndBusbarTreeService.selectCabinetAndBusbarTree(baseCabinetInfo);
|
|
return success(list);
|
|
}
|
|
|
|
/**
|
|
* 统计电柜数量
|
|
* */
|
|
@PostMapping("/countCabinet")
|
|
public int countCabinet() {
|
|
return baseCabinetInfoService.countBaseCabinetInfo();
|
|
}
|
|
|
|
|
|
}
|