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.

107 lines
3.6 KiB

package com.ruoyi.zongzhi.controller;
import java.util.List;
import io.swagger.annotations.Api;
import javax.servlet.http.HttpServletResponse;
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.zongzhi.domain.TcDengbaoUnit;
import com.ruoyi.zongzhi.service.ITcDengbaoUnitService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 等保单位Controller
*
* @author ruoyi
* @date 2023-08-10
*/
@RestController
@RequestMapping("/zongzhi/dengbaounit")
@Api(tags = " 等保单位")
public class TcDengbaoUnitController extends BaseController
{
@Autowired
private ITcDengbaoUnitService tcDengbaoUnitService;
/**
* 查询等保单位列表
*/
@PreAuthorize("@ss.hasPermi('zongzhi:unit:list')")
@GetMapping("/list")
public TableDataInfo list(TcDengbaoUnit tcDengbaoUnit)
{
startPage();
List<TcDengbaoUnit> list = tcDengbaoUnitService.selectTcDengbaoUnitList(tcDengbaoUnit);
return getDataTable(list);
}
/**
* 导出等保单位列表
*/
@PreAuthorize("@ss.hasPermi('zongzhi:unit:export')")
@Log(title = "等保单位", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TcDengbaoUnit tcDengbaoUnit)
{
List<TcDengbaoUnit> list = tcDengbaoUnitService.selectTcDengbaoUnitList(tcDengbaoUnit);
ExcelUtil<TcDengbaoUnit> util = new ExcelUtil<TcDengbaoUnit>(TcDengbaoUnit.class);
util.exportExcel(response, list, "等保单位数据");
}
/**
* 获取等保单位详细信息
*/
@PreAuthorize("@ss.hasPermi('zongzhi:unit:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(tcDengbaoUnitService.selectTcDengbaoUnitById(id));
}
/**
* 新增等保单位
*/
@PreAuthorize("@ss.hasPermi('zongzhi:unit:add')")
@Log(title = "等保单位", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TcDengbaoUnit tcDengbaoUnit)
{
return toAjax(tcDengbaoUnitService.insertTcDengbaoUnit(tcDengbaoUnit));
}
/**
* 修改等保单位
*/
@PreAuthorize("@ss.hasPermi('zongzhi:unit:edit')")
@Log(title = "等保单位", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TcDengbaoUnit tcDengbaoUnit)
{
return toAjax(tcDengbaoUnitService.updateTcDengbaoUnit(tcDengbaoUnit));
}
/**
* 删除等保单位
*/
@PreAuthorize("@ss.hasPermi('zongzhi:unit:remove')")
@Log(title = "等保单位", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tcDengbaoUnitService.deleteTcDengbaoUnitByIds(ids));
}
}