107 lines
3.4 KiB
Java
107 lines
3.4 KiB
Java
package com.klp.controller;
|
|
|
|
import java.util.List;
|
|
import java.util.Arrays;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.validation.constraints.*;
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import com.klp.common.annotation.RepeatSubmit;
|
|
import com.klp.common.annotation.Log;
|
|
import com.klp.common.core.controller.BaseController;
|
|
import com.klp.common.core.domain.PageQuery;
|
|
import com.klp.common.core.domain.R;
|
|
import com.klp.common.core.validate.AddGroup;
|
|
import com.klp.common.core.validate.EditGroup;
|
|
import com.klp.common.enums.BusinessType;
|
|
import com.klp.common.utils.poi.ExcelUtil;
|
|
import com.klp.domain.vo.WmsCustomerVo;
|
|
import com.klp.domain.bo.WmsCustomerBo;
|
|
import com.klp.service.IWmsCustomerService;
|
|
import com.klp.common.core.page.TableDataInfo;
|
|
|
|
/**
|
|
* CRM 客户
|
|
*
|
|
* @author Joshi
|
|
* @date 2025-08-12
|
|
*/
|
|
@Validated
|
|
@RequiredArgsConstructor
|
|
@RestController
|
|
@RequestMapping("/wms/customer")
|
|
public class WmsCustomerController extends BaseController {
|
|
|
|
private final IWmsCustomerService iWmsCustomerService;
|
|
|
|
/**
|
|
* 查询CRM 客户列表
|
|
*/
|
|
@SaCheckPermission("wms:customer:list")
|
|
@GetMapping("/list")
|
|
public TableDataInfo<WmsCustomerVo> list(WmsCustomerBo bo, PageQuery pageQuery) {
|
|
return iWmsCustomerService.queryPageList(bo, pageQuery);
|
|
}
|
|
|
|
/**
|
|
* 导出CRM 客户列表
|
|
*/
|
|
@SaCheckPermission("wms:customer:export")
|
|
@Log(title = "CRM 客户", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
public void export(WmsCustomerBo bo, HttpServletResponse response) {
|
|
List<WmsCustomerVo> list = iWmsCustomerService.queryList(bo);
|
|
ExcelUtil.exportExcel(list, "CRM 客户", WmsCustomerVo.class, response);
|
|
}
|
|
|
|
/**
|
|
* 获取CRM 客户详细信息
|
|
*
|
|
* @param customerId 主键
|
|
*/
|
|
@SaCheckPermission("wms:customer:query")
|
|
@GetMapping("/{customerId}")
|
|
public R<WmsCustomerVo> getInfo(@NotNull(message = "主键不能为空")
|
|
@PathVariable Long customerId) {
|
|
return R.ok(iWmsCustomerService.queryById(customerId));
|
|
}
|
|
|
|
/**
|
|
* 新增CRM 客户
|
|
*/
|
|
@SaCheckPermission("wms:customer:add")
|
|
@Log(title = "CRM 客户", businessType = BusinessType.INSERT)
|
|
@RepeatSubmit()
|
|
@PostMapping()
|
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsCustomerBo bo) {
|
|
return toAjax(iWmsCustomerService.insertByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 修改CRM 客户
|
|
*/
|
|
@SaCheckPermission("wms:customer:edit")
|
|
@Log(title = "CRM 客户", businessType = BusinessType.UPDATE)
|
|
@RepeatSubmit()
|
|
@PutMapping()
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsCustomerBo bo) {
|
|
return toAjax(iWmsCustomerService.updateByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 删除CRM 客户
|
|
*
|
|
* @param customerIds 主键串
|
|
*/
|
|
@SaCheckPermission("wms:customer:remove")
|
|
@Log(title = "CRM 客户", businessType = BusinessType.DELETE)
|
|
@DeleteMapping("/{customerIds}")
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
@PathVariable Long[] customerIds) {
|
|
return toAjax(iWmsCustomerService.deleteWithValidByIds(Arrays.asList(customerIds), true));
|
|
}
|
|
}
|