package com.ruoyi.hezhi.controller; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.hezhi.domain.TbPostAddress; import com.ruoyi.hezhi.service.ITbPostAddressService; 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 ruoyi * @date 2024-11-20 */ @RestController @RequestMapping("/hezhi/postAddress") public class TbPostAddressController extends BaseController { @Autowired private ITbPostAddressService tbPostAddressService; /** * 查询邮寄地址列表 */ @PreAuthorize("@ss.hasPermi('hezhi:postAddress:list')") @GetMapping("/list") public TableDataInfo list(TbPostAddress tbPostAddress) { startPage(); List list = tbPostAddressService.selectTbPostAddressList(tbPostAddress); return getDataTable(list); } /** * 导出邮寄地址列表 */ @PreAuthorize("@ss.hasPermi('hezhi:postAddress:export')") @Log(title = "邮寄地址", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, TbPostAddress tbPostAddress) { List list = tbPostAddressService.selectTbPostAddressList(tbPostAddress); ExcelUtil util = new ExcelUtil(TbPostAddress.class); util.exportExcel(response, list, "邮寄地址数据"); } /** * 获取邮寄地址详细信息 */ @PreAuthorize("@ss.hasPermi('hezhi:postAddress:query')") @GetMapping(value = "/{postAddressId}") public AjaxResult getInfo(@PathVariable("postAddressId") Long postAddressId) { return success(tbPostAddressService.selectTbPostAddressByPostAddressId(postAddressId)); } /** * 新增邮寄地址 */ @PreAuthorize("@ss.hasPermi('hezhi:postAddress:add')") @Log(title = "邮寄地址", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody TbPostAddress tbPostAddress) { return toAjax(tbPostAddressService.insertTbPostAddress(tbPostAddress)); } /** * 修改邮寄地址 */ @PreAuthorize("@ss.hasPermi('hezhi:postAddress:edit')") @Log(title = "邮寄地址", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody TbPostAddress tbPostAddress) { return toAjax(tbPostAddressService.updateTbPostAddress(tbPostAddress)); } /** * 删除邮寄地址 */ @PreAuthorize("@ss.hasPermi('hezhi:postAddress:remove')") @Log(title = "邮寄地址", businessType = BusinessType.DELETE) @DeleteMapping("/{postAddressIds}") public AjaxResult remove(@PathVariable Long[] postAddressIds) { return toAjax(tbPostAddressService.deleteTbPostAddressByPostAddressIds(postAddressIds)); } }