Files
usdt/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomHsCodeController.java
T
2025-12-02 23:07:47 +08:00

104 lines
3.4 KiB
Java

package com.ruoyi.custom.controller;
import java.util.List;
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.custom.domain.CustomHsCode;
import com.ruoyi.custom.service.ICustomHsCodeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* HS编码Controller
*
* @author luqj
* @date 2021-10-23
*/
@RestController
@RequestMapping("/custom/hsCode")
public class CustomHsCodeController extends BaseController
{
@Autowired
private ICustomHsCodeService customHsCodeService;
/**
* 查询HS编码列表
*/
@PreAuthorize("@ss.hasPermi('custom:hsCode:list')")
@GetMapping("/list")
public TableDataInfo list(CustomHsCode customHsCode)
{
startPage();
List<CustomHsCode> list = customHsCodeService.selectCustomHsCodeList(customHsCode);
return getDataTable(list);
}
/**
* 导出HS编码列表
*/
@PreAuthorize("@ss.hasPermi('custom:hsCode:export')")
@Log(title = "HS编码", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(CustomHsCode customHsCode)
{
List<CustomHsCode> list = customHsCodeService.selectCustomHsCodeList(customHsCode);
ExcelUtil<CustomHsCode> util = new ExcelUtil<CustomHsCode>(CustomHsCode.class);
return util.exportExcel(list, "hsCode");
}
/**
* 获取HS编码详细信息
*/
@PreAuthorize("@ss.hasPermi('custom:hsCode:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(customHsCodeService.selectCustomHsCodeById(id));
}
/**
* 新增HS编码
*/
@PreAuthorize("@ss.hasPermi('custom:hsCode:add')")
@Log(title = "HS编码", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CustomHsCode customHsCode)
{
return toAjax(customHsCodeService.insertCustomHsCode(customHsCode));
}
/**
* 修改HS编码
*/
@PreAuthorize("@ss.hasPermi('custom:hsCode:edit')")
@Log(title = "HS编码", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CustomHsCode customHsCode)
{
return toAjax(customHsCodeService.updateCustomHsCode(customHsCode));
}
/**
* 删除HS编码
*/
@PreAuthorize("@ss.hasPermi('custom:hsCode:remove')")
@Log(title = "HS编码", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(customHsCodeService.deleteCustomHsCodeByIds(ids));
}
}