feat(visit): 访问列表新增拜访类型、拜访日期、自填拜访人姓名

配合小程序 pages/visit/index 按「客户拜访」新原型重构为多卡片表单:
- visitType  拜访对象类型(门店/门店经理/其他)
- visitDate  拜访日期
- submitterName 拜访人自填姓名(进页面自动带出账号 realName,仍可改,
  因此可能与 sys_user.real_name 不一致,需独立留痕)

导出表头同步追加三列。其中新增列命名为「自填拜访人姓名」,因为导出中
已有同名字段「提交人姓名」(账号姓名),避免两列表头混淆。

数据库变更见 yxe_visit_list_add_visit_form_fields_2026-10-11.sql(幂等)。
This commit is contained in:
2026-10-11 20:47:22 +08:00
parent 2ae3710a82
commit 6fb298b71b
5 changed files with 96 additions and 0 deletions
@@ -142,6 +142,9 @@ public class YxeVisitListController extends BaseController {
headers.add("提交人手机号"); headers.add("提交人手机号");
headers.add("用户分组"); headers.add("用户分组");
headers.add("拜访人员"); headers.add("拜访人员");
headers.add("拜访类型");
headers.add("拜访日期");
headers.add("自填拜访人姓名");
headers.add("沟通内容"); headers.add("沟通内容");
headers.add("小结"); headers.add("小结");
headers.add("位置"); headers.add("位置");
@@ -165,6 +168,9 @@ public class YxeVisitListController extends BaseController {
rowValues.add(getUserPhone(user)); rowValues.add(getUserPhone(user));
rowValues.add(user == null ? "" : user.getUserGroup()); rowValues.add(user == null ? "" : user.getUserGroup());
rowValues.add(item.getName()); rowValues.add(item.getName());
rowValues.add(item.getVisitType());
rowValues.add(item.getVisitDate());
rowValues.add(item.getSubmitterName());
rowValues.add(item.getContent()); rowValues.add(item.getContent());
rowValues.add(item.getSummary()); rowValues.add(item.getSummary());
rowValues.add(item.getLocation()); rowValues.add(item.getLocation());
@@ -39,6 +39,15 @@ public class YxeVisitList implements Serializable {
@ApiModelProperty(value = "拜访人员") @ApiModelProperty(value = "拜访人员")
private String name; private String name;
@ApiModelProperty(value = "拜访对象类型: 门店/门店经理/其他")
private String visitType;
@ApiModelProperty(value = "拜访日期")
private String visitDate;
@ApiModelProperty(value = "提交人姓名(拜访人自填, 可与账号姓名不同)")
private String submitterName;
@ApiModelProperty(value = "沟通内容") @ApiModelProperty(value = "沟通内容")
private String content; private String content;
@@ -40,6 +40,15 @@
<if test="param.name != null"> <if test="param.name != null">
AND a.name LIKE CONCAT('%', #{param.name}, '%') AND a.name LIKE CONCAT('%', #{param.name}, '%')
</if> </if>
<if test="param.visitType != null">
AND a.visit_type LIKE CONCAT('%', #{param.visitType}, '%')
</if>
<if test="param.visitDate != null">
AND a.visit_date LIKE CONCAT('%', #{param.visitDate}, '%')
</if>
<if test="param.submitterName != null">
AND a.submitter_name LIKE CONCAT('%', #{param.submitterName}, '%')
</if>
<if test="param.content != null"> <if test="param.content != null">
AND a.content LIKE CONCAT('%', #{param.content}, '%') AND a.content LIKE CONCAT('%', #{param.content}, '%')
</if> </if>
@@ -54,6 +54,15 @@ public class YxeVisitListParam extends BaseParam {
@ApiModelProperty(value = "拜访人员") @ApiModelProperty(value = "拜访人员")
private String name; private String name;
@ApiModelProperty(value = "拜访对象类型: 门店/门店经理/其他")
private String visitType;
@ApiModelProperty(value = "拜访日期")
private String visitDate;
@ApiModelProperty(value = "提交人姓名")
private String submitterName;
@ApiModelProperty(value = "沟通内容") @ApiModelProperty(value = "沟通内容")
private String content; private String content;
@@ -0,0 +1,63 @@
-- 用途:yxe_visit_list 表新增客户拜访表单字段(拜访对象类型、拜访日期、提交人姓名)
-- 日期:2026-10-11
-- 背景:小程序 pages/visit/index 按「客户拜访」新原型重构为多卡片表单:
-- 1) 新增「拜访对象 - 类型」(门店 / 门店经理 / 其他);
-- 2) 新增「拜访信息 - 拜访日期」,默认当天;
-- 3) 新增「我的信息 - 姓名」,进页面自动带出账号 real_name,仍允许修改,
-- 因此与 sys_user.real_name 可能不一致,需要独立字段留痕。
-- 三项均为本次新增,历史记录该字段为空(前端展示为 "-")。
-- 影响:ALTER 语句本身 0 行;已有历史数据新增列为 NULL,不做回填。
-- 性质:幂等,可重复执行(通过 information_schema 判断列是否存在后再 ADD)
-- 配套代码:
-- yxe-java YxeVisitList.java / YxeVisitListParam.java / YxeVisitListMapper.xml
-- / YxeVisitListController.java(导出表头)
-- yxe-mp pages/visit/index.vue
-- yxe-admin src/api/yxe/yxeVisitList/model、列表列、详情、编辑弹窗
-- 执行前核对(应为 0 行,即三列均不存在)
SELECT COLUMN_NAME
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'yxe_visit_list'
AND COLUMN_NAME IN ('visit_type', 'visit_date', 'submitter_name');
-- 变更:按列分别判断,已存在则跳过
SET @db := DATABASE();
SET @sql := IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'yxe_visit_list' AND COLUMN_NAME = 'visit_type') = 0,
'ALTER TABLE `yxe_visit_list` ADD COLUMN `visit_type` varchar(16) DEFAULT NULL COMMENT ''拜访对象类型: 门店/门店经理/其他'' AFTER `name`',
'SELECT ''visit_type already exists'' AS skipped'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @sql := IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'yxe_visit_list' AND COLUMN_NAME = 'visit_date') = 0,
'ALTER TABLE `yxe_visit_list` ADD COLUMN `visit_date` varchar(32) DEFAULT NULL COMMENT ''拜访日期'' AFTER `visit_type`',
'SELECT ''visit_date already exists'' AS skipped'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @sql := IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'yxe_visit_list' AND COLUMN_NAME = 'submitter_name') = 0,
'ALTER TABLE `yxe_visit_list` ADD COLUMN `submitter_name` varchar(64) DEFAULT NULL COMMENT ''提交人姓名(拜访人自填)'' AFTER `visit_date`',
'SELECT ''submitter_name already exists'' AS skipped'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
-- 执行后核对(应为 3 行,且类型/注释符合预期)
SELECT COLUMN_NAME, COLUMN_TYPE, IS_NULLABLE, COLUMN_COMMENT, ORDINAL_POSITION
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'yxe_visit_list'
AND COLUMN_NAME IN ('visit_type', 'visit_date', 'submitter_name')
ORDER BY ORDINAL_POSITION;