mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 17:38:48 +08:00
Pre Merge pull request !767 from hans/test
This commit is contained in:
commit
afe78cc600
@ -1,6 +1,6 @@
|
|||||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||||
FROM bellsoft/liberica-openjdk-rocky:17.0.16-cds
|
#FROM bellsoft/liberica-openjdk-rocky:17.0.15-cds
|
||||||
#FROM bellsoft/liberica-openjdk-rocky:21.0.8-cds
|
FROM bellsoft/liberica-openjdk-rocky:21.0.7-cds
|
||||||
#FROM findepi/graalvm:java17-native
|
#FROM findepi/graalvm:java17-native
|
||||||
|
|
||||||
LABEL maintainer="Lion Li"
|
LABEL maintainer="Lion Li"
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
--- # 监控中心配置
|
--- # 监控中心配置
|
||||||
spring.boot.admin.client:
|
spring.boot.admin.client:
|
||||||
# 增加客户端开关
|
# 增加客户端开关
|
||||||
enabled: true
|
enabled: false
|
||||||
url: http://localhost:9090/admin
|
url: http://localhost:9090/admin
|
||||||
instance:
|
instance:
|
||||||
service-host-type: IP
|
service-host-type: IP
|
||||||
@ -13,7 +13,7 @@ spring.boot.admin.client:
|
|||||||
|
|
||||||
--- # snail-job 配置
|
--- # snail-job 配置
|
||||||
snail-job:
|
snail-job:
|
||||||
enabled: true
|
enabled: false
|
||||||
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
|
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
|
||||||
group: "ruoyi_group"
|
group: "ruoyi_group"
|
||||||
# SnailJob 接入验证令牌 详见 script/sql/ry_job.sql `sj_group_config` 表
|
# SnailJob 接入验证令牌 详见 script/sql/ry_job.sql `sj_group_config` 表
|
||||||
@ -47,9 +47,9 @@ spring:
|
|||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
url: jdbc:mysql://124.70.21.117:13326/hans?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: Hans123.
|
||||||
# # 从库数据源
|
# # 从库数据源
|
||||||
# slave:
|
# slave:
|
||||||
# lazy: true
|
# lazy: true
|
||||||
@ -96,13 +96,13 @@ spring:
|
|||||||
spring.data:
|
spring.data:
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: localhost
|
host: 124.70.21.117
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 6379
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
database: 0
|
database: 0
|
||||||
# redis 密码必须配置
|
# redis 密码必须配置
|
||||||
password: ruoyi123
|
password: Hans123.
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
# 是否开启ssl
|
# 是否开启ssl
|
||||||
|
|||||||
@ -4,7 +4,7 @@ spring.servlet.multipart.location: /ruoyi/server/temp
|
|||||||
--- # 监控中心配置
|
--- # 监控中心配置
|
||||||
spring.boot.admin.client:
|
spring.boot.admin.client:
|
||||||
# 增加客户端开关
|
# 增加客户端开关
|
||||||
enabled: true
|
enabled: false
|
||||||
url: http://localhost:9090/admin
|
url: http://localhost:9090/admin
|
||||||
instance:
|
instance:
|
||||||
service-host-type: IP
|
service-host-type: IP
|
||||||
@ -16,7 +16,7 @@ spring.boot.admin.client:
|
|||||||
|
|
||||||
--- # snail-job 配置
|
--- # snail-job 配置
|
||||||
snail-job:
|
snail-job:
|
||||||
enabled: true
|
enabled: false
|
||||||
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
|
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
|
||||||
group: "ruoyi_group"
|
group: "ruoyi_group"
|
||||||
# SnailJob 接入验证令牌 详见 script/sql/ry_job.sql `sj_group_config`表
|
# SnailJob 接入验证令牌 详见 script/sql/ry_job.sql `sj_group_config`表
|
||||||
@ -50,9 +50,9 @@ spring:
|
|||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
url: jdbc:mysql://localhost:13326/hans?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: Hans123.
|
||||||
# # 从库数据源
|
# # 从库数据源
|
||||||
# slave:
|
# slave:
|
||||||
# lazy: true
|
# lazy: true
|
||||||
@ -105,7 +105,7 @@ spring.data:
|
|||||||
# 数据库索引
|
# 数据库索引
|
||||||
database: 0
|
database: 0
|
||||||
# redis 密码必须配置
|
# redis 密码必须配置
|
||||||
password: ruoyi123
|
password: Hans123.
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
# 是否开启ssl
|
# 是否开启ssl
|
||||||
|
|||||||
@ -24,9 +24,9 @@ captcha:
|
|||||||
# 是否启用验证码校验
|
# 是否启用验证码校验
|
||||||
enable: true
|
enable: true
|
||||||
# 验证码类型 math 数组计算 char 字符验证
|
# 验证码类型 math 数组计算 char 字符验证
|
||||||
type: MATH
|
type: math
|
||||||
# line 线段干扰 circle 圆圈干扰 shear 扭曲干扰
|
# line 线段干扰 circle 圆圈干扰 shear 扭曲干扰
|
||||||
category: CIRCLE
|
category: circle
|
||||||
# 数字验证码位数
|
# 数字验证码位数
|
||||||
numberLength: 1
|
numberLength: 1
|
||||||
# 字符验证码长度
|
# 字符验证码长度
|
||||||
@ -56,14 +56,7 @@ spring:
|
|||||||
threads:
|
threads:
|
||||||
# 开启虚拟线程 仅jdk21可用
|
# 开启虚拟线程 仅jdk21可用
|
||||||
virtual:
|
virtual:
|
||||||
enabled: false
|
enabled: true
|
||||||
task:
|
|
||||||
execution:
|
|
||||||
# 从 springboot 3.5 开始 spring自带线程池
|
|
||||||
# 不再需要 AsyncConfig与ThreadPoolConfig 可直接注入线程池使用
|
|
||||||
thread-name-prefix: async-
|
|
||||||
# 由spring自己初始化线程池
|
|
||||||
mode: force
|
|
||||||
# 资源信息
|
# 资源信息
|
||||||
messages:
|
messages:
|
||||||
# 国际化资源文件路径
|
# 国际化资源文件路径
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||||
FROM bellsoft/liberica-openjdk-rocky:17.0.16-cds
|
#FROM bellsoft/liberica-openjdk-rocky:17.0.15-cds
|
||||||
#FROM bellsoft/liberica-openjdk-rocky:21.0.8-cds
|
FROM bellsoft/liberica-openjdk-rocky:21.0.7-cds
|
||||||
#FROM findepi/graalvm:java17-native
|
#FROM findepi/graalvm:java17-native
|
||||||
|
|
||||||
LABEL maintainer="Lion Li"
|
LABEL maintainer="Lion Li"
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||||
FROM bellsoft/liberica-openjdk-rocky:17.0.16-cds
|
#FROM bellsoft/liberica-openjdk-rocky:17.0.15-cds
|
||||||
#FROM bellsoft/liberica-openjdk-rocky:21.0.8-cds
|
FROM bellsoft/liberica-openjdk-rocky:21.0.7-cds
|
||||||
#FROM findepi/graalvm:java17-native
|
#FROM findepi/graalvm:java17-native
|
||||||
|
|
||||||
LABEL maintainer="Lion Li"
|
LABEL maintainer="Lion Li"
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package org.dromara.generator.util;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.lang.Dict;
|
import cn.hutool.core.lang.Dict;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import org.dromara.common.mybatis.enums.DataBaseType;
|
import org.dromara.common.mybatis.enums.DataBaseType;
|
||||||
import org.dromara.generator.constant.GenConstants;
|
import org.dromara.generator.constant.GenConstants;
|
||||||
import org.dromara.common.core.utils.DateUtils;
|
import org.dromara.common.core.utils.DateUtils;
|
||||||
@ -75,6 +76,29 @@ public class VelocityUtils {
|
|||||||
if (GenConstants.TPL_TREE.equals(tplCategory)) {
|
if (GenConstants.TPL_TREE.equals(tplCategory)) {
|
||||||
setTreeVelocityContext(velocityContext, genTable);
|
setTreeVelocityContext(velocityContext, genTable);
|
||||||
}
|
}
|
||||||
|
// 判断是modal还是drawer
|
||||||
|
Dict paramsObj = JsonUtils.parseMap(genTable.getOptions());
|
||||||
|
if (ObjectUtil.isNotNull(paramsObj)) {
|
||||||
|
String popupComponent = Optional
|
||||||
|
.ofNullable(paramsObj.getStr("popupComponent"))
|
||||||
|
.orElse("modal");
|
||||||
|
velocityContext.put("popupComponent", popupComponent);
|
||||||
|
velocityContext.put("PopupComponent", StringUtils.capitalize(popupComponent));
|
||||||
|
} else {
|
||||||
|
velocityContext.put("popupComponent", "modal");
|
||||||
|
velocityContext.put("PopupComponent", "Modal");
|
||||||
|
}
|
||||||
|
// 判断是原生antd表单还是useForm表单
|
||||||
|
// native 原生antd表单
|
||||||
|
// useForm useVbenForm
|
||||||
|
if (ObjectUtil.isNotNull(paramsObj)) {
|
||||||
|
String formComponent = Optional
|
||||||
|
.ofNullable(paramsObj.getStr("formComponent"))
|
||||||
|
.orElse("useForm");
|
||||||
|
velocityContext.put("formComponent", formComponent);
|
||||||
|
} else {
|
||||||
|
velocityContext.put("formComponent", "useForm");
|
||||||
|
}
|
||||||
return velocityContext;
|
return velocityContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,6 +160,21 @@ public class VelocityUtils {
|
|||||||
} else if (GenConstants.TPL_TREE.equals(tplCategory)) {
|
} else if (GenConstants.TPL_TREE.equals(tplCategory)) {
|
||||||
templates.add("vm/vue/index-tree.vue.vm");
|
templates.add("vm/vue/index-tree.vue.vm");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加vben5
|
||||||
|
*/
|
||||||
|
templates.add("vm/vben5/api/index.ts.vm");
|
||||||
|
templates.add("vm/vben5/api/model.d.ts.vm");
|
||||||
|
templates.add("vm/vben5/views/data.ts.vm");
|
||||||
|
if (GenConstants.TPL_CRUD.equals(tplCategory)) {
|
||||||
|
templates.add("vm/vben5/views/index_vben.vue.vm");
|
||||||
|
templates.add("vm/vben5/views/popup.vue.vm");
|
||||||
|
} else if (GenConstants.TPL_TREE.equals(tplCategory)) {
|
||||||
|
templates.add("vm/vben5/views/index_vben_tree.vue.vm");
|
||||||
|
templates.add("vm/vben5/views/popup_tree.vue.vm");
|
||||||
|
}
|
||||||
|
|
||||||
return templates;
|
return templates;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,6 +227,38 @@ public class VelocityUtils {
|
|||||||
} else if (template.contains("index-tree.vue.vm")) {
|
} else if (template.contains("index-tree.vue.vm")) {
|
||||||
fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName);
|
fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断是modal还是drawer
|
||||||
|
Dict paramsObj = JsonUtils.parseMap(genTable.getOptions());
|
||||||
|
String popupComponent = "modal";
|
||||||
|
if (ObjectUtil.isNotNull(paramsObj)) {
|
||||||
|
popupComponent = Optional
|
||||||
|
.ofNullable(paramsObj.getStr("popupComponent"))
|
||||||
|
.orElse("modal");
|
||||||
|
}
|
||||||
|
String vben5Path = "vben5";
|
||||||
|
if (template.contains("vm/vben5/api/index.ts.vm")) {
|
||||||
|
fileName = StringUtils.format("{}/api/{}/{}/index.ts", vben5Path, moduleName, businessName);
|
||||||
|
}
|
||||||
|
if (template.contains("vm/vben5/api/model.d.ts.vm")) {
|
||||||
|
fileName = StringUtils.format("{}/api/{}/{}/model.d.ts", vben5Path, moduleName, businessName);
|
||||||
|
}
|
||||||
|
if (template.contains("vm/vben5/views/index_vben.vue.vm")) {
|
||||||
|
fileName = StringUtils.format("{}/views/{}/{}/index.vue", vben5Path, moduleName, businessName);
|
||||||
|
}
|
||||||
|
if (template.contains("vm/vben5/views/index_vben_tree.vue.vm")) {
|
||||||
|
fileName = StringUtils.format("{}/views/{}/{}/index.vue", vben5Path, moduleName, businessName);
|
||||||
|
}
|
||||||
|
if (template.contains("vm/vben5/views/data.ts.vm")) {
|
||||||
|
fileName = StringUtils.format("{}/views/{}/{}/data.ts", vben5Path, moduleName, businessName);
|
||||||
|
}
|
||||||
|
if (template.contains("vm/vben5/views/popup.vue.vm")) {
|
||||||
|
fileName = StringUtils.format("{}/views/{}/{}/{}-{}.vue", vben5Path, moduleName, businessName, businessName, popupComponent);
|
||||||
|
}
|
||||||
|
if (template.contains("vm/vben5/views/popup_tree.vue.vm")) {
|
||||||
|
fileName = StringUtils.format("{}/views/{}/{}/{}-{}.vue", vben5Path, moduleName, businessName, businessName, popupComponent);
|
||||||
|
}
|
||||||
|
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,69 @@
|
|||||||
|
import type { ${BusinessName}VO, ${BusinessName}Form, ${BusinessName}Query } from './model';
|
||||||
|
|
||||||
|
import type { ID, IDS } from '#/api/common';
|
||||||
|
#if($tplCategory != 'tree')
|
||||||
|
import type { PageResult } from '#/api/common';
|
||||||
|
#end
|
||||||
|
|
||||||
|
import { commonExport } from '#/api/helper';
|
||||||
|
import { requestClient } from '#/api/request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询${functionName}列表
|
||||||
|
* @param params
|
||||||
|
* @returns ${functionName}列表
|
||||||
|
*/
|
||||||
|
export function ${businessName}List(params?: ${BusinessName}Query) {
|
||||||
|
#if($tplCategory != 'tree')
|
||||||
|
return requestClient.get<PageResult<${BusinessName}VO>>('/${moduleName}/${businessName}/list', { params });
|
||||||
|
#else
|
||||||
|
return requestClient.get<${BusinessName}VO[]>(`/${moduleName}/${businessName}/list`, { params });
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
|
||||||
|
#if($tplCategory != 'tree')
|
||||||
|
/**
|
||||||
|
* 导出${functionName}列表
|
||||||
|
* @param params
|
||||||
|
* @returns ${functionName}列表
|
||||||
|
*/
|
||||||
|
export function ${businessName}Export(params?: ${BusinessName}Query) {
|
||||||
|
return commonExport('/${moduleName}/${businessName}/export', params ?? {});
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询${functionName}详情
|
||||||
|
* @param ${pkColumn.javaField} id
|
||||||
|
* @returns ${functionName}详情
|
||||||
|
*/
|
||||||
|
export function ${businessName}Info(${pkColumn.javaField}: ID) {
|
||||||
|
return requestClient.get<${BusinessName}VO>(`/${moduleName}/${businessName}/${${pkColumn.javaField}}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增${functionName}
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function ${businessName}Add(data: ${BusinessName}Form) {
|
||||||
|
return requestClient.postWithMsg<void>('/${moduleName}/${businessName}', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新${functionName}
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function ${businessName}Update(data: ${BusinessName}Form) {
|
||||||
|
return requestClient.putWithMsg<void>('/${moduleName}/${businessName}', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除${functionName}
|
||||||
|
* @param ${pkColumn.javaField} id
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function ${businessName}Remove(${pkColumn.javaField}: ID | IDS) {
|
||||||
|
return requestClient.deleteWithMsg<void>(`/${moduleName}/${businessName}/${${pkColumn.javaField}}`);
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||||
|
|
||||||
|
export interface ${BusinessName}VO {
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.list)
|
||||||
|
/**
|
||||||
|
* $column.columnComment
|
||||||
|
*/
|
||||||
|
$column.javaField:#if($column.javaField.indexOf("id") != -1 || $column.javaField.indexOf("Id") != -1) string | number;
|
||||||
|
#elseif($column.javaType == 'Long' || $column.javaType == 'Integer' || $column.javaType == 'Double' || $column.javaType == 'Float' || $column.javaType == 'BigDecimal') number;
|
||||||
|
#elseif($column.javaType == 'Boolean') boolean;
|
||||||
|
#else string;
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#if ($table.tree)
|
||||||
|
/**
|
||||||
|
* 子对象
|
||||||
|
*/
|
||||||
|
children: ${BusinessName}VO[];
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ${BusinessName}Form extends BaseEntity {
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.insert || $column.edit)
|
||||||
|
/**
|
||||||
|
* $column.columnComment
|
||||||
|
*/
|
||||||
|
$column.javaField?:#if($column.javaField.indexOf("id") != -1 || $column.javaField.indexOf("Id") != -1) string | number;
|
||||||
|
#elseif($column.javaType == 'Long' || $column.javaType == 'Integer' || $column.javaType == 'Double' || $column.javaType == 'Float' || $column.javaType == 'BigDecimal') number;
|
||||||
|
#elseif($column.javaType == 'Boolean') boolean;
|
||||||
|
#else string;
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ${BusinessName}Query #if(!${treeCode})extends PageQuery #end{
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.query)
|
||||||
|
/**
|
||||||
|
* $column.columnComment
|
||||||
|
*/
|
||||||
|
$column.javaField?:#if($column.javaField.indexOf("id") != -1 || $column.javaField.indexOf("Id") != -1) string | number;
|
||||||
|
#elseif($column.javaType == 'Long' || $column.javaType == 'Integer' || $column.javaType == 'Double' || $column.javaType == 'Float' || $column.javaType == 'BigDecimal') number;
|
||||||
|
#elseif($column.javaType == 'Boolean') boolean;
|
||||||
|
#else string;
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
/**
|
||||||
|
* 日期范围参数
|
||||||
|
*/
|
||||||
|
params?: any;
|
||||||
|
}
|
||||||
@ -0,0 +1,215 @@
|
|||||||
|
import type { FormSchemaGetter } from '#/adapter/form';
|
||||||
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
#if(${dicts} != '')
|
||||||
|
import { getDictOptions } from '#/utils/dict';
|
||||||
|
import { renderDict } from '#/utils/render';
|
||||||
|
#end
|
||||||
|
|
||||||
|
export const querySchema: FormSchemaGetter = () => [
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.query)
|
||||||
|
#if($column.dictType)
|
||||||
|
#set($dictType=$column.dictType)
|
||||||
|
#else
|
||||||
|
#set($dictType="")
|
||||||
|
#end
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#if($column.htmlType == "input")
|
||||||
|
#set($component="Input")
|
||||||
|
#elseif($column.htmlType == "textarea")
|
||||||
|
#set($component="Textarea")
|
||||||
|
#elseif($column.htmlType == "select")
|
||||||
|
#set($component="Select")
|
||||||
|
#elseif($column.htmlType == "radio")
|
||||||
|
#set($component="RadioGroup")
|
||||||
|
#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
|
||||||
|
#set($component="DatePicker")
|
||||||
|
#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
#set($component="RangePicker")
|
||||||
|
#else
|
||||||
|
#set($component="Input")
|
||||||
|
#end
|
||||||
|
{
|
||||||
|
component: '${component}',
|
||||||
|
#if($component == "Select" || $component == "RadioGroup")
|
||||||
|
componentProps: {
|
||||||
|
#if($dictType != "")
|
||||||
|
// 可选从DictEnum中获取 DictEnum.${dictType.toUpperCase()} 便于维护
|
||||||
|
options: getDictOptions('$dictType'),
|
||||||
|
#end
|
||||||
|
#if($component == "RadioGroup")
|
||||||
|
buttonStyle: 'solid',
|
||||||
|
optionType: 'button',
|
||||||
|
#end
|
||||||
|
},
|
||||||
|
#elseif($component == "DatePicker" || $component == "RangePicker")
|
||||||
|
componentProps: {
|
||||||
|
showTime: true,
|
||||||
|
format: 'YYYY-MM-DD HH:mm:ss',
|
||||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||||
|
},
|
||||||
|
#end
|
||||||
|
fieldName: '${column.javaField}',
|
||||||
|
label: '${comment}',
|
||||||
|
},
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
];
|
||||||
|
|
||||||
|
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||||
|
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||||
|
export const columns: VxeGridProps['columns'] = [
|
||||||
|
#if($tplCategory != 'tree')
|
||||||
|
{ type: 'checkbox', width: 60 },
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.list)
|
||||||
|
#if($column.dictType)
|
||||||
|
#set($dictType=$column.dictType)
|
||||||
|
#else
|
||||||
|
#set($dictType="")
|
||||||
|
#end
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
{
|
||||||
|
title: '${comment}',
|
||||||
|
field: '${column.javaField}',
|
||||||
|
#if( $foreach.count == 1 && $tplCategory == 'tree')
|
||||||
|
treeNode: true,
|
||||||
|
#end
|
||||||
|
#if($dictType != "")
|
||||||
|
slots: {
|
||||||
|
default: ({ row }) => {
|
||||||
|
// 可选从DictEnum中获取 DictEnum.${dictType.toUpperCase()} 便于维护
|
||||||
|
return renderDict(row.${column.javaField}, '$dictType');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
#end
|
||||||
|
},
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
{
|
||||||
|
field: 'action',
|
||||||
|
fixed: 'right',
|
||||||
|
slots: { default: 'action' },
|
||||||
|
title: '操作',
|
||||||
|
width: 180,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
#if($formComponent == "useForm")
|
||||||
|
export const ${popupComponent}Schema: FormSchemaGetter = () => [
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.edit)
|
||||||
|
#if($column.dictType)
|
||||||
|
#set($dictType=$column.dictType)
|
||||||
|
#else
|
||||||
|
#set($dictType="")
|
||||||
|
#end
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#if($column.htmlType == "input")
|
||||||
|
#set($component="Input")
|
||||||
|
#elseif($column.htmlType == "textarea")
|
||||||
|
#set($component="Textarea")
|
||||||
|
#elseif($column.htmlType == "select")
|
||||||
|
#set($component="Select")
|
||||||
|
#elseif($column.htmlType == "radio")
|
||||||
|
#set($component="RadioGroup")
|
||||||
|
#elseif($column.htmlType == "checkbox")
|
||||||
|
#set($component="Checkbox")
|
||||||
|
#elseif($column.htmlType == "imageUpload")
|
||||||
|
#set($component="ImageUpload")
|
||||||
|
#elseif($column.htmlType == "fileUpload")
|
||||||
|
#set($component="FileUpload")
|
||||||
|
#elseif($column.htmlType == "editor")
|
||||||
|
#set($component="RichTextarea")
|
||||||
|
#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
|
||||||
|
#set($component="DatePicker")
|
||||||
|
#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
#set($component="RangePicker")
|
||||||
|
#else
|
||||||
|
#set($component="Input")
|
||||||
|
#end
|
||||||
|
#if($column.required && $column.pk == false)
|
||||||
|
#set($required='true')
|
||||||
|
#else
|
||||||
|
#set($required='false')
|
||||||
|
#end
|
||||||
|
{
|
||||||
|
label: '${comment}',
|
||||||
|
fieldName: '${column.javaField}',
|
||||||
|
#if("" != $treeParentCode && $column.javaField == $treeParentCode)
|
||||||
|
component: 'TreeSelect',
|
||||||
|
#else
|
||||||
|
component: '${component}',
|
||||||
|
#end
|
||||||
|
#if($component == "DatePicker" || $component == "RangePicker")
|
||||||
|
componentProps: {
|
||||||
|
showTime: true,
|
||||||
|
format: 'YYYY-MM-DD HH:mm:ss',
|
||||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||||
|
},
|
||||||
|
#elseif($component == "ImageUpload")
|
||||||
|
componentProps: {
|
||||||
|
// accept: 'image/*', // 可选拓展名或者mime类型 ,拼接
|
||||||
|
// maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型
|
||||||
|
},
|
||||||
|
#elseif($component == "FileUpload")
|
||||||
|
/**
|
||||||
|
* 注意这里获取为数组 需要自行定义回显/提交
|
||||||
|
* 文件上传还在demo阶段 可能有重大改动!
|
||||||
|
*/
|
||||||
|
componentProps: {
|
||||||
|
// accept: 'application/pdf', // 可选拓展名或者mime类型 ,拼接
|
||||||
|
// maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型
|
||||||
|
},
|
||||||
|
#elseif($component == "RichTextarea")
|
||||||
|
componentProps: {
|
||||||
|
// disabled: false, // 是否只读
|
||||||
|
// height: 400 // 高度 默认400
|
||||||
|
},
|
||||||
|
#elseif($component == "Select" || $component == "RadioGroup" || $component == "Checkbox")
|
||||||
|
componentProps: {
|
||||||
|
#if($dictType != "")
|
||||||
|
// 可选从DictEnum中获取 DictEnum.${dictType.toUpperCase()} 便于维护
|
||||||
|
options: getDictOptions('$dictType'),
|
||||||
|
#end
|
||||||
|
#if($component == "RadioGroup")
|
||||||
|
buttonStyle: 'solid',
|
||||||
|
optionType: 'button',
|
||||||
|
#end
|
||||||
|
},
|
||||||
|
#end
|
||||||
|
#if(${column.pk})
|
||||||
|
dependencies: {
|
||||||
|
show: () => false,
|
||||||
|
triggerFields: [''],
|
||||||
|
},
|
||||||
|
#end
|
||||||
|
#if($required == 'true' && $column.pk == false)
|
||||||
|
#if($component == "Select" || $component == "RadioGroup" || $component == "Checkbox")
|
||||||
|
rules: 'selectRequired',
|
||||||
|
#else
|
||||||
|
rules: 'required',
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
},
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
];
|
||||||
|
#end
|
||||||
@ -0,0 +1,182 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { Recordable } from '@vben/types';
|
||||||
|
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
import { Page, useVben${PopupComponent}, type VbenFormProps } from '@vben/common-ui';
|
||||||
|
import { getVxePopupContainer } from '@vben/utils';
|
||||||
|
|
||||||
|
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
import {
|
||||||
|
useVbenVxeGrid,
|
||||||
|
vxeCheckboxChecked,
|
||||||
|
type VxeGridProps
|
||||||
|
} from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
import {
|
||||||
|
${businessName}Export,
|
||||||
|
${businessName}List,
|
||||||
|
${businessName}Remove,
|
||||||
|
} from '#/api/${moduleName}/${businessName}';
|
||||||
|
import type { ${BusinessName}Form } from '#/api/${moduleName}/${businessName}/model';
|
||||||
|
import { commonDownloadExcel } from '#/utils/file/download';
|
||||||
|
|
||||||
|
import ${businessName}${PopupComponent} from './${businessName}-${popupComponent}.vue';
|
||||||
|
import { columns, querySchema } from './data';
|
||||||
|
|
||||||
|
const formOptions: VbenFormProps = {
|
||||||
|
commonConfig: {
|
||||||
|
labelWidth: 80,
|
||||||
|
componentProps: {
|
||||||
|
allowClear: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
schema: querySchema(),
|
||||||
|
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||||
|
// 处理区间选择器RangePicker时间格式 将一个字段映射为两个字段 搜索/导出会用到
|
||||||
|
// 不需要直接删除
|
||||||
|
// fieldMappingTime: [
|
||||||
|
// [
|
||||||
|
// 'createTime',
|
||||||
|
// ['params[beginTime]', 'params[endTime]'],
|
||||||
|
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
|
||||||
|
// ],
|
||||||
|
// ],
|
||||||
|
};
|
||||||
|
|
||||||
|
const gridOptions: VxeGridProps = {
|
||||||
|
checkboxConfig: {
|
||||||
|
// 高亮
|
||||||
|
highlight: true,
|
||||||
|
// 翻页时保留选中状态
|
||||||
|
reserve: true,
|
||||||
|
// 点击行选中
|
||||||
|
// trigger: 'row',
|
||||||
|
},
|
||||||
|
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||||
|
// columns: columns(),
|
||||||
|
columns,
|
||||||
|
height: 'auto',
|
||||||
|
keepSource: true,
|
||||||
|
pagerConfig: {},
|
||||||
|
proxyConfig: {
|
||||||
|
ajax: {
|
||||||
|
query: async ({ page }, formValues = {}) => {
|
||||||
|
return await ${businessName}List({
|
||||||
|
pageNum: page.currentPage,
|
||||||
|
pageSize: page.pageSize,
|
||||||
|
...formValues,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rowConfig: {
|
||||||
|
keyField: '${pkColumn.javaField}',
|
||||||
|
},
|
||||||
|
// 表格全局唯一表示 保存列配置需要用到
|
||||||
|
id: '${moduleName}-${businessName}-index'
|
||||||
|
};
|
||||||
|
|
||||||
|
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||||
|
formOptions,
|
||||||
|
gridOptions,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [${BusinessName}${PopupComponent}, ${popupComponent}Api] = useVben${PopupComponent}({
|
||||||
|
connectedComponent: ${businessName}${PopupComponent},
|
||||||
|
});
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
${popupComponent}Api.setData({});
|
||||||
|
${popupComponent}Api.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleEdit(row: Required<${BusinessName}Form>) {
|
||||||
|
${popupComponent}Api.setData({ id: row.${pkColumn.javaField} });
|
||||||
|
${popupComponent}Api.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDelete(row: Required<${BusinessName}Form>) {
|
||||||
|
await ${businessName}Remove(row.${pkColumn.javaField});
|
||||||
|
await tableApi.query();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMultiDelete() {
|
||||||
|
const rows = tableApi.grid.getCheckboxRecords();
|
||||||
|
const ids = rows.map((row: Required<${BusinessName}Form>) => row.${pkColumn.javaField});
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
okType: 'danger',
|
||||||
|
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||||
|
onOk: async () => {
|
||||||
|
await ${businessName}Remove(ids);
|
||||||
|
await tableApi.query();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDownloadExcel() {
|
||||||
|
commonDownloadExcel(${businessName}Export, '${functionName}数据', tableApi.formApi.form.values, {
|
||||||
|
fieldMappingTime: formOptions.fieldMappingTime,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Page :auto-content-height="true">
|
||||||
|
<BasicTable table-title="${functionName}列表">
|
||||||
|
<template #toolbar-tools>
|
||||||
|
<Space>
|
||||||
|
<a-button
|
||||||
|
v-access:code="['${permissionPrefix}:export']"
|
||||||
|
@click="handleDownloadExcel"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.export') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||||
|
danger
|
||||||
|
type="primary"
|
||||||
|
v-access:code="['${permissionPrefix}:remove']"
|
||||||
|
@click="handleMultiDelete">
|
||||||
|
{{ $t('pages.common.delete') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
v-access:code="['${permissionPrefix}:add']"
|
||||||
|
@click="handleAdd"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.add') }}
|
||||||
|
</a-button>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
<template #action="{ row }">
|
||||||
|
<Space>
|
||||||
|
<ghost-button
|
||||||
|
v-access:code="['${permissionPrefix}:edit']"
|
||||||
|
@click.stop="handleEdit(row)"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.edit') }}
|
||||||
|
</ghost-button>
|
||||||
|
<Popconfirm
|
||||||
|
:get-popup-container="getVxePopupContainer"
|
||||||
|
placement="left"
|
||||||
|
title="确认删除?"
|
||||||
|
@confirm="handleDelete(row)"
|
||||||
|
>
|
||||||
|
<ghost-button
|
||||||
|
danger
|
||||||
|
v-access:code="['${permissionPrefix}:remove']"
|
||||||
|
@click.stop=""
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.delete') }}
|
||||||
|
</ghost-button>
|
||||||
|
</Popconfirm>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<${BusinessName}${PopupComponent} @reload="tableApi.query()" />
|
||||||
|
</Page>
|
||||||
|
</template>
|
||||||
@ -0,0 +1,152 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { Recordable } from '@vben/types';
|
||||||
|
|
||||||
|
import { nextTick } from 'vue';
|
||||||
|
|
||||||
|
import { Page, useVben${PopupComponent}, type VbenFormProps } from '@vben/common-ui';
|
||||||
|
import { getVxePopupContainer } from '@vben/utils';
|
||||||
|
|
||||||
|
import { Popconfirm, Space } from 'ant-design-vue';
|
||||||
|
|
||||||
|
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||||
|
import { ${businessName}List, ${businessName}Remove } from '#/api/${moduleName}/${businessName}';
|
||||||
|
import type { ${BusinessName}Form } from '#/api/${moduleName}/${businessName}/model';
|
||||||
|
|
||||||
|
import { columns, querySchema } from './data';
|
||||||
|
import ${businessName}${PopupComponent} from './${businessName}-${popupComponent}.vue';
|
||||||
|
|
||||||
|
const formOptions: VbenFormProps = {
|
||||||
|
commonConfig: {
|
||||||
|
labelWidth: 80,
|
||||||
|
componentProps: {
|
||||||
|
allowClear: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
schema: querySchema(),
|
||||||
|
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||||
|
};
|
||||||
|
|
||||||
|
const gridOptions: VxeGridProps = {
|
||||||
|
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||||
|
// columns: columns(),
|
||||||
|
columns,
|
||||||
|
height: 'auto',
|
||||||
|
keepSource: true,
|
||||||
|
pagerConfig: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
proxyConfig: {
|
||||||
|
ajax: {
|
||||||
|
query: async (_, formValues = {}) => {
|
||||||
|
const resp = await ${businessName}List({
|
||||||
|
...formValues,
|
||||||
|
});
|
||||||
|
return { rows: resp };
|
||||||
|
},
|
||||||
|
// 默认请求接口后展开全部 不需要可以删除这段
|
||||||
|
querySuccess: () => {
|
||||||
|
nextTick(() => {
|
||||||
|
expandAll();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rowConfig: {
|
||||||
|
keyField: '${pkColumn.javaField}',
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 虚拟滚动开关 默认关闭
|
||||||
|
* 数据量小可以选择关闭
|
||||||
|
* 如果遇到样式问题(空白、错位 滚动等)可以选择关闭虚拟滚动
|
||||||
|
*/
|
||||||
|
scrollY: {
|
||||||
|
enabled: false,
|
||||||
|
gt: 0,
|
||||||
|
},
|
||||||
|
treeConfig: {
|
||||||
|
parentField: '${treeParentCode}',
|
||||||
|
rowField: '${treeCode}',
|
||||||
|
// 自动转换为tree 由vxe处理 无需手动转换
|
||||||
|
transform: true,
|
||||||
|
},
|
||||||
|
// 表格全局唯一表示 保存列配置需要用到
|
||||||
|
id: '${moduleName}-${businessName}-index'
|
||||||
|
};
|
||||||
|
|
||||||
|
const [BasicTable, tableApi] = useVbenVxeGrid({ formOptions, gridOptions });
|
||||||
|
const [${BusinessName}${PopupComponent}, ${popupComponent}Api] = useVben${PopupComponent}({
|
||||||
|
connectedComponent: ${businessName}${PopupComponent},
|
||||||
|
});
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
${popupComponent}Api.setData({});
|
||||||
|
${popupComponent}Api.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleEdit(row: Required<${BusinessName}Form>) {
|
||||||
|
${popupComponent}Api.setData({ id: row.${pkColumn.javaField} });
|
||||||
|
${popupComponent}Api.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDelete(row: Required<${BusinessName}Form>) {
|
||||||
|
await ${businessName}Remove(row.${pkColumn.javaField});
|
||||||
|
await tableApi.query();
|
||||||
|
}
|
||||||
|
|
||||||
|
function expandAll() {
|
||||||
|
tableApi.grid?.setAllTreeExpand(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function collapseAll() {
|
||||||
|
tableApi.grid?.setAllTreeExpand(false);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Page :auto-content-height="true">
|
||||||
|
<BasicTable table-title="${functionName}列表">
|
||||||
|
<template #toolbar-tools>
|
||||||
|
<Space>
|
||||||
|
<a-button @click="collapseAll">
|
||||||
|
{{ $t('pages.common.collapse') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button @click="expandAll">
|
||||||
|
{{ $t('pages.common.expand') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
v-access:code="['${permissionPrefix}:add']"
|
||||||
|
@click="handleAdd"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.add') }}
|
||||||
|
</a-button>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
<template #action="{ row }">
|
||||||
|
<Space>
|
||||||
|
<ghost-button
|
||||||
|
v-access:code="['${permissionPrefix}:edit']"
|
||||||
|
@click.stop="handleEdit(row)"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.edit') }}
|
||||||
|
</ghost-button>
|
||||||
|
<Popconfirm
|
||||||
|
:get-popup-container="getVxePopupContainer"
|
||||||
|
placement="left"
|
||||||
|
title="确认删除?"
|
||||||
|
@confirm="handleDelete(row)"
|
||||||
|
>
|
||||||
|
<ghost-button
|
||||||
|
danger
|
||||||
|
v-access:code="['${permissionPrefix}:remove']"
|
||||||
|
@click.stop=""
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.delete') }}
|
||||||
|
</ghost-button>
|
||||||
|
</Popconfirm>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<${BusinessName}${PopupComponent} @reload="tableApi.query()" />
|
||||||
|
</Page>
|
||||||
|
</template>
|
||||||
@ -0,0 +1,373 @@
|
|||||||
|
#if($formComponent == "useForm")
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
|
import { useVben${PopupComponent} } from '@vben/common-ui';
|
||||||
|
import { $t } from '@vben/locales';
|
||||||
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
|
import { useVbenForm } from '#/adapter/form';
|
||||||
|
import { ${businessName}Add, ${businessName}Info, ${businessName}Update } from '#/api/${moduleName}/${businessName}';
|
||||||
|
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||||
|
|
||||||
|
import { ${popupComponent}Schema } from './data';
|
||||||
|
|
||||||
|
const emit = defineEmits<{ reload: [] }>();
|
||||||
|
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const title = computed(() => {
|
||||||
|
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||||
|
});
|
||||||
|
|
||||||
|
const [BasicForm, formApi] = useVbenForm({
|
||||||
|
commonConfig: {
|
||||||
|
// 默认占满两列
|
||||||
|
formItemClass: 'col-span-2',
|
||||||
|
// 默认label宽度 px
|
||||||
|
labelWidth: 80,
|
||||||
|
// 通用配置项 会影响到所有表单项
|
||||||
|
componentProps: {
|
||||||
|
class: 'w-full',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
schema: ${popupComponent}Schema(),
|
||||||
|
showDefaultActions: false,
|
||||||
|
wrapperClass: 'grid-cols-2',
|
||||||
|
});
|
||||||
|
|
||||||
|
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||||
|
{
|
||||||
|
initializedGetter: defaultFormValueGetter(formApi),
|
||||||
|
currentGetter: defaultFormValueGetter(formApi),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const [Basic${PopupComponent}, ${popupComponent}Api] = useVben${PopupComponent}({
|
||||||
|
// 在这里更改宽度
|
||||||
|
class: 'w-[550px]',
|
||||||
|
fullscreenButton: false,
|
||||||
|
onBeforeClose,
|
||||||
|
onClosed: handleClosed,
|
||||||
|
onConfirm: handleConfirm,
|
||||||
|
onOpenChange: async (isOpen) => {
|
||||||
|
if (!isOpen) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
${popupComponent}Api.${popupComponent}Loading(true);
|
||||||
|
|
||||||
|
const { id } = ${popupComponent}Api.getData() as { id?: number | string };
|
||||||
|
isUpdate.value = !!id;
|
||||||
|
|
||||||
|
if (isUpdate.value && id) {
|
||||||
|
const record = await ${businessName}Info(id);
|
||||||
|
await formApi.setValues(record);
|
||||||
|
}
|
||||||
|
await markInitialized();
|
||||||
|
|
||||||
|
${popupComponent}Api.${popupComponent}Loading(false);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleConfirm() {
|
||||||
|
try {
|
||||||
|
${popupComponent}Api.lock(true);
|
||||||
|
const { valid } = await formApi.validate();
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||||
|
const data = cloneDeep(await formApi.getValues());
|
||||||
|
await (isUpdate.value ? ${businessName}Update(data) : ${businessName}Add(data));
|
||||||
|
resetInitialized();
|
||||||
|
emit('reload');
|
||||||
|
${popupComponent}Api.close();
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
${popupComponent}Api.lock(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleClosed() {
|
||||||
|
await formApi.resetForm();
|
||||||
|
resetInitialized();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Basic${PopupComponent} :title="title">
|
||||||
|
<BasicForm />
|
||||||
|
</Basic${PopupComponent}>
|
||||||
|
</template>
|
||||||
|
#else
|
||||||
|
<!--
|
||||||
|
使用antd原生Form生成 详细用法参考ant-design-vue Form组件文档
|
||||||
|
vscode默认配置文件会自动格式化/移除未使用依赖
|
||||||
|
-->
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { RuleObject } from 'ant-design-vue/es/form';
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
|
import { Input, Textarea, Select, RadioGroup, CheckboxGroup, DatePicker, Form, FormItem } from 'ant-design-vue';
|
||||||
|
import { ImageUpload, FileUpload } from '#/components/upload';
|
||||||
|
import { Tinymce } from '#/components/tinymce';
|
||||||
|
import { getPopupContainer } from '@vben/utils';
|
||||||
|
import { pick } from 'lodash-es';
|
||||||
|
|
||||||
|
#if(${dicts} != '')
|
||||||
|
import { getDictOptions } from '#/utils/dict';
|
||||||
|
#end
|
||||||
|
|
||||||
|
import { useVben${PopupComponent} } from '@vben/common-ui';
|
||||||
|
import { $t } from '@vben/locales';
|
||||||
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
|
import { useVbenForm } from '#/adapter/form';
|
||||||
|
import { ${businessName}Add, ${businessName}Info, ${businessName}Update } from '#/api/${moduleName}/${businessName}';
|
||||||
|
import type { ${BusinessName}Form } from '#/api/${moduleName}/${businessName}/model';
|
||||||
|
import { useBeforeCloseDiff } from '#/utils/popup';
|
||||||
|
|
||||||
|
const emit = defineEmits<{ reload: [] }>();
|
||||||
|
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const title = computed(() => {
|
||||||
|
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义默认值 用于reset
|
||||||
|
*/
|
||||||
|
const defaultValues: Partial<${BusinessName}Form> = {
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.insert || $column.edit)
|
||||||
|
#if($column.htmlType == "checkbox")
|
||||||
|
$column.javaField: []#if($foreach.count != $columns.size()),#end
|
||||||
|
#else
|
||||||
|
$column.javaField: undefined#if($foreach.count != $columns.size()),#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表单数据ref
|
||||||
|
*/
|
||||||
|
const formData = ref(defaultValues);
|
||||||
|
|
||||||
|
type AntdFormRules<T> = Partial<Record<keyof T, RuleObject[]>> & {
|
||||||
|
[key: string]: RuleObject[];
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* 表单校验规则
|
||||||
|
*/
|
||||||
|
const formRules = ref<AntdFormRules<${BusinessName}Form>>({
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.insert || $column.edit)
|
||||||
|
#if($column.required && $column.pk == false)
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
$column.javaField: [
|
||||||
|
{ required: true, message: "$comment不能为空" }
|
||||||
|
]#if($foreach.count != $columns.size()),#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* useForm解构出表单方法
|
||||||
|
*/
|
||||||
|
const { validate, validateInfos, resetFields } = Form.useForm(
|
||||||
|
formData,
|
||||||
|
formRules,
|
||||||
|
);
|
||||||
|
|
||||||
|
function customFormValueGetter() {
|
||||||
|
return JSON.stringify(formData.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||||
|
{
|
||||||
|
initializedGetter: customFormValueGetter,
|
||||||
|
currentGetter: customFormValueGetter,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const [Basic${PopupComponent}, ${popupComponent}Api] = useVben${PopupComponent}({
|
||||||
|
class: 'w-[550px]',
|
||||||
|
fullscreenButton: false,
|
||||||
|
onBeforeClose,
|
||||||
|
onClosed: handleClosed,
|
||||||
|
onConfirm: handleConfirm,
|
||||||
|
onOpenChange: async (isOpen) => {
|
||||||
|
if (!isOpen) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
${popupComponent}Api.${popupComponent}Loading(true);
|
||||||
|
|
||||||
|
const { id } = ${popupComponent}Api.getData() as { id?: number | string };
|
||||||
|
isUpdate.value = !!id;
|
||||||
|
|
||||||
|
if (isUpdate.value && id) {
|
||||||
|
const record = await ${businessName}Info(id);
|
||||||
|
// 只赋值存在的字段
|
||||||
|
const filterRecord = pick(record, Object.keys(defaultValues));
|
||||||
|
formData.value = filterRecord;
|
||||||
|
}
|
||||||
|
await markInitialized();
|
||||||
|
|
||||||
|
${popupComponent}Api.${popupComponent}Loading(false);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleConfirm() {
|
||||||
|
try {
|
||||||
|
${popupComponent}Api.lock(true);
|
||||||
|
await validate();
|
||||||
|
// 可能会做数据处理 使用cloneDeep深拷贝
|
||||||
|
const data = cloneDeep(formData.value);
|
||||||
|
await (isUpdate.value ? ${businessName}Update(data) : ${businessName}Add(data));
|
||||||
|
resetInitialized();
|
||||||
|
emit('reload');
|
||||||
|
${popupComponent}Api.close();
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
${popupComponent}Api.lock(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleClosed() {
|
||||||
|
formData.value = defaultValues;
|
||||||
|
resetFields();
|
||||||
|
resetInitialized();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Basic${PopupComponent} :title="title">
|
||||||
|
<Form :label-col="{ span: 4 }">
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#set($field=$column.javaField)
|
||||||
|
#if(($column.insert || $column.edit) && !$column.pk)
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#set($dictType=$column.dictType)
|
||||||
|
#if($column.htmlType == "input")
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<Input v-model:value="formData.${field}" :placeholder="$t('ui.formRules.required')" />
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "imageUpload")
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<!-- props参考apps/web-antd/src/components/upload/src/props.d.ts -->
|
||||||
|
<!-- maxCount为1(默认)时只允许上传一个文件 会自动绑定为string而非string[] -->
|
||||||
|
<ImageUpload :max-count="1" v-model:value="formData.${field}" />
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "fileUpload")
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<!-- props参考apps/web-antd/src/components/upload/src/props.d.ts -->
|
||||||
|
<!-- maxCount为1(默认)时只允许上传一个文件 会自动绑定为string而非string[] -->
|
||||||
|
<FileUpload :max-count="1" v-model:value="formData.${field}" />
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "editor")
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<Tinymce
|
||||||
|
:disabled="false"
|
||||||
|
v-model="formData.${field}"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<Select
|
||||||
|
v-model:value="formData.${field}"
|
||||||
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
|
:options="getDictOptions('$dictType', true)"
|
||||||
|
#else
|
||||||
|
:options="getDictOptions('$dictType')"
|
||||||
|
#end
|
||||||
|
:getPopupContainer="getPopupContainer"
|
||||||
|
:placeholder="$t('ui.formRules.selectRequired')"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "select" && "" == $dictType)
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<Select
|
||||||
|
v-model:value="formData.${field}"
|
||||||
|
:options="[]"
|
||||||
|
:getPopupContainer="getPopupContainer"
|
||||||
|
:placeholder="$t('ui.formRules.selectRequired')"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<CheckboxGroup
|
||||||
|
v-model:value="formData.${field}"
|
||||||
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
|
:options="getDictOptions('$dictType', true)"
|
||||||
|
#else
|
||||||
|
:options="getDictOptions('$dictType')"
|
||||||
|
#end
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "checkbox" && "" == $dictType)
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<CheckboxGroup
|
||||||
|
v-model:value="formData.${field}"
|
||||||
|
:options="[]"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<RadioGroup
|
||||||
|
option-type="button"
|
||||||
|
button-style="solid"
|
||||||
|
v-model:value="formData.${field}"
|
||||||
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
|
:options="getDictOptions('$dictType', true)"
|
||||||
|
#else
|
||||||
|
:options="getDictOptions('$dictType')"
|
||||||
|
#end
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "radio" && "" == $dictType)
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<RadioGroup
|
||||||
|
option-type="button"
|
||||||
|
button-style="solid"
|
||||||
|
v-model:value="formData.${field}"
|
||||||
|
:options="[]"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "datetime")
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<!-- 需要自行调整参数 -->
|
||||||
|
<DatePicker
|
||||||
|
v-model:value="formData.${field}"
|
||||||
|
format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "textarea")
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<Textarea
|
||||||
|
v-model:value="formData.${field}"
|
||||||
|
:placeholder="$t('ui.formRules.required')"
|
||||||
|
:rows="4"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
</Form>
|
||||||
|
</Basic${PopupComponent}>
|
||||||
|
</template>
|
||||||
|
#end
|
||||||
|
|
||||||
@ -0,0 +1,408 @@
|
|||||||
|
#if($formComponent == "useForm")
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
|
import { useVben${PopupComponent} } from '@vben/common-ui';
|
||||||
|
import { $t } from '@vben/locales';
|
||||||
|
import { cloneDeep, getPopupContainer, listToTree } from '@vben/utils';
|
||||||
|
|
||||||
|
import { useVbenForm } from '#/adapter/form';
|
||||||
|
import { ${businessName}Add, ${businessName}Info, ${businessName}List, ${businessName}Update } from '#/api/${moduleName}/${businessName}';
|
||||||
|
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||||
|
|
||||||
|
import { ${popupComponent}Schema } from './data';
|
||||||
|
|
||||||
|
const emit = defineEmits<{ reload: [] }>();
|
||||||
|
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const title = computed(() => {
|
||||||
|
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||||
|
});
|
||||||
|
|
||||||
|
const [BasicForm, formApi] = useVbenForm({
|
||||||
|
commonConfig: {
|
||||||
|
// 默认占满两列
|
||||||
|
formItemClass: 'col-span-2',
|
||||||
|
// 默认label宽度 px
|
||||||
|
labelWidth: 80,
|
||||||
|
// 通用配置项 会影响到所有表单项
|
||||||
|
componentProps: {
|
||||||
|
class: 'w-full',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
schema: ${popupComponent}Schema(),
|
||||||
|
showDefaultActions: false,
|
||||||
|
wrapperClass: 'grid-cols-2',
|
||||||
|
});
|
||||||
|
|
||||||
|
async function setup${BusinessName}Select() {
|
||||||
|
const listData = await ${businessName}List();
|
||||||
|
const treeData = listToTree(listData, { id: '${treeCode}', pid: '${treeParentCode}' });
|
||||||
|
formApi.updateSchema([{
|
||||||
|
fieldName: '${treeParentCode}',
|
||||||
|
componentProps: {
|
||||||
|
treeData,
|
||||||
|
treeLine: { showLeafIcon: false },
|
||||||
|
fieldNames: { label: '${treeName}', value: '${treeCode}' },
|
||||||
|
treeDefaultExpandAll: true,
|
||||||
|
getPopupContainer,
|
||||||
|
},
|
||||||
|
}]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||||
|
{
|
||||||
|
initializedGetter: defaultFormValueGetter(formApi),
|
||||||
|
currentGetter: defaultFormValueGetter(formApi),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const [Basic${PopupComponent}, ${popupComponent}Api] = useVben${PopupComponent}({
|
||||||
|
// 在这里更改宽度
|
||||||
|
class: 'w-[550px]',
|
||||||
|
fullscreenButton: false,
|
||||||
|
onBeforeClose,
|
||||||
|
onClosed: handleClosed,
|
||||||
|
onConfirm: handleConfirm,
|
||||||
|
onOpenChange: async (isOpen) => {
|
||||||
|
if (!isOpen) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
${popupComponent}Api.${popupComponent}Loading(true);
|
||||||
|
|
||||||
|
const { id } = ${popupComponent}Api.getData() as { id?: number | string };
|
||||||
|
isUpdate.value = !!id;
|
||||||
|
|
||||||
|
if (isUpdate.value && id) {
|
||||||
|
const record = await ${businessName}Info(id);
|
||||||
|
await formApi.setValues(record);
|
||||||
|
}
|
||||||
|
await setup${BusinessName}Select();
|
||||||
|
await markInitialized();
|
||||||
|
|
||||||
|
${popupComponent}Api.${popupComponent}Loading(false);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleConfirm() {
|
||||||
|
try {
|
||||||
|
${popupComponent}Api.lock(true);
|
||||||
|
const { valid } = await formApi.validate();
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||||
|
const data = cloneDeep(await formApi.getValues());
|
||||||
|
await (isUpdate.value ? ${businessName}Update(data) : ${businessName}Add(data));
|
||||||
|
resetInitialized();
|
||||||
|
emit('reload');
|
||||||
|
${popupComponent}Api.close();
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
${popupComponent}Api.lock(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleClosed() {
|
||||||
|
await formApi.resetForm();
|
||||||
|
resetInitialized();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Basic${PopupComponent} :title="title">
|
||||||
|
<BasicForm />
|
||||||
|
</Basic${PopupComponent}>
|
||||||
|
</template>
|
||||||
|
#else
|
||||||
|
<!--
|
||||||
|
使用antd原生Form生成 详细用法参考ant-design-vue Form组件文档
|
||||||
|
vscode默认配置文件会自动格式化/移除未使用依赖
|
||||||
|
-->
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { RuleObject } from 'ant-design-vue/es/form';
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
|
import { Input, Textarea, Select, RadioGroup, CheckboxGroup, DatePicker, Form, FormItem, TreeSelect } from 'ant-design-vue';
|
||||||
|
import { ImageUpload, FileUpload } from '#/components/upload';
|
||||||
|
import { Tinymce } from '#/components/tinymce';
|
||||||
|
import { getPopupContainer } from '@vben/utils';
|
||||||
|
import { pick } from 'lodash-es';
|
||||||
|
|
||||||
|
#if(${dicts} != '')
|
||||||
|
import { getDictOptions } from '#/utils/dict';
|
||||||
|
#end
|
||||||
|
|
||||||
|
import { useVben${PopupComponent} } from '@vben/common-ui';
|
||||||
|
import { $t } from '@vben/locales';
|
||||||
|
import { cloneDeep, listToTree } from '@vben/utils';
|
||||||
|
|
||||||
|
import { useVbenForm } from '#/adapter/form';
|
||||||
|
import { ${businessName}Add, ${businessName}Info, ${businessName}List, ${businessName}Update } from '#/api/${moduleName}/${businessName}';
|
||||||
|
import type { ${BusinessName}Form } from '#/api/${moduleName}/${businessName}/model';
|
||||||
|
import { useBeforeCloseDiff } from '#/utils/popup';
|
||||||
|
|
||||||
|
const emit = defineEmits<{ reload: [] }>();
|
||||||
|
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const title = computed(() => {
|
||||||
|
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义默认值 用于reset
|
||||||
|
*/
|
||||||
|
const defaultValues: Partial<${BusinessName}Form> = {
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.insert || $column.edit)
|
||||||
|
#if($column.htmlType == "checkbox")
|
||||||
|
$column.javaField: []#if($foreach.count != $columns.size()),#end
|
||||||
|
#else
|
||||||
|
$column.javaField: undefined#if($foreach.count != $columns.size()),#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表单数据ref
|
||||||
|
*/
|
||||||
|
const formData = ref(defaultValues);
|
||||||
|
|
||||||
|
type AntdFormRules<T> = Partial<Record<keyof T, RuleObject[]>> & {
|
||||||
|
[key: string]: RuleObject[];
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* 表单校验规则
|
||||||
|
*/
|
||||||
|
const formRules = ref<AntdFormRules<${BusinessName}Form>>({
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.insert || $column.edit)
|
||||||
|
#if($column.required && $column.pk == false)
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
$column.javaField: [
|
||||||
|
{ required: true, message: "$comment不能为空" }
|
||||||
|
]#if($foreach.count != $columns.size()),#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* useForm解构出表单方法
|
||||||
|
*/
|
||||||
|
const { validate, validateInfos, resetFields } = Form.useForm(
|
||||||
|
formData,
|
||||||
|
formRules,
|
||||||
|
);
|
||||||
|
|
||||||
|
function customFormValueGetter() {
|
||||||
|
return JSON.stringify(formData.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||||
|
{
|
||||||
|
initializedGetter: customFormValueGetter,
|
||||||
|
currentGetter: customFormValueGetter,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const treeData = ref<any[]>([]);
|
||||||
|
async function setup${BusinessName}Select() {
|
||||||
|
const listData = await ${businessName}List();
|
||||||
|
treeData.value = listToTree(listData, { id: '${treeCode}', pid: '${treeParentCode}' });
|
||||||
|
}
|
||||||
|
|
||||||
|
const [Basic${PopupComponent}, ${popupComponent}Api] = useVben${PopupComponent}({
|
||||||
|
class: 'w-[550px]',
|
||||||
|
fullscreenButton: false,
|
||||||
|
onBeforeClose,
|
||||||
|
onClosed: handleClosed,
|
||||||
|
onConfirm: handleConfirm,
|
||||||
|
onOpenChange: async (isOpen) => {
|
||||||
|
if (!isOpen) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
${popupComponent}Api.${popupComponent}Loading(true);
|
||||||
|
|
||||||
|
const { id } = ${popupComponent}Api.getData() as { id?: number | string };
|
||||||
|
isUpdate.value = !!id;
|
||||||
|
|
||||||
|
if (isUpdate.value && id) {
|
||||||
|
const record = await ${businessName}Info(id);
|
||||||
|
// 只赋值存在的字段
|
||||||
|
const filterRecord = pick(record, Object.keys(defaultValues));
|
||||||
|
formData.value = filterRecord;
|
||||||
|
}
|
||||||
|
await setup${BusinessName}Select();
|
||||||
|
await markInitialized();
|
||||||
|
|
||||||
|
${popupComponent}Api.${popupComponent}Loading(false);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleConfirm() {
|
||||||
|
try {
|
||||||
|
${popupComponent}Api.lock(true);
|
||||||
|
await validate();
|
||||||
|
// 可能会做数据处理 使用cloneDeep深拷贝
|
||||||
|
const data = cloneDeep(formData.value);
|
||||||
|
await (isUpdate.value ? ${businessName}Update(data) : ${businessName}Add(data));
|
||||||
|
resetInitialized();
|
||||||
|
emit('reload');
|
||||||
|
await handleCancel();
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
${popupComponent}Api.lock(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleClosed() {
|
||||||
|
formData.value = defaultValues;
|
||||||
|
resetFields();
|
||||||
|
resetInitialized();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Basic${PopupComponent} :title="title">
|
||||||
|
<Form :label-col="{ span: 4 }">
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#set($field=$column.javaField)
|
||||||
|
#if(($column.insert || $column.edit) && !$column.pk)
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#set($dictType=$column.dictType)
|
||||||
|
#if("" != $treeParentCode && $column.javaField == $treeParentCode)
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<TreeSelect
|
||||||
|
v-model:value="formData.${treeParentCode}"
|
||||||
|
:treeData="treeData"
|
||||||
|
:tree-line="{ showLeafIcon: false }"
|
||||||
|
:treeDefaultExpandAll="true"
|
||||||
|
:fieldNames="{ label: '${treeName}', value: '${treeCode}' }"
|
||||||
|
:placeholder="$t('ui.formRules.selectRequired')"
|
||||||
|
:getPopupContainer="getPopupContainer"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "input")
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<Input v-model:value="formData.${field}" :placeholder="$t('ui.formRules.required')" />
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "imageUpload")
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<!-- props参考apps/web-antd/src/components/upload/src/image-upload.vue 25行 -->
|
||||||
|
<!-- maxNumber为1(默认)时只允许上传一个文件 会自动绑定为string而非string[] -->
|
||||||
|
<!-- resultField默认为url 可选ossId -->
|
||||||
|
<ImageUpload resultField="ossId" :max-number="1" v-model:value="formData.${field}" />
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "fileUpload")
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<!-- props参考apps/web-antd/src/components/upload/src/file-upload.vue 25行 -->
|
||||||
|
<!-- resultField默认为url 可选ossId -->
|
||||||
|
<FileUpload resultField="ossId" :max-number="1" v-model:value="formData.${field}" />
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "editor")
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<Tinymce
|
||||||
|
:options="{ readonly: false }"
|
||||||
|
v-model="formData.${field}"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<Select
|
||||||
|
v-model:value="formData.${field}"
|
||||||
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
|
:options="getDictOptions('$dictType', true)"
|
||||||
|
#else
|
||||||
|
:options="getDictOptions('$dictType')"
|
||||||
|
#end
|
||||||
|
:getPopupContainer="getPopupContainer"
|
||||||
|
:placeholder="$t('ui.formRules.selectRequired')"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "select" && "" == $dictType)
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<Select
|
||||||
|
v-model:value="formData.${field}"
|
||||||
|
:options="[]"
|
||||||
|
:getPopupContainer="getPopupContainer"
|
||||||
|
:placeholder="$t('ui.formRules.selectRequired')"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<CheckboxGroup
|
||||||
|
v-model:value="formData.${field}"
|
||||||
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
|
:options="getDictOptions('$dictType', true)"
|
||||||
|
#else
|
||||||
|
:options="getDictOptions('$dictType')"
|
||||||
|
#end
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "checkbox" && "" == $dictType)
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<CheckboxGroup
|
||||||
|
v-model:value="formData.${field}"
|
||||||
|
:options="[]"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<RadioGroup
|
||||||
|
option-type="button"
|
||||||
|
button-style="solid"
|
||||||
|
v-model:value="formData.${field}"
|
||||||
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
|
:options="getDictOptions('$dictType', true)"
|
||||||
|
#else
|
||||||
|
:options="getDictOptions('$dictType')"
|
||||||
|
#end
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "radio" && "" == $dictType)
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<RadioGroup
|
||||||
|
option-type="button"
|
||||||
|
button-style="solid"
|
||||||
|
v-model:value="formData.${field}"
|
||||||
|
:options="[]"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "datetime")
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<!-- 需要自行调整参数 -->
|
||||||
|
<DatePicker
|
||||||
|
v-model:value="formData.${field}"
|
||||||
|
format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#elseif($column.htmlType == "textarea")
|
||||||
|
<FormItem label="${comment}" v-bind="validateInfos.${field}">
|
||||||
|
<Textarea
|
||||||
|
v-model:value="formData.${field}"
|
||||||
|
:placeholder="$t('ui.formRules.required')"
|
||||||
|
:rows="4"
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
</Form>
|
||||||
|
</Basic${PopupComponent}>
|
||||||
|
</template>
|
||||||
|
#end
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
package org.dromara.system.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
|
import org.dromara.system.domain.vo.BSellerVo;
|
||||||
|
import org.dromara.system.domain.bo.BSellerBo;
|
||||||
|
import org.dromara.system.service.IBSellerService;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家信息
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-09-12
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/seller")
|
||||||
|
public class BSellerController extends BaseController {
|
||||||
|
|
||||||
|
private final IBSellerService bSellerService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询卖家信息列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:seller:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<BSellerVo> list(BSellerBo bo, PageQuery pageQuery) {
|
||||||
|
return bSellerService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出卖家信息列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:seller:export")
|
||||||
|
@Log(title = "卖家信息", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(BSellerBo bo, HttpServletResponse response) {
|
||||||
|
List<BSellerVo> list = bSellerService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "卖家信息", BSellerVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取卖家信息详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:seller:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<BSellerVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(bSellerService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增卖家信息
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:seller:add")
|
||||||
|
@Log(title = "卖家信息", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody BSellerBo bo) {
|
||||||
|
return toAjax(bSellerService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改卖家信息
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:seller:edit")
|
||||||
|
@Log(title = "卖家信息", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody BSellerBo bo) {
|
||||||
|
return toAjax(bSellerService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除卖家信息
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:seller:remove")
|
||||||
|
@Log(title = "卖家信息", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(bSellerService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,126 @@
|
|||||||
|
package org.dromara.system.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.dromara.system.domain.vo.BSellerVo;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
|
import org.dromara.system.domain.vo.BSellerSortVo;
|
||||||
|
import org.dromara.system.domain.bo.BSellerSortBo;
|
||||||
|
import org.dromara.system.service.IBSellerSortService;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上麦顺序
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-09-12
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/sellerSort")
|
||||||
|
public class BSellerSortController extends BaseController {
|
||||||
|
|
||||||
|
private final IBSellerSortService bSellerSortService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询上麦顺序列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:sellerSort:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<BSellerSortVo> list(BSellerSortBo bo, PageQuery pageQuery) {
|
||||||
|
return bSellerSortService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出上麦顺序列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:sellerSort:export")
|
||||||
|
@Log(title = "上麦顺序", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(BSellerSortBo bo, HttpServletResponse response) {
|
||||||
|
List<BSellerSortVo> list = bSellerSortService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "上麦顺序", BSellerSortVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取上麦顺序详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:sellerSort:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<BSellerSortVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(bSellerSortService.queryById(id));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取上麦顺序详细信息
|
||||||
|
*
|
||||||
|
* @param payDate 上麦日期
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:sellerSort:query")
|
||||||
|
@GetMapping("/queryByPayDate/{payDate}")
|
||||||
|
public R<BSellerSortVo> queryByPayDate(@NotNull(message = "日期不能为空")
|
||||||
|
@PathVariable String payDate) {
|
||||||
|
return R.ok(bSellerSortService.queryByPayDate(payDate));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增上麦顺序
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:sellerSort:add")
|
||||||
|
@Log(title = "上麦顺序", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody BSellerSortBo bo) {
|
||||||
|
return toAjax(bSellerSortService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改上麦顺序
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:sellerSort:edit")
|
||||||
|
@Log(title = "上麦顺序", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody BSellerSortBo bo) {
|
||||||
|
return toAjax(bSellerSortService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除上麦顺序
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:sellerSort:remove")
|
||||||
|
@Log(title = "上麦顺序", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(bSellerSortService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询上麦顺序列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:seller:list")
|
||||||
|
@GetMapping("/sellerList")
|
||||||
|
public R<List<BSellerVo>> sellerList() {
|
||||||
|
return R.ok(bSellerSortService.querySellerList()) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,143 @@
|
|||||||
|
package org.dromara.system.controller.system;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
|
import org.dromara.system.domain.vo.OrderVo;
|
||||||
|
import org.dromara.system.domain.bo.OrderBo;
|
||||||
|
import org.dromara.system.service.IOrderService;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单明细
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/order")
|
||||||
|
public class OrderController extends BaseController {
|
||||||
|
|
||||||
|
private final IOrderService orderService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询订单明细列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:order:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public R<Map<String,Object>> list(OrderBo bo, PageQuery pageQuery) {
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
|
map.put("page",orderService.queryPageList(bo, pageQuery));
|
||||||
|
Map<String,Double> totalData=orderService.queryPageListTotelData(bo);
|
||||||
|
map.put("totalData",totalData);
|
||||||
|
return R.ok(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出订单明细列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:order:export")
|
||||||
|
@Log(title = "订单明细", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(OrderBo bo, HttpServletResponse response) {
|
||||||
|
List<OrderVo> list = orderService.queryList(bo);
|
||||||
|
OrderVo totalData = new OrderVo();
|
||||||
|
totalData.setSellingPrice(new BigDecimal(0));
|
||||||
|
totalData.setMailPrice(new BigDecimal(0));
|
||||||
|
totalData.setActualPrice(new BigDecimal(0));
|
||||||
|
totalData.setRevenueMoney(new BigDecimal(0));
|
||||||
|
totalData.setSettlementAmount(new BigDecimal(0));
|
||||||
|
totalData.setTotalPrice(new BigDecimal(0));
|
||||||
|
totalData.setActualMailPrice(new BigDecimal(0));
|
||||||
|
totalData.setMailRevenueMoney(new BigDecimal(0));
|
||||||
|
totalData.setTotalRevenueMoney(new BigDecimal(0));
|
||||||
|
for (OrderVo vo : list) {
|
||||||
|
totalData.setSellingPrice(totalData.getSellingPrice().add(vo.getSellingPrice()));
|
||||||
|
totalData.setMailPrice(totalData.getMailPrice().add(vo.getMailPrice()));
|
||||||
|
totalData.setActualPrice(totalData.getActualPrice().add(vo.getActualPrice()));
|
||||||
|
totalData.setRevenueMoney(totalData.getRevenueMoney().add(vo.getRevenueMoney()));
|
||||||
|
totalData.setSettlementAmount(totalData.getSettlementAmount().add(vo.getSettlementAmount()));
|
||||||
|
totalData.setTotalPrice(totalData.getTotalPrice().add(vo.getTotalPrice()));
|
||||||
|
totalData.setActualMailPrice(totalData.getActualMailPrice().add(vo.getActualMailPrice()));
|
||||||
|
totalData.setMailRevenueMoney(totalData.getMailRevenueMoney().add(vo.getMailRevenueMoney()));
|
||||||
|
totalData.setTotalRevenueMoney(totalData.getTotalRevenueMoney().add(vo.getTotalRevenueMoney()));
|
||||||
|
|
||||||
|
}
|
||||||
|
list.add(totalData);
|
||||||
|
ExcelUtil.exportExcel(list, "订单明细", OrderVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取订单明细详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:order:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<OrderVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(orderService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增订单明细
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:order:add")
|
||||||
|
@Log(title = "订单明细", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody OrderBo bo) {
|
||||||
|
return toAjax(orderService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改订单明细
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:order:edit")
|
||||||
|
@Log(title = "订单明细", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody OrderBo bo) {
|
||||||
|
return toAjax(orderService.updateByBo(bo));
|
||||||
|
} /**
|
||||||
|
* 修改订单明细
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:order:edit")
|
||||||
|
@Log(title = "订单明细", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping("/updateOrderStatus")
|
||||||
|
public R<Void> updateOrderStatus(@Validated(EditGroup.class) @RequestBody OrderBo bo) {
|
||||||
|
return toAjax(orderService.updateOrderStatus(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除订单明细
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:order:remove")
|
||||||
|
@Log(title = "订单明细", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(orderService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
package org.dromara.system.domain;
|
||||||
|
|
||||||
|
import org.dromara.common.tenant.core.TenantEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家信息对象 b_seller
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-09-12
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("b_seller")
|
||||||
|
public class BSeller extends TenantEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家昵称
|
||||||
|
*/
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家电话
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 真实姓名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除标志(0代表存在 1代表删除)
|
||||||
|
*/
|
||||||
|
@TableLogic
|
||||||
|
private String delFlag;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
package org.dromara.system.domain;
|
||||||
|
|
||||||
|
import org.dromara.common.tenant.core.TenantEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上麦顺序对象 b_seller_sort
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-09-12
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("b_seller_sort")
|
||||||
|
public class BSellerSort extends TenantEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家id
|
||||||
|
*/
|
||||||
|
private Long sellerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家名称
|
||||||
|
*/
|
||||||
|
private String sellerNickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上麦时间
|
||||||
|
*/
|
||||||
|
private Date payDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顺序
|
||||||
|
*/
|
||||||
|
private Long sort;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,164 @@
|
|||||||
|
package org.dromara.system.domain;
|
||||||
|
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import org.dromara.common.tenant.core.TenantEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.dromara.common.translation.annotation.Translation;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单明细对象 b_order
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("b_order")
|
||||||
|
public class Order extends TenantEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 订单编号
|
||||||
|
*/
|
||||||
|
private String orderNo;
|
||||||
|
/**
|
||||||
|
* 顾客姓名
|
||||||
|
*/
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客电话
|
||||||
|
*/
|
||||||
|
private String customerPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客id
|
||||||
|
*/
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品名称
|
||||||
|
*/
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品图片
|
||||||
|
*/
|
||||||
|
private String productImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售价格
|
||||||
|
*/
|
||||||
|
private BigDecimal sellingPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮费实收
|
||||||
|
*/
|
||||||
|
private BigDecimal actualMailPrice;
|
||||||
|
/**
|
||||||
|
* 邮费收益
|
||||||
|
*/
|
||||||
|
private BigDecimal mailRevenueMoney;
|
||||||
|
/**
|
||||||
|
* 总收益
|
||||||
|
*/
|
||||||
|
private BigDecimal totalRevenueMoney;
|
||||||
|
/**
|
||||||
|
* 收益额
|
||||||
|
*/
|
||||||
|
private BigDecimal revenueMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮费
|
||||||
|
*/
|
||||||
|
private BigDecimal mailPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实收价格
|
||||||
|
*/
|
||||||
|
private BigDecimal actualPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单总额
|
||||||
|
*/
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
/**
|
||||||
|
* 结账金额
|
||||||
|
*/
|
||||||
|
private BigDecimal settlementAmount;
|
||||||
|
/**
|
||||||
|
* 退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal refundMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态(0未收款,1已收款,2已发货,3已签收,4已完成,5已取消,6申请退款,7申请退货,8退货已发货,9退货已签收,10退货成功)
|
||||||
|
*/
|
||||||
|
private String orderStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购买日期
|
||||||
|
*/
|
||||||
|
private Date buyData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付时间
|
||||||
|
*/
|
||||||
|
private Date payTime;
|
||||||
|
/**
|
||||||
|
* 取消时间
|
||||||
|
*/
|
||||||
|
private Date cancelTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货时间
|
||||||
|
*/
|
||||||
|
private Date shipmentTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货图片
|
||||||
|
*/
|
||||||
|
private String shipmentImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快递单号
|
||||||
|
*/
|
||||||
|
private String trackingNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除标志(0代表存在 1代表删除)
|
||||||
|
*/
|
||||||
|
@TableLogic
|
||||||
|
private String delFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 宝主名称
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String baozhuName;
|
||||||
|
/**
|
||||||
|
* 宝主id
|
||||||
|
*/
|
||||||
|
private String baozhuId;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
package org.dromara.system.domain.bo;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.BSeller;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家信息业务对象 b_seller
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-09-12
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = BSeller.class, reverseConvertGenerate = false)
|
||||||
|
public class BSellerBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家昵称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "卖家昵称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家电话
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 真实姓名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
package org.dromara.system.domain.bo;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.BSellerSort;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上麦顺序业务对象 b_seller_sort
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-09-12
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = BSellerSort.class, reverseConvertGenerate = false)
|
||||||
|
public class BSellerSortBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家id
|
||||||
|
*/
|
||||||
|
private Long sellerId;
|
||||||
|
/**
|
||||||
|
* 卖家的ids信息
|
||||||
|
*/
|
||||||
|
private String sellerIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家名称
|
||||||
|
*/
|
||||||
|
private String sellerNickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上麦时间
|
||||||
|
*/
|
||||||
|
private Date payDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顺序
|
||||||
|
*/
|
||||||
|
private Long sort;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,159 @@
|
|||||||
|
package org.dromara.system.domain.bo;
|
||||||
|
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import org.dromara.system.domain.Order;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import org.dromara.common.translation.annotation.Translation;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单明细业务对象 b_order
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = Order.class, reverseConvertGenerate = false)
|
||||||
|
public class OrderBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客姓名
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "顾客姓名不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String customerName;
|
||||||
|
/**
|
||||||
|
* 订单编号
|
||||||
|
*/
|
||||||
|
private String orderNo;
|
||||||
|
/**
|
||||||
|
* 顾客电话
|
||||||
|
*/
|
||||||
|
private String customerPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客id
|
||||||
|
*/
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品名称
|
||||||
|
*/
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品图片
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "产品图片不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String productImage;
|
||||||
|
/**
|
||||||
|
* 结账金额
|
||||||
|
*/
|
||||||
|
private BigDecimal settlementAmount;
|
||||||
|
/**
|
||||||
|
* 销售价格
|
||||||
|
*/
|
||||||
|
@NotNull(message = "销售价格不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private BigDecimal sellingPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮费
|
||||||
|
*/
|
||||||
|
private BigDecimal mailPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实收价格
|
||||||
|
*/
|
||||||
|
private BigDecimal actualPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮费实收
|
||||||
|
*/
|
||||||
|
private BigDecimal actualMailPrice;
|
||||||
|
/**
|
||||||
|
* 邮费收益
|
||||||
|
*/
|
||||||
|
private BigDecimal mailRevenueMoney;
|
||||||
|
/**
|
||||||
|
* 总收益
|
||||||
|
*/
|
||||||
|
private BigDecimal totalRevenueMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单总额
|
||||||
|
*/
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal refundMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态(0未收款,1已收款,2已发货,3已签收,4已完成,5已取消,6申请退款,7申请退货,8退货已发货,9退货已签收,10退货成功)
|
||||||
|
*/
|
||||||
|
private String orderStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购买日期
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "购买日期不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Date buyData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付时间
|
||||||
|
*/
|
||||||
|
private Date payTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货时间
|
||||||
|
*/
|
||||||
|
private Date shipmentTime;
|
||||||
|
/**
|
||||||
|
* 收益额
|
||||||
|
*/
|
||||||
|
private BigDecimal revenueMoney;
|
||||||
|
/**
|
||||||
|
* 发货图片
|
||||||
|
*/
|
||||||
|
private String shipmentImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快递单号
|
||||||
|
*/
|
||||||
|
private String trackingNumber;
|
||||||
|
/**
|
||||||
|
* 宝主名称
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String baozhuName;
|
||||||
|
/**
|
||||||
|
* 宝主id
|
||||||
|
*/
|
||||||
|
private String baozhuId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 取消时间
|
||||||
|
*/
|
||||||
|
private Date cancelTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
package org.dromara.system.domain.vo;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import cn.idev.excel.annotation.format.DateTimeFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.dromara.system.domain.BSellerSort;
|
||||||
|
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上麦顺序视图对象 b_seller_sort
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-09-12
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = BSellerSort.class)
|
||||||
|
public class BSellerSortVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "卖家id")
|
||||||
|
private Long sellerId;
|
||||||
|
/**
|
||||||
|
* 卖家id
|
||||||
|
*/
|
||||||
|
private String sellerIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "卖家名称")
|
||||||
|
private String sellerNickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上麦时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "上麦时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date payDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顺序
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "顺序")
|
||||||
|
private Long sort;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
package org.dromara.system.domain.vo;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.BSeller;
|
||||||
|
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家信息视图对象 b_seller
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-09-12
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = BSeller.class)
|
||||||
|
public class BSellerVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家昵称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "卖家昵称")
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家电话
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "卖家电话")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 真实姓名
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "真实姓名")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家地址
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "卖家地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家备注
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "卖家备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,216 @@
|
|||||||
|
package org.dromara.system.domain.vo;
|
||||||
|
|
||||||
|
import cn.idev.excel.annotation.ExcelIgnore;
|
||||||
|
import cn.idev.excel.annotation.format.DateTimeFormat;
|
||||||
|
import org.dromara.common.excel.annotation.ExcelRequired;
|
||||||
|
import org.dromara.common.translation.annotation.Translation;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
|
import org.dromara.system.domain.Order;
|
||||||
|
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单明细视图对象 b_order
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = Order.class)
|
||||||
|
public class OrderVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
|
@ExcelProperty(value = "")
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 订单编号
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "订单编号")
|
||||||
|
private String orderNo;
|
||||||
|
/**
|
||||||
|
* 宝主名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "宝主名称")
|
||||||
|
private String baozhuName;
|
||||||
|
/**
|
||||||
|
* 顾客姓名
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "顾客姓名")
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客电话
|
||||||
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
|
@ExcelProperty(value = "顾客电话")
|
||||||
|
private String customerPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客id
|
||||||
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
|
@ExcelProperty(value = "顾客id")
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品名称
|
||||||
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
|
@ExcelProperty(value = "产品名称")
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品图片
|
||||||
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
|
@ExcelProperty(value = "产品图片")
|
||||||
|
private String productImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品图片Url
|
||||||
|
*/
|
||||||
|
@Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "productImage")
|
||||||
|
private String productImageUrl;
|
||||||
|
/**
|
||||||
|
* 销售价格
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "销售价格")
|
||||||
|
private BigDecimal sellingPrice;
|
||||||
|
/**
|
||||||
|
* 结账金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "结账金额")
|
||||||
|
private BigDecimal settlementAmount;
|
||||||
|
/**
|
||||||
|
* 收益额
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "收益额")
|
||||||
|
private BigDecimal revenueMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮费付款
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "邮费付款")
|
||||||
|
private BigDecimal mailPrice;
|
||||||
|
/**
|
||||||
|
* 邮费收款
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "邮费收款")
|
||||||
|
private BigDecimal actualMailPrice;
|
||||||
|
/**
|
||||||
|
* 邮费收益
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "邮费收益")
|
||||||
|
private BigDecimal mailRevenueMoney;
|
||||||
|
/**
|
||||||
|
* 订单总额
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "订单总额")
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实收价格
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "实收价格")
|
||||||
|
private BigDecimal actualPrice;
|
||||||
|
/**
|
||||||
|
* 总收益
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "总收益")
|
||||||
|
private BigDecimal totalRevenueMoney;
|
||||||
|
/**
|
||||||
|
* 退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal refundMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态(0未收款,1已收款,2已发货,3已签收,4已完成,5已取消,6申请退款,7申请退货,8退货已发货,9退货已签收,10退货成功)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "订单状态", converter = ExcelDictConvert.class )
|
||||||
|
@ExcelDictFormat(dictType = "order_status")
|
||||||
|
private String orderStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购买日期
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "购买日期")
|
||||||
|
@DateTimeFormat("yyyy-MM-dd")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date buyData;
|
||||||
|
/**
|
||||||
|
* 购买时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "购买时间")
|
||||||
|
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "支付时间")
|
||||||
|
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date payTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "发货时间")
|
||||||
|
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date shipmentTime;
|
||||||
|
/**
|
||||||
|
* 取消时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "取消时间")
|
||||||
|
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date cancelTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货图片
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "发货图片")
|
||||||
|
private String shipmentImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货图片Url
|
||||||
|
*/
|
||||||
|
@Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "shipmentImage")
|
||||||
|
private String shipmentImageUrl;
|
||||||
|
/**
|
||||||
|
* 快递单号
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "快递单号")
|
||||||
|
private String trackingNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宝主id
|
||||||
|
*/
|
||||||
|
private String baozhuId;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.system.mapper;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.BSeller;
|
||||||
|
import org.dromara.system.domain.vo.BSellerVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家信息Mapper接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-09-12
|
||||||
|
*/
|
||||||
|
public interface BSellerMapper extends BaseMapperPlus<BSeller, BSellerVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.system.mapper;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.BSellerSort;
|
||||||
|
import org.dromara.system.domain.vo.BSellerSortVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上麦顺序Mapper接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-09-12
|
||||||
|
*/
|
||||||
|
public interface BSellerSortMapper extends BaseMapperPlus<BSellerSort, BSellerSortVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package org.dromara.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.dromara.system.domain.Order;
|
||||||
|
import org.dromara.system.domain.SysRole;
|
||||||
|
import org.dromara.system.domain.bo.OrderBo;
|
||||||
|
import org.dromara.system.domain.vo.OrderVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单明细Mapper接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
public interface OrderMapper extends BaseMapperPlus<Order, OrderVo> {
|
||||||
|
Map<String, Double> queryPageListTotelData(@Param(Constants.WRAPPER) Wrapper<Order> queryWrapper);
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
package org.dromara.system.service;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.vo.BSellerVo;
|
||||||
|
import org.dromara.system.domain.bo.BSellerBo;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家信息Service接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-09-12
|
||||||
|
*/
|
||||||
|
public interface IBSellerService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询卖家信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 卖家信息
|
||||||
|
*/
|
||||||
|
BSellerVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询卖家信息列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 卖家信息分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<BSellerVo> queryPageList(BSellerBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的卖家信息列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 卖家信息列表
|
||||||
|
*/
|
||||||
|
List<BSellerVo> queryList(BSellerBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增卖家信息
|
||||||
|
*
|
||||||
|
* @param bo 卖家信息
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(BSellerBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改卖家信息
|
||||||
|
*
|
||||||
|
* @param bo 卖家信息
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(BSellerBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除卖家信息信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
||||||
@ -0,0 +1,81 @@
|
|||||||
|
package org.dromara.system.service;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.vo.BSellerSortVo;
|
||||||
|
import org.dromara.system.domain.bo.BSellerSortBo;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.system.domain.vo.BSellerVo;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上麦顺序Service接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-09-12
|
||||||
|
*/
|
||||||
|
public interface IBSellerSortService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询上麦顺序
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 上麦顺序
|
||||||
|
*/
|
||||||
|
BSellerSortVo queryById(Long id);
|
||||||
|
/**
|
||||||
|
* 查询上麦顺序
|
||||||
|
*
|
||||||
|
* @param payDate 售卖日期
|
||||||
|
* @return 上麦顺序
|
||||||
|
*/
|
||||||
|
BSellerSortVo queryByPayDate(String payDate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询上麦顺序列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 上麦顺序分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<BSellerSortVo> queryPageList(BSellerSortBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的上麦顺序列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 上麦顺序列表
|
||||||
|
*/
|
||||||
|
List<BSellerSortVo> queryList(BSellerSortBo bo);
|
||||||
|
/**
|
||||||
|
* 查询所有卖家信息
|
||||||
|
*
|
||||||
|
* @return 卖家信息列表
|
||||||
|
*/
|
||||||
|
List<BSellerVo> querySellerList();
|
||||||
|
/**
|
||||||
|
* 新增上麦顺序
|
||||||
|
*
|
||||||
|
* @param bo 上麦顺序
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(BSellerSortBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改上麦顺序
|
||||||
|
*
|
||||||
|
* @param bo 上麦顺序
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(BSellerSortBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除上麦顺序信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
package org.dromara.system.service;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.vo.OrderVo;
|
||||||
|
import org.dromara.system.domain.bo.OrderBo;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单明细Service接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
public interface IOrderService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询订单明细
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 订单明细
|
||||||
|
*/
|
||||||
|
OrderVo queryById(Long id);
|
||||||
|
/**
|
||||||
|
* 查询订单明细
|
||||||
|
*
|
||||||
|
* @param bo 主键
|
||||||
|
* @return 订单明细
|
||||||
|
*/
|
||||||
|
Map<String,Double> queryPageListTotelData(OrderBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询订单明细列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 订单明细分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<OrderVo> queryPageList(OrderBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的订单明细列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 订单明细列表
|
||||||
|
*/
|
||||||
|
List<OrderVo> queryList(OrderBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增订单明细
|
||||||
|
*
|
||||||
|
* @param bo 订单明细
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(OrderBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改订单明细
|
||||||
|
*
|
||||||
|
* @param bo 订单明细
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(OrderBo bo);
|
||||||
|
/**
|
||||||
|
* 修改订单明细
|
||||||
|
*
|
||||||
|
* @param bo 订单明细
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateOrderStatus(OrderBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除订单明细信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
||||||
@ -0,0 +1,135 @@
|
|||||||
|
package org.dromara.system.service.impl;
|
||||||
|
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.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 lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.system.domain.bo.BSellerBo;
|
||||||
|
import org.dromara.system.domain.vo.BSellerVo;
|
||||||
|
import org.dromara.system.domain.BSeller;
|
||||||
|
import org.dromara.system.mapper.BSellerMapper;
|
||||||
|
import org.dromara.system.service.IBSellerService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖家信息Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-09-12
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class BSellerServiceImpl implements IBSellerService {
|
||||||
|
|
||||||
|
private final BSellerMapper baseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询卖家信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 卖家信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BSellerVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询卖家信息列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 卖家信息分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<BSellerVo> queryPageList(BSellerBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<BSeller> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<BSellerVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的卖家信息列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 卖家信息列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BSellerVo> queryList(BSellerBo bo) {
|
||||||
|
LambdaQueryWrapper<BSeller> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<BSeller> buildQueryWrapper(BSellerBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<BSeller> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByAsc(BSeller::getId);
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getNickName()), BSeller::getNickName, bo.getNickName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getPhone()), BSeller::getPhone, bo.getPhone());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getName()), BSeller::getName, bo.getName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getAddress()), BSeller::getAddress, bo.getAddress());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增卖家信息
|
||||||
|
*
|
||||||
|
* @param bo 卖家信息
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(BSellerBo bo) {
|
||||||
|
BSeller add = MapstructUtils.convert(bo, BSeller.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改卖家信息
|
||||||
|
*
|
||||||
|
* @param bo 卖家信息
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(BSellerBo bo) {
|
||||||
|
BSeller update = MapstructUtils.convert(bo, BSeller.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(BSeller entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除卖家信息信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,176 @@
|
|||||||
|
package org.dromara.system.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.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 lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.system.domain.vo.BSellerVo;
|
||||||
|
import org.dromara.system.mapper.BSellerMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.system.domain.bo.BSellerSortBo;
|
||||||
|
import org.dromara.system.domain.vo.BSellerSortVo;
|
||||||
|
import org.dromara.system.domain.BSellerSort;
|
||||||
|
import org.dromara.system.mapper.BSellerSortMapper;
|
||||||
|
import org.dromara.system.service.IBSellerSortService;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上麦顺序Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-09-12
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class BSellerSortServiceImpl implements IBSellerSortService {
|
||||||
|
|
||||||
|
private final BSellerSortMapper baseMapper;
|
||||||
|
private final BSellerMapper sellerMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询上麦顺序
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 上麦顺序
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BSellerSortVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BSellerSortVo queryByPayDate(String payDate) {
|
||||||
|
BSellerSortVo bSellerSortVo =new BSellerSortVo();
|
||||||
|
QueryWrapper<BSellerSort> objectQueryWrapper = new QueryWrapper<>();
|
||||||
|
objectQueryWrapper.eq("pay_date",payDate);
|
||||||
|
objectQueryWrapper.orderByAsc("sort");
|
||||||
|
List<BSellerSortVo> bSellerSortVos = baseMapper.selectVoList(objectQueryWrapper);
|
||||||
|
StringBuilder sellerIds= new StringBuilder();
|
||||||
|
for(int i=0;i<bSellerSortVos.size();i++){
|
||||||
|
if(i==bSellerSortVos.size()-1){
|
||||||
|
sellerIds.append(bSellerSortVos.get(i).getSellerId());
|
||||||
|
}else{
|
||||||
|
sellerIds.append(bSellerSortVos.get(i).getSellerId()).append(",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bSellerSortVo.setSellerIds(sellerIds.toString());
|
||||||
|
return bSellerSortVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询上麦顺序列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 上麦顺序分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<BSellerSortVo> queryPageList(BSellerSortBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<BSellerSort> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<BSellerSortVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的上麦顺序列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 上麦顺序列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BSellerSortVo> queryList(BSellerSortBo bo) {
|
||||||
|
LambdaQueryWrapper<BSellerSort> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BSellerVo> querySellerList() {
|
||||||
|
List<BSellerVo> bSellerVos = sellerMapper.selectVoList();
|
||||||
|
for (BSellerVo bSellerVo : bSellerVos) {
|
||||||
|
bSellerVo.setNickName(bSellerVo.getNickName()+ (StringUtils.isNotBlank(bSellerVo.getPhone())? " "+bSellerVo.getPhone():""));
|
||||||
|
}
|
||||||
|
return bSellerVos;
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<BSellerSort> buildQueryWrapper(BSellerSortBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<BSellerSort> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByDesc(BSellerSort::getPayDate);
|
||||||
|
lqw.eq(bo.getSellerId() != null, BSellerSort::getSellerId, bo.getSellerId());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getSellerNickName()), BSellerSort::getSellerNickName, bo.getSellerNickName());
|
||||||
|
lqw.eq(bo.getPayDate() != null, BSellerSort::getPayDate, bo.getPayDate());
|
||||||
|
lqw.eq(bo.getSort() != null, BSellerSort::getSort, bo.getSort());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增上麦顺序
|
||||||
|
*
|
||||||
|
* @param bo 上麦顺序
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(BSellerSortBo bo) {
|
||||||
|
QueryWrapper<BSellerSort> objectQueryWrapper = new QueryWrapper<>();
|
||||||
|
objectQueryWrapper.eq("pay_date",bo.getPayDate());
|
||||||
|
baseMapper.delete(objectQueryWrapper);
|
||||||
|
String[] split = bo.getSellerIds().split(",");
|
||||||
|
List<BSellerSort> saveList = new ArrayList<>();
|
||||||
|
for (int j = 0; j < split.length; j++) {
|
||||||
|
BSellerSort add = new BSellerSort();
|
||||||
|
add.setPayDate(bo.getPayDate());
|
||||||
|
add.setSort((long) (j+1));
|
||||||
|
BSellerVo bSellerVo = sellerMapper.selectVoById(split[j]);
|
||||||
|
add.setSellerId(bSellerVo.getId());
|
||||||
|
add.setSellerNickName(bSellerVo.getNickName());
|
||||||
|
saveList.add(add);
|
||||||
|
}
|
||||||
|
return baseMapper.insertBatch(saveList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改上麦顺序
|
||||||
|
*
|
||||||
|
* @param bo 上麦顺序
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(BSellerSortBo bo) {
|
||||||
|
BSellerSort update = MapstructUtils.convert(bo, BSellerSort.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(BSellerSort entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除上麦顺序信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,233 @@
|
|||||||
|
package org.dromara.system.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import org.dromara.common.core.utils.DateUtils;
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.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 lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.common.redis.utils.RedisUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.system.domain.bo.OrderBo;
|
||||||
|
import org.dromara.system.domain.vo.OrderVo;
|
||||||
|
import org.dromara.system.domain.Order;
|
||||||
|
import org.dromara.system.mapper.OrderMapper;
|
||||||
|
import org.dromara.system.service.IOrderService;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单明细Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class OrderServiceImpl implements IOrderService {
|
||||||
|
|
||||||
|
private final OrderMapper baseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询订单明细
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 订单明细
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public OrderVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Double> queryPageListTotelData(OrderBo bo) {
|
||||||
|
LambdaQueryWrapper<Order> lqw = buildQueryWrapper(bo);
|
||||||
|
lqw.eq( Order::getDelFlag, "0");
|
||||||
|
return baseMapper.queryPageListTotelData(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询订单明细列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 订单明细分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<OrderVo> queryPageList(OrderBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<Order> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<OrderVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的订单明细列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 订单明细列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<OrderVo> queryList(OrderBo bo) {
|
||||||
|
LambdaQueryWrapper<Order> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<Order> buildQueryWrapper(OrderBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<Order> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByAsc(Order::getCreateTime);
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getCustomerName()), Order::getCustomerName, bo.getCustomerName());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getBaozhuName()), Order::getBaozhuName, bo.getBaozhuName());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getOrderNo()), Order::getOrderNo, bo.getOrderNo());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getCustomerPhone()), Order::getCustomerPhone, bo.getCustomerPhone());
|
||||||
|
lqw.eq(bo.getCustomerId() != null, Order::getCustomerId, bo.getCustomerId());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getProductName()), Order::getProductName, bo.getProductName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getProductImage()), Order::getProductImage, bo.getProductImage());
|
||||||
|
lqw.eq(bo.getSellingPrice() != null, Order::getSellingPrice, bo.getSellingPrice());
|
||||||
|
lqw.eq(bo.getMailPrice() != null, Order::getMailPrice, bo.getMailPrice());
|
||||||
|
lqw.eq(bo.getActualPrice() != null, Order::getActualPrice, bo.getActualPrice());
|
||||||
|
lqw.eq(bo.getTotalPrice() != null, Order::getTotalPrice, bo.getTotalPrice());
|
||||||
|
lqw.eq(bo.getRefundMoney() != null, Order::getRefundMoney, bo.getRefundMoney());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getOrderStatus()), Order::getOrderStatus, bo.getOrderStatus());
|
||||||
|
lqw.eq(bo.getBuyData()!=null, Order::getBuyData, bo.getBuyData());
|
||||||
|
lqw.eq(bo.getPayTime() != null, Order::getPayTime, bo.getPayTime());
|
||||||
|
lqw.eq(bo.getShipmentTime() != null, Order::getShipmentTime, bo.getShipmentTime());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getShipmentImage()), Order::getShipmentImage, bo.getShipmentImage());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getTrackingNumber()), Order::getTrackingNumber, bo.getTrackingNumber());
|
||||||
|
if(bo.getParams() != null){
|
||||||
|
if(bo.getParams().get("buyDataBeginTime")!=null && !"".equals(bo.getParams().get("buyDataBeginTime"))){
|
||||||
|
lqw.between(Order::getBuyData,bo.getParams().get("buyDataBeginTime"),bo.getParams().get("buyDataEndTime"));
|
||||||
|
}
|
||||||
|
if(bo.getParams().get("payTimeBeginTime")!=null && !"".equals(bo.getParams().get("payTimeEndTime"))){
|
||||||
|
lqw.between(Order::getBuyData,bo.getParams().get("payTimeBeginTime"),bo.getParams().get("payTimeEndTime"));
|
||||||
|
}
|
||||||
|
if(bo.getParams().get("shipmentTimeBeginTime")!=null && !"".equals(bo.getParams().get("shipmentTimeEndTime"))){
|
||||||
|
lqw.between(Order::getBuyData,bo.getParams().get("shipmentTimeBeginTime"),bo.getParams().get("shipmentTimeEndTime"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增订单明细
|
||||||
|
*
|
||||||
|
* @param bo 订单明细
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(OrderBo bo) {
|
||||||
|
Order add = MapstructUtils.convert(bo, Order.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
if (add != null) {
|
||||||
|
add.setActualPrice(add.getSellingPrice().add(add.getActualMailPrice()));
|
||||||
|
add.setOrderNo(getOrderNo());
|
||||||
|
add.setSettlementAmount(add.getSellingPrice().multiply(new BigDecimal("0.9")));
|
||||||
|
add.setRevenueMoney(add.getSellingPrice().subtract(add.getSettlementAmount()));
|
||||||
|
add.setTotalPrice(add.getSellingPrice().add(add.getActualMailPrice()));
|
||||||
|
add.setMailRevenueMoney(add.getActualMailPrice().subtract(add.getMailPrice()));
|
||||||
|
add.setTotalRevenueMoney(add.getRevenueMoney().add(add.getMailRevenueMoney()));
|
||||||
|
add.setRefundMoney(new BigDecimal("0.00"));
|
||||||
|
}
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改订单明细
|
||||||
|
*
|
||||||
|
* @param bo 订单明细
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(OrderBo bo) {
|
||||||
|
Order update = MapstructUtils.convert(bo, Order.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
if (update != null) {
|
||||||
|
update.setActualPrice(update.getSellingPrice().add(update.getActualMailPrice()));
|
||||||
|
update.setSettlementAmount(update.getSellingPrice().multiply(new BigDecimal("0.9")));
|
||||||
|
update.setRevenueMoney(update.getSellingPrice().subtract(update.getSettlementAmount()));
|
||||||
|
update.setTotalPrice(update.getSellingPrice().add(update.getActualMailPrice()));
|
||||||
|
update.setMailRevenueMoney(update.getActualMailPrice().subtract(update.getMailPrice()));
|
||||||
|
update.setTotalRevenueMoney(update.getRevenueMoney().add(update.getMailRevenueMoney()));
|
||||||
|
}
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean updateOrderStatus(OrderBo bo) {
|
||||||
|
UpdateWrapper<Order> orderUpdateWrapper = new UpdateWrapper<Order>();
|
||||||
|
orderUpdateWrapper.eq("id", bo.getId());
|
||||||
|
orderUpdateWrapper.set("order_status",bo.getOrderStatus());
|
||||||
|
if(bo.getOrderStatus().equals("1")){
|
||||||
|
orderUpdateWrapper.set("pay_time",DateUtils.getNowDate());
|
||||||
|
}
|
||||||
|
if(bo.getOrderStatus().equals("0")){
|
||||||
|
orderUpdateWrapper.set("pay_time",null);
|
||||||
|
}
|
||||||
|
if(bo.getOrderStatus().equals("6")){
|
||||||
|
orderUpdateWrapper.set("cancel_time",DateUtils.getNowDate());
|
||||||
|
}else{
|
||||||
|
orderUpdateWrapper.set("cancel_time",null);
|
||||||
|
}
|
||||||
|
return baseMapper.update(orderUpdateWrapper) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(Order entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除订单明细信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrderNo() {
|
||||||
|
long orderNoDes=0;
|
||||||
|
if(!RedisUtils.hasKey("orderNo")){
|
||||||
|
RedisUtils.setAtomicValue("orderNo",0);
|
||||||
|
orderNoDes= RedisUtils.incrAtomicValue("orderNo");
|
||||||
|
// 获取当前日期和时间
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
// 获取当天的结束时间(23:59:59)
|
||||||
|
LocalDateTime endOfDay = LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
|
||||||
|
|
||||||
|
// 计算剩余时间
|
||||||
|
Duration remainingDuration = Duration.between(now, endOfDay);
|
||||||
|
long remainingMillis = remainingDuration.toMillis();
|
||||||
|
RedisUtils.expire("orderNo",Duration.ofMillis(remainingMillis));
|
||||||
|
}else{
|
||||||
|
orderNoDes=RedisUtils.incrAtomicValue("orderNo");
|
||||||
|
}
|
||||||
|
return "DJ"+DateUtils.getCurrentDate()+String.format("%04d",orderNoDes);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.dromara.system.mapper.BSellerMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.dromara.system.mapper.BSellerSortMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.dromara.system.mapper.OrderMapper">
|
||||||
|
<select id="queryPageListTotelData" resultType="java.util.Map">
|
||||||
|
SELECT
|
||||||
|
sum(revenue_money) as totalShouYi,
|
||||||
|
sum(actual_price) as totalShiShou,
|
||||||
|
sum(actual_mail_price) as totalYouFeiShiShou,
|
||||||
|
sum(mail_revenue_money) as totalYouFeiShouYi,
|
||||||
|
sum(selling_price) as totalXiaoShou,
|
||||||
|
sum(total_price) as totalLiuShui,
|
||||||
|
sum(mail_price) as totalYouFei,
|
||||||
|
sum(settlement_amount+mail_price) as totalFuKuan,
|
||||||
|
sum(total_revenue_money) as totalRevenueMoney,
|
||||||
|
sum(settlement_amount) as totalYingFu
|
||||||
|
FROM `b_order`
|
||||||
|
${ew.getCustomSqlSegment}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue
Block a user