package com.zhongzheng.controller.distribution; import com.zhongzheng.common.annotation.Log; import com.zhongzheng.common.core.controller.BaseController; import com.zhongzheng.common.core.domain.AjaxResult; import com.zhongzheng.common.core.page.TableDataInfo; import com.zhongzheng.common.enums.BusinessType; import com.zhongzheng.common.utils.poi.ExcelUtil; import com.zhongzheng.modules.distribution.bo.DistributionSalesmanAddBo; import com.zhongzheng.modules.distribution.bo.DistributionSalesmanEditBo; import com.zhongzheng.modules.distribution.bo.DistributionSalesmanQueryBo; import com.zhongzheng.modules.distribution.service.IDistributionSalesmanService; import com.zhongzheng.modules.distribution.vo.DistributionSalesmanVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.Arrays; import java.util.List; /** * 【请填写功能名称】Controller * * @author ruoyi * @date 2023-03-06 */ @Api(value = "【请填写功能名称】控制器", tags = {"【请填写功能名称】管理"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/salesman") public class DistributionSalesmanController extends BaseController { private final IDistributionSalesmanService iDistributionSalesmanService; /** * 查询【请填写功能名称】列表 */ @ApiOperation("查询【请填写功能名称】列表") @PreAuthorize("@ss.hasPermi('system:salesman:list')") @GetMapping("/list") public TableDataInfo list(DistributionSalesmanQueryBo bo) { startPage(); List list = iDistributionSalesmanService.queryList(bo); return getDataTable(list); } /** * 导出【请填写功能名称】列表 */ @ApiOperation("导出【请填写功能名称】列表") @PreAuthorize("@ss.hasPermi('system:salesman:export')") @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(DistributionSalesmanQueryBo bo) { List list = iDistributionSalesmanService.queryList(bo); ExcelUtil util = new ExcelUtil(DistributionSalesmanVo.class); return util.exportExcel(list, "【请填写功能名称】"); } /** * 获取【请填写功能名称】详细信息 */ @ApiOperation("获取【请填写功能名称】详细信息") @PreAuthorize("@ss.hasPermi('system:salesman:query')") @GetMapping("/{salesmanId}") public AjaxResult getInfo(@PathVariable("salesmanId" ) Long salesmanId) { return AjaxResult.success(iDistributionSalesmanService.queryById(salesmanId)); } /** * 新增【请填写功能名称】 */ @ApiOperation("新增【请填写功能名称】") @PreAuthorize("@ss.hasPermi('system:salesman:add')") @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT) @PostMapping() public AjaxResult add(@RequestBody DistributionSalesmanAddBo bo) { return toAjax(iDistributionSalesmanService.insertByAddBo(bo) ? 1 : 0); } /** * 修改【请填写功能名称】 */ @ApiOperation("修改【请填写功能名称】") @PreAuthorize("@ss.hasPermi('system:salesman:edit')") @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE) @PutMapping() public AjaxResult edit(@RequestBody DistributionSalesmanEditBo bo) { return toAjax(iDistributionSalesmanService.updateByEditBo(bo) ? 1 : 0); } /** * 删除【请填写功能名称】 */ @ApiOperation("删除【请填写功能名称】") @PreAuthorize("@ss.hasPermi('system:salesman:remove')") @Log(title = "【请填写功能名称】" , businessType = BusinessType.DELETE) @DeleteMapping("/{salesmanIds}") public AjaxResult remove(@PathVariable Long[] salesmanIds) { return toAjax(iDistributionSalesmanService.deleteWithValidByIds(Arrays.asList(salesmanIds), true) ? 1 : 0); } }