新增渠道管理

This commit is contained in:
liuminghui
2026-10-29 16:30:15 +08:00
parent c3456ca92a
commit b091d47f64
9 changed files with 898 additions and 7 deletions
@@ -1,17 +1,29 @@
package com.bms.web.controller.masterdata;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bms.common.annotation.Log;
import com.bms.common.core.controller.BaseController;
import com.bms.common.core.domain.AjaxResult;
import com.bms.common.core.page.TableDataInfo;
import com.bms.common.enums.BusinessType;
import com.bms.common.utils.poi.ExcelUtil;
import com.bms.masterdata.domain.ServiceChannel;
import com.bms.masterdata.service.IServiceChannelService;
/**
* 服务渠道(老系统镜像 srv_service_channel)
* 渠道管理(srv_service_channel)
* 下拉选项仍走 /optionselect,登录即可,供供应商绑定渠道使用。
*
* @author bms
* @date 2026-10-12
@@ -23,6 +35,32 @@ public class ServiceChannelController extends BaseController
@Autowired
private IServiceChannelService serviceChannelService;
/**
* 分页查询渠道列表。
* 渠道编码、渠道名称、服务商编码、服务商名称、目的港/目的地区域、发货人名称均可检索,名称类条件为模糊匹配。
*/
@PreAuthorize("@ss.hasPermi('data:serviceChannel:list')")
@GetMapping("/list")
public TableDataInfo list(ServiceChannel query)
{
startPage();
List<ServiceChannel> list = serviceChannelService.selectServiceChannelList(query);
return getDataTable(list);
}
/**
* 导出渠道列表,筛选条件与列表一致。
*/
@PreAuthorize("@ss.hasPermi('data:serviceChannel:export')")
@Log(title = "渠道管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ServiceChannel query)
{
List<ServiceChannel> list = serviceChannelService.selectServiceChannelList(query);
ExcelUtil<ServiceChannel> util = new ExcelUtil<ServiceChannel>(ServiceChannel.class);
util.exportExcel(response, list, "渠道数据");
}
/**
* 服务渠道下拉选项(非分页)。
* 供供应商绑定渠道等场景选择渠道;不做权限控制(仍需登录)。
@@ -33,4 +71,63 @@ public class ServiceChannelController extends BaseController
List<ServiceChannel> list = serviceChannelService.selectServiceChannelList(query);
return success(list);
}
/**
* 查询渠道详情
*/
@PreAuthorize("@ss.hasPermi('data:serviceChannel:query')")
@GetMapping("/{id}")
public AjaxResult getInfo(@PathVariable String id)
{
return success(serviceChannelService.selectServiceChannelById(id));
}
/**
* 新增渠道
*/
@PreAuthorize("@ss.hasPermi('data:serviceChannel:add')")
@Log(title = "渠道管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ServiceChannel channel)
{
String username = getUsername();
channel.setCreateName(username);
channel.setModifier(username);
return toAjax(serviceChannelService.insertServiceChannel(channel));
}
/**
* 修改渠道
*/
@PreAuthorize("@ss.hasPermi('data:serviceChannel:edit')")
@Log(title = "渠道管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ServiceChannel channel)
{
channel.setModifier(getUsername());
return toAjax(serviceChannelService.updateServiceChannel(channel));
}
/**
* 启用或停用渠道
*/
@PreAuthorize("@ss.hasPermi('data:serviceChannel:edit')")
@Log(title = "渠道管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody ServiceChannel channel)
{
channel.setModifier(getUsername());
return toAjax(serviceChannelService.updateServiceChannelStatus(channel));
}
/**
* 删除渠道。已被产品渠道或供应商引用时不允许删除。
*/
@PreAuthorize("@ss.hasPermi('data:serviceChannel:remove')")
@Log(title = "渠道管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(serviceChannelService.deleteServiceChannelByIds(ids));
}
}