You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
3.4 KiB

package com.da.dangan.controller;
import com.da.common.annotation.Log;
import com.da.common.core.controller.BaseController;
import com.da.common.core.domain.AjaxResult;
import com.da.common.core.page.TableDataInfo;
import com.da.common.enums.BusinessType;
import com.da.common.utils.poi.ExcelUtil;
import com.da.dangan.domain.DaBookshelf;
import com.da.dangan.service.IDaBookshelfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 物理书架Controller
*
* @author hs
* @date 2024-05-11
*/
@RestController
@RequestMapping("/dangan/bookshelf")
public class DaBookshelfController extends BaseController
{
@Autowired
private IDaBookshelfService daBookshelfService;
/**
* 查询物理书架列表
*/
@PreAuthorize("@ss.hasPermi('dangan:bookshelf:list')")
@GetMapping("/list")
public TableDataInfo list(DaBookshelf daBookshelf)
{
// startPage();
List<DaBookshelf> list = daBookshelfService.selectDaBookshelfList(daBookshelf);
return getDataTable(list);
}
/**
* 导出物理书架列表
*/
@PreAuthorize("@ss.hasPermi('dangan:bookshelf:export')")
@Log(title = "物理书架", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DaBookshelf daBookshelf)
{
List<DaBookshelf> list = daBookshelfService.selectDaBookshelfList(daBookshelf);
ExcelUtil<DaBookshelf> util = new ExcelUtil<DaBookshelf>(DaBookshelf.class);
util.exportExcel(response, list, "物理书架数据");
}
/**
* 获取物理书架详细信息
*/
@PreAuthorize("@ss.hasPermi('dangan:bookshelf:query')")
@GetMapping(value = "/{shelfId}")
public AjaxResult getInfo(@PathVariable("shelfId") Long shelfId)
{
return success(daBookshelfService.selectDaBookshelfByShelfId(shelfId));
}
/**
* 新增物理书架
*/
@PreAuthorize("@ss.hasPermi('dangan:bookshelf:add')")
@Log(title = "物理书架", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DaBookshelf daBookshelf)
{
daBookshelf.setCreateBy(getUsername());
return toAjax(daBookshelfService.insertDaBookshelf(daBookshelf));
}
/**
* 修改物理书架
*/
@PreAuthorize("@ss.hasPermi('dangan:bookshelf:edit')")
@Log(title = "物理书架", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DaBookshelf daBookshelf)
{
return toAjax(daBookshelfService.updateDaBookshelf(daBookshelf));
}
/**
* 批量删除物理书架
*/
/* @PreAuthorize("@ss.hasPermi('dangan:bookshelf:remove')")
@Log(title = "物理书架", businessType = BusinessType.DELETE)
@DeleteMapping("/{shelfIds}")
public AjaxResult remove(@PathVariable Long[] shelfIds)
{
return toAjax(daBookshelfService.deleteDaBookshelfByShelfIds(shelfIds));
}*/
/**
* 删除物理书架
*/
@PreAuthorize("@ss.hasPermi('dangan:bookshelf:remove')")
@Log(title = "物理书架", businessType = BusinessType.DELETE)
@DeleteMapping("/{shelfId}")
public AjaxResult remove(@PathVariable Long shelfId)
{
return daBookshelfService.deleteDaBookshelfByShelfId(shelfId);
}
}