feat: 产品销售话术表
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
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.WmsProductSalesScriptVo;
|
||||
import com.klp.domain.bo.WmsProductSalesScriptBo;
|
||||
import com.klp.service.IWmsProductSalesScriptService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 产品销售话术
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-07-24
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/klp/productSalesScript")
|
||||
public class WmsProductSalesScriptController extends BaseController {
|
||||
|
||||
private final IWmsProductSalesScriptService iWmsProductSalesScriptService;
|
||||
|
||||
/**
|
||||
* 查询产品销售话术列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsProductSalesScriptVo> list(WmsProductSalesScriptBo bo, PageQuery pageQuery) {
|
||||
return iWmsProductSalesScriptService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出产品销售话术列表
|
||||
*/
|
||||
@Log(title = "产品销售话术", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsProductSalesScriptBo bo, HttpServletResponse response) {
|
||||
List<WmsProductSalesScriptVo> list = iWmsProductSalesScriptService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "产品销售话术", WmsProductSalesScriptVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品销售话术详细信息
|
||||
*
|
||||
* @param scriptId 主键
|
||||
*/
|
||||
@GetMapping("/{scriptId}")
|
||||
public R<WmsProductSalesScriptVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long scriptId) {
|
||||
return R.ok(iWmsProductSalesScriptService.queryById(scriptId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品销售话术
|
||||
*/
|
||||
@Log(title = "产品销售话术", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsProductSalesScriptBo bo) {
|
||||
return toAjax(iWmsProductSalesScriptService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品销售话术
|
||||
*/
|
||||
@Log(title = "产品销售话术", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsProductSalesScriptBo bo) {
|
||||
return toAjax(iWmsProductSalesScriptService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品销售话术
|
||||
*
|
||||
* @param scriptIds 主键串
|
||||
*/
|
||||
@Log(title = "产品销售话术", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{scriptIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] scriptIds) {
|
||||
return toAjax(iWmsProductSalesScriptService.deleteWithValidByIds(Arrays.asList(scriptIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.klp.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 产品销售话术对象 wms_product_sales_script
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-07-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("wms_product_sales_script")
|
||||
public class WmsProductSalesScript extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "script_id")
|
||||
private Long scriptId;
|
||||
/**
|
||||
* 关联产品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 话术标题/场景
|
||||
*/
|
||||
private String scriptTitle;
|
||||
/**
|
||||
* 话术内容
|
||||
*/
|
||||
private String scriptContent;
|
||||
/**
|
||||
* 产品特性/亮点
|
||||
*/
|
||||
private String featurePoint;
|
||||
/**
|
||||
* 是否启用(0=否,1=是)
|
||||
*/
|
||||
private Integer isEnabled;
|
||||
/**
|
||||
* 删除标志(0=正常,1=已删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.klp.domain.bo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* 产品销售话术业务对象 wms_product_sales_script
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-07-24
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WmsProductSalesScriptBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long scriptId;
|
||||
/**
|
||||
* 关联产品ID
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 话术标题/场景
|
||||
*/
|
||||
private String scriptTitle;
|
||||
|
||||
/**
|
||||
* 话术内容
|
||||
*/
|
||||
private String scriptContent;
|
||||
|
||||
/**
|
||||
* 产品特性/亮点
|
||||
*/
|
||||
private String featurePoint;
|
||||
|
||||
/**
|
||||
* 是否启用(0=否,1=是)
|
||||
*/
|
||||
private Integer isEnabled;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.klp.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 产品销售话术视图对象 wms_product_sales_script
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-07-24
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WmsProductSalesScriptVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 关联产品ID
|
||||
*/
|
||||
@ExcelProperty(value = "关联产品ID")
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 话术标题/场景
|
||||
*/
|
||||
@ExcelProperty(value = "话术标题/场景")
|
||||
private String scriptTitle;
|
||||
|
||||
/**
|
||||
* 话术内容
|
||||
*/
|
||||
@ExcelProperty(value = "话术内容")
|
||||
private String scriptContent;
|
||||
|
||||
/**
|
||||
* 产品特性/亮点
|
||||
*/
|
||||
@ExcelProperty(value = "产品特性/亮点")
|
||||
private String featurePoint;
|
||||
|
||||
/**
|
||||
* 是否启用(0=否,1=是)
|
||||
*/
|
||||
@ExcelProperty(value = "是否启用", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "0==否,1=是")
|
||||
private Integer isEnabled;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 产品编号
|
||||
*/
|
||||
private String productCode;
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
private String productName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.klp.mapper;
|
||||
|
||||
import com.klp.domain.WmsProductSalesScript;
|
||||
import com.klp.domain.vo.WmsProductSalesScriptVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 产品销售话术Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-07-24
|
||||
*/
|
||||
public interface WmsProductSalesScriptMapper extends BaseMapperPlus<WmsProductSalesScriptMapper, WmsProductSalesScript, WmsProductSalesScriptVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.klp.service;
|
||||
|
||||
import com.klp.domain.WmsProductSalesScript;
|
||||
import com.klp.domain.vo.WmsProductSalesScriptVo;
|
||||
import com.klp.domain.bo.WmsProductSalesScriptBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品销售话术Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-07-24
|
||||
*/
|
||||
public interface IWmsProductSalesScriptService {
|
||||
|
||||
/**
|
||||
* 查询产品销售话术
|
||||
*/
|
||||
WmsProductSalesScriptVo queryById(Long scriptId);
|
||||
|
||||
/**
|
||||
* 查询产品销售话术列表
|
||||
*/
|
||||
TableDataInfo<WmsProductSalesScriptVo> queryPageList(WmsProductSalesScriptBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询产品销售话术列表
|
||||
*/
|
||||
List<WmsProductSalesScriptVo> queryList(WmsProductSalesScriptBo bo);
|
||||
|
||||
/**
|
||||
* 新增产品销售话术
|
||||
*/
|
||||
Boolean insertByBo(WmsProductSalesScriptBo bo);
|
||||
|
||||
/**
|
||||
* 修改产品销售话术
|
||||
*/
|
||||
Boolean updateByBo(WmsProductSalesScriptBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除产品销售话术信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.klp.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.domain.bo.WmsProductSalesScriptBo;
|
||||
import com.klp.domain.vo.WmsProductSalesScriptVo;
|
||||
import com.klp.domain.WmsProductSalesScript;
|
||||
import com.klp.mapper.WmsProductSalesScriptMapper;
|
||||
import com.klp.service.IWmsProductSalesScriptService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 产品销售话术Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-07-24
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsProductSalesScriptServiceImpl implements IWmsProductSalesScriptService {
|
||||
|
||||
private final WmsProductSalesScriptMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询产品销售话术
|
||||
*/
|
||||
@Override
|
||||
public WmsProductSalesScriptVo queryById(Long scriptId){
|
||||
return baseMapper.selectVoById(scriptId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品销售话术列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsProductSalesScriptVo> queryPageList(WmsProductSalesScriptBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsProductSalesScript> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsProductSalesScriptVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品销售话术列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsProductSalesScriptVo> queryList(WmsProductSalesScriptBo bo) {
|
||||
LambdaQueryWrapper<WmsProductSalesScript> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WmsProductSalesScript> buildQueryWrapper(WmsProductSalesScriptBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WmsProductSalesScript> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getProductId() != null, WmsProductSalesScript::getProductId, bo.getProductId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getScriptTitle()), WmsProductSalesScript::getScriptTitle, bo.getScriptTitle());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getScriptContent()), WmsProductSalesScript::getScriptContent, bo.getScriptContent());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFeaturePoint()), WmsProductSalesScript::getFeaturePoint, bo.getFeaturePoint());
|
||||
lqw.eq(bo.getIsEnabled() != null, WmsProductSalesScript::getIsEnabled, bo.getIsEnabled());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品销售话术
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsProductSalesScriptBo bo) {
|
||||
WmsProductSalesScript add = BeanUtil.toBean(bo, WmsProductSalesScript.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setScriptId(add.getScriptId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品销售话术
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsProductSalesScriptBo bo) {
|
||||
WmsProductSalesScript update = BeanUtil.toBean(bo, WmsProductSalesScript.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsProductSalesScript entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除产品销售话术
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user