mirror of
https://gitee.com/mmsAdmin/mms
synced 2025-12-06 17:08:54 +08:00
Compare commits
30 Commits
ea762f8a64
...
21109d4a8b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21109d4a8b | ||
|
|
1a9f233704 | ||
|
|
53d0780fcf | ||
|
|
9bd352e335 | ||
|
|
04ba8d1539 | ||
|
|
94f19d5e9c | ||
|
|
b6f9f09c05 | ||
|
|
bf61aebced | ||
|
|
0e37ccb2dd | ||
|
|
7038102329 | ||
|
|
383c52e79c | ||
|
|
d5c03818f9 | ||
|
|
1233984764 | ||
|
|
713247066f | ||
|
|
74676a97d8 | ||
|
|
3fcbe2fa6c | ||
|
|
fa6dac1057 | ||
|
|
0c0db2d2bc | ||
|
|
3c55bd1b2c | ||
|
|
69501b5574 | ||
|
|
346987106e | ||
|
|
a2d36832be | ||
|
|
bc9565a7a3 | ||
|
|
8bff73ddc1 | ||
|
|
c6a32fca9f | ||
|
|
34df200280 | ||
|
|
a087d73cff | ||
|
|
6ad6cb3460 | ||
|
|
a78eb75e1d | ||
|
|
e479fe9a5f |
@ -53,7 +53,7 @@ public class SysUserBo extends BaseEntity {
|
|||||||
* 用户账号
|
* 用户账号
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "账号不能为空", groups = {ValidatedGroupConfig.insert.class, ValidatedGroupConfig.update.class})
|
@NotBlank(message = "账号不能为空", groups = {ValidatedGroupConfig.insert.class, ValidatedGroupConfig.update.class})
|
||||||
@Size(min = 3, max = 20, message = "账号长度在3到20之间", groups = {ValidatedGroupConfig.insert.class, ValidatedGroupConfig.update.class})
|
@Size(min = 4, max = 20, message = "账号长度在5到20之间", groups = {ValidatedGroupConfig.insert.class, ValidatedGroupConfig.update.class})
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -99,20 +99,20 @@ public class SysLoginServiceImpl implements SysLoginService {
|
|||||||
|
|
||||||
if(sysConfigService.getIsOpenCaptcha()){
|
if(sysConfigService.getIsOpenCaptcha()){
|
||||||
if(StringUtil.isEmpty(code)){
|
if(StringUtil.isEmpty(code)){
|
||||||
throw new MmsException("验证码不能为空");
|
throw new MmsException("The verification code cannot be empty");
|
||||||
}
|
}
|
||||||
Map<String, Object> data = RedisUtil.getCacheObject(uuid);
|
Map<String, Object> data = RedisUtil.getCacheObject(uuid);
|
||||||
if (ObjectUtils.isEmpty(data)) {
|
if (ObjectUtils.isEmpty(data)) {
|
||||||
log.info("登录:验证码失效!");
|
log.info("登录:验证码失效!");
|
||||||
throw new LoginException("验证码失效");
|
throw new LoginException("Verification code failure");
|
||||||
}
|
}
|
||||||
if (!codeKey.equals(data.get(CaptchaEntity.CODE.CAPTCHA_KEY.getValue()))) {
|
if (!codeKey.equals(data.get(CaptchaEntity.CODE.CAPTCHA_KEY.getValue()))) {
|
||||||
log.info("登录:验证码与验证对象不匹配!");
|
log.info("登录:验证码与验证对象不匹配!");
|
||||||
throw new LoginException("验证码与验证对象不匹配");
|
throw new LoginException("Verification code does not match the verification object");
|
||||||
}
|
}
|
||||||
if (!code.equalsIgnoreCase((String) data.get(CaptchaEntity.CODE.CAPTCHA_VALUE.getValue()))) {
|
if (!code.equalsIgnoreCase((String) data.get(CaptchaEntity.CODE.CAPTCHA_VALUE.getValue()))) {
|
||||||
log.info("登录:验证码不匹配!");
|
log.info("登录:验证码不匹配!");
|
||||||
throw new LoginException("验证码不匹配");
|
throw new LoginException("Verification code does not match");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -130,11 +130,11 @@ public class SysLoginServiceImpl implements SysLoginService {
|
|||||||
SysTenant sysTenant = sysTenantService.selectById(sysUser.getTenantId());
|
SysTenant sysTenant = sysTenantService.selectById(sysUser.getTenantId());
|
||||||
if (ObjectUtils.isEmpty(sysTenant)) {
|
if (ObjectUtils.isEmpty(sysTenant)) {
|
||||||
log.info("登录用户ID:{} 租户不存在.", sysUser.getUserId());
|
log.info("登录用户ID:{} 租户不存在.", sysUser.getUserId());
|
||||||
throw new TenantException("租户不存在");
|
throw new TenantException("tenant.not.exists");
|
||||||
}
|
}
|
||||||
if (!sysTenant.getStatus().equals(SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue())) {
|
if (!sysTenant.getStatus().equals(SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue())) {
|
||||||
log.info("登录用户ID:{} 租户状态为禁用.", sysUser.getUserId());
|
log.info("登录用户ID:{} 租户状态为禁用.", sysUser.getUserId());
|
||||||
throw new TenantException("租户状态为禁用");
|
throw new TenantException("tenant off state");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.sxpcwlkj.system.service.impl;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.sxpcwlkj.common.enums.SystemCommonEnum;
|
||||||
import com.sxpcwlkj.common.utils.DataUtil;
|
import com.sxpcwlkj.common.utils.DataUtil;
|
||||||
import com.sxpcwlkj.common.utils.MapstructUtil;
|
import com.sxpcwlkj.common.utils.MapstructUtil;
|
||||||
import com.sxpcwlkj.common.utils.StringUtil;
|
import com.sxpcwlkj.common.utils.StringUtil;
|
||||||
@ -98,6 +99,6 @@ public class SysNoticeServiceImpl extends BaseServiceImpl<SysNotice, SysNoticeVo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long selectTool() {
|
public Long selectTool() {
|
||||||
return baseMapper.selectCount(new LambdaQueryWrapper<SysNotice>().eq(SysNotice::getStatus,0));
|
return baseMapper.selectCount(new LambdaQueryWrapper<SysNotice>().eq(SysNotice::getStatus, SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -123,6 +123,7 @@ public class SysOssConfigServiceImpl extends BaseServiceImpl<SysOssConfig, SysOs
|
|||||||
baseMapper.update(null, new LambdaUpdateWrapper<SysOssConfig>().set(SysOssConfig::getStatus, SystemCommonEnum.SYS_COMMON_STATE_CLOSE.getValue()).eq(SysOssConfig::getStatus, SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue()));
|
baseMapper.update(null, new LambdaUpdateWrapper<SysOssConfig>().set(SysOssConfig::getStatus, SystemCommonEnum.SYS_COMMON_STATE_CLOSE.getValue()).eq(SysOssConfig::getStatus, SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue()));
|
||||||
}
|
}
|
||||||
bo.setId(configVo.getId());
|
bo.setId(configVo.getId());
|
||||||
|
bo.setRevision(configVo.getRevision());
|
||||||
row = baseMapper.updateById(MapstructUtil.convert(bo, SysOssConfig.class));
|
row = baseMapper.updateById(MapstructUtil.convert(bo, SysOssConfig.class));
|
||||||
} else {
|
} else {
|
||||||
if (bo.getStatus().toString().equals(SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue().toString()) ) {
|
if (bo.getStatus().toString().equals(SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue().toString()) ) {
|
||||||
@ -141,7 +142,7 @@ public class SysOssConfigServiceImpl extends BaseServiceImpl<SysOssConfig, SysOs
|
|||||||
@Override
|
@Override
|
||||||
public List<FileStorageConfig> getOss() {
|
public List<FileStorageConfig> getOss() {
|
||||||
//
|
//
|
||||||
List<SysOssConfigVo> vos = baseMapper.selectVoList(new LambdaQueryWrapper<SysOssConfig>().orderByAsc(SysOssConfig::getStatus));
|
List<SysOssConfigVo> vos = baseMapper.selectVoList(new LambdaQueryWrapper<SysOssConfig>().orderByDesc(SysOssConfig::getStatus));
|
||||||
List<FileStorageConfig> list = new ArrayList<>();
|
List<FileStorageConfig> list = new ArrayList<>();
|
||||||
for (SysOssConfigVo configVo : vos) {
|
for (SysOssConfigVo configVo : vos) {
|
||||||
if (configVo != null) {
|
if (configVo != null) {
|
||||||
|
|||||||
@ -450,7 +450,7 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long selectTool() {
|
public Long selectTool() {
|
||||||
return baseMapper.selectCount(new LambdaQueryWrapper<SysUser>().eq(SysUser::getStatus, 0));
|
return baseMapper.selectCount(new LambdaQueryWrapper<SysUser>().eq(SysUser::getStatus, SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
--- # 项目基础信息
|
--- # 项目基础信息
|
||||||
sxpcwlkj:
|
sxpcwlkj:
|
||||||
#名称
|
#名称
|
||||||
name: MMS
|
name: mmsAdmin
|
||||||
#描述
|
#描述
|
||||||
describe: 一款多模块化管理系统(Modular management system),简称:MMS,是一款基于多应用模块用户、商品、支付、订单、分销、日志、定时、通信、直播、广告、文章等多模块应用开源系统,可快速的应用与各类项目研发中,定期更新功能修复、上新、技术栈分享 (十年磨一剑,我们的目标是做最优价值的开源项目)!
|
describe: 一款多模块化管理系统(Modular management system),简称:MMS,是一款基于多应用模块用户、商品、支付、订单、分销、日志、定时、通信、直播、广告、文章等多模块应用开源系统,可快速的应用与各类项目研发中,定期更新功能修复、上新、技术栈分享 (十年磨一剑,我们的目标是做最优价值的开源项目)!
|
||||||
#版本
|
#版本
|
||||||
@ -16,7 +16,7 @@ sxpcwlkj:
|
|||||||
# 演示模式配置
|
# 演示模式配置
|
||||||
demo:
|
demo:
|
||||||
mode:
|
mode:
|
||||||
enabled: false # 默认开启演示模式
|
enabled: true # 默认开启演示模式
|
||||||
message-template: "演示模式下禁止{operation}操作 [实体: {entity}, 方法: {method}]"
|
message-template: "演示模式下禁止{operation}操作 [实体: {entity}, 方法: {method}]"
|
||||||
allowed-users: # 白名单用户
|
allowed-users: # 白名单用户
|
||||||
- admin
|
- admin
|
||||||
|
|||||||
@ -5,36 +5,36 @@
|
|||||||
|
|
||||||
#菜单
|
#菜单
|
||||||
INSERT INTO `sys_function`(`parent_id`,`path`,`name`,`component`,`language_code`,`type`,`sort`,`icon`,`status`,`visible`,`is_iframe`,`is_open_link`,`is_link`,`keep_alive`,`always_show`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
INSERT INTO `sys_function`(`parent_id`,`path`,`name`,`component`,`language_code`,`type`,`sort`,`icon`,`status`,`visible`,`is_iframe`,`is_open_link`,`is_link`,`keep_alive`,`always_show`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
||||||
values (${menuId},'/${moduleName}/${functionName}','${tableComment}','${moduleName}/${functionName}/index','${tableComment}',1,1,'',0,-1,-1,-1,'',1,-1,'000000',${dbTime},${dbTime},1);
|
values (${menuId},'/${moduleName}/${functionName}','${tableComment}','${moduleName}/${functionName}/index','${tableComment}',1,1,'',1,-1,-1,-1,'',1,-1,'000000',${dbTime},${dbTime},1);
|
||||||
|
|
||||||
#列表
|
#列表
|
||||||
INSERT INTO `sys_function`(`parent_id`,`name`,`permission`,`type`,`sort`,`status`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
INSERT INTO `sys_function`(`parent_id`,`name`,`permission`,`type`,`sort`,`status`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
||||||
values ((SELECT `min_id` FROM (SELECT MAX(id) AS min_id FROM `sys_function` WHERE `name` = '${tableComment}') AS a),'${tableComment}-列表','${moduleName}:${functionName}:list',2,2,0,'000000',${dbTime},${dbTime},1);
|
values ((SELECT `min_id` FROM (SELECT MAX(id) AS min_id FROM `sys_function` WHERE `name` = '${tableComment}') AS a),'${tableComment}-列表','${moduleName}:${functionName}:list',2,2,1,'000000',${dbTime},${dbTime},1);
|
||||||
|
|
||||||
#新增
|
#新增
|
||||||
INSERT INTO `sys_function`(`parent_id`,`name`,`permission`,`type`,`sort`,`status`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
INSERT INTO `sys_function`(`parent_id`,`name`,`permission`,`type`,`sort`,`status`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
||||||
values ((SELECT `min_id` FROM (SELECT MAX(id) AS min_id FROM `sys_function` WHERE `name` = '${tableComment}') AS a),'${tableComment}-新增','${moduleName}:${functionName}:insert',2,3,0,'000000',${dbTime},${dbTime},1);
|
values ((SELECT `min_id` FROM (SELECT MAX(id) AS min_id FROM `sys_function` WHERE `name` = '${tableComment}') AS a),'${tableComment}-新增','${moduleName}:${functionName}:insert',2,3,1,'000000',${dbTime},${dbTime},1);
|
||||||
|
|
||||||
#删除
|
#删除
|
||||||
INSERT INTO `sys_function`(`parent_id`,`name`,`permission`,`type`,`sort`,`status`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
INSERT INTO `sys_function`(`parent_id`,`name`,`permission`,`type`,`sort`,`status`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
||||||
values ((SELECT `min_id` FROM (SELECT MAX(id) AS min_id FROM `sys_function` WHERE `name` = '${tableComment}') AS a),'${tableComment}-删除','${moduleName}:${functionName}:delete',2,4,0,'000000',${dbTime},${dbTime},1);
|
values ((SELECT `min_id` FROM (SELECT MAX(id) AS min_id FROM `sys_function` WHERE `name` = '${tableComment}') AS a),'${tableComment}-删除','${moduleName}:${functionName}:delete',2,4,1,'000000',${dbTime},${dbTime},1);
|
||||||
|
|
||||||
#编辑
|
#编辑
|
||||||
INSERT INTO `sys_function`(`parent_id`,`name`,`permission`,`type`,`sort`,`status`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
INSERT INTO `sys_function`(`parent_id`,`name`,`permission`,`type`,`sort`,`status`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
||||||
values ((SELECT `min_id` FROM (SELECT MAX(id) AS min_id FROM `sys_function` WHERE `name` = '${tableComment}') AS a),'${tableComment}-编辑','${moduleName}:${functionName}:edit',2,5,0,'000000',${dbTime},${dbTime},1);
|
values ((SELECT `min_id` FROM (SELECT MAX(id) AS min_id FROM `sys_function` WHERE `name` = '${tableComment}') AS a),'${tableComment}-编辑','${moduleName}:${functionName}:edit',2,5,1,'000000',${dbTime},${dbTime},1);
|
||||||
|
|
||||||
#查询
|
#查询
|
||||||
INSERT INTO `sys_function`(`parent_id`,`name`,`permission`,`type`,`sort`,`status`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
INSERT INTO `sys_function`(`parent_id`,`name`,`permission`,`type`,`sort`,`status`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
||||||
values ((SELECT `min_id` FROM (SELECT MAX(id) AS min_id FROM `sys_function` WHERE `name` = '${tableComment}') AS a),'${tableComment}-查询','${moduleName}:${functionName}:query',2,6,0,'000000',${dbTime},${dbTime},1);
|
values ((SELECT `min_id` FROM (SELECT MAX(id) AS min_id FROM `sys_function` WHERE `name` = '${tableComment}') AS a),'${tableComment}-查询','${moduleName}:${functionName}:query',2,6,1,'000000',${dbTime},${dbTime},1);
|
||||||
|
|
||||||
#导入
|
#导入
|
||||||
INSERT INTO `sys_function`(`parent_id`,`name`,`permission`,`type`,`sort`,`status`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
INSERT INTO `sys_function`(`parent_id`,`name`,`permission`,`type`,`sort`,`status`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
||||||
values ((SELECT `min_id` FROM (SELECT MAX(id) AS min_id FROM `sys_function` WHERE `name` = '${tableComment}') AS a),'${tableComment}-导入','${moduleName}:${functionName}:import',2,6,0,'000000',${dbTime},${dbTime},1);
|
values ((SELECT `min_id` FROM (SELECT MAX(id) AS min_id FROM `sys_function` WHERE `name` = '${tableComment}') AS a),'${tableComment}-导入','${moduleName}:${functionName}:import',2,7,1,'000000',${dbTime},${dbTime},1);
|
||||||
|
|
||||||
#导出
|
#导出
|
||||||
INSERT INTO `sys_function`(`parent_id`,`name`,`permission`,`type`,`sort`,`status`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
INSERT INTO `sys_function`(`parent_id`,`name`,`permission`,`type`,`sort`,`status`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
||||||
values ((SELECT `min_id` FROM (SELECT MAX(id) AS min_id FROM `sys_function` WHERE `name` = '${tableComment}') AS a),'${tableComment}-导出','${moduleName}:${functionName}:export',2,6,0,'000000',${dbTime},${dbTime},1);
|
values ((SELECT `min_id` FROM (SELECT MAX(id) AS min_id FROM `sys_function` WHERE `name` = '${tableComment}') AS a),'${tableComment}-导出','${moduleName}:${functionName}:export',2,8,1,'000000',${dbTime},${dbTime},1);
|
||||||
|
|
||||||
#打印
|
#打印
|
||||||
INSERT INTO `sys_function`(`parent_id`,`name`,`permission`,`type`,`sort`,`status`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
INSERT INTO `sys_function`(`parent_id`,`name`,`permission`,`type`,`sort`,`status`,`tenant_id`,`created_time`,`updated_time`,`revision`)
|
||||||
values ((SELECT `min_id` FROM (SELECT MAX(id) AS min_id FROM `sys_function` WHERE `name` = '${tableComment}') AS a),'${tableComment}-打印','${moduleName}:${functionName}:print',2,6,0,'000000',${dbTime},${dbTime},1);
|
values ((SELECT `min_id` FROM (SELECT MAX(id) AS min_id FROM `sys_function` WHERE `name` = '${tableComment}') AS a),'${tableComment}-打印','${moduleName}:${functionName}:print',2,9,1,'000000',${dbTime},${dbTime},1);
|
||||||
|
|||||||
@ -135,7 +135,12 @@
|
|||||||
<script setup lang="ts" name="${moduleName}${FunctionName}Dialog">
|
<script setup lang="ts" name="${moduleName}${FunctionName}Dialog">
|
||||||
import {nextTick, reactive, ref} from "vue";
|
import {nextTick, reactive, ref} from "vue";
|
||||||
import {CURDEnum} from '/@/enums/CURDEnum';
|
import {CURDEnum} from '/@/enums/CURDEnum';
|
||||||
|
import {ElMessage} from "element-plus";
|
||||||
import {${FunctionName}Bo, ${FunctionName}Vo} from '/@/views/${moduleName}/${functionName}/type';
|
import {${FunctionName}Bo, ${FunctionName}Vo} from '/@/views/${moduleName}/${functionName}/type';
|
||||||
|
<#if formLayout==2 >
|
||||||
|
import {${functionName}Api} from '/@/views/${moduleName}/${functionName}';
|
||||||
|
const baseApi = ${functionName}Api();
|
||||||
|
</#if>
|
||||||
|
|
||||||
const dialogWidth = ref('50vw');
|
const dialogWidth = ref('50vw');
|
||||||
<#list fastList as field>
|
<#list fastList as field>
|
||||||
@ -154,6 +159,9 @@
|
|||||||
import FastSwitch from "/@/components/fast-switch/src/fast-switch.vue";
|
import FastSwitch from "/@/components/fast-switch/src/fast-switch.vue";
|
||||||
</#if>
|
</#if>
|
||||||
</#list>
|
</#list>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 定义子组件向父组件传值/事件
|
// 定义子组件向父组件传值/事件
|
||||||
const emit = defineEmits(['refresh']);
|
const emit = defineEmits(['refresh']);
|
||||||
const dialogFormRef = ref();
|
const dialogFormRef = ref();
|
||||||
@ -176,7 +184,9 @@
|
|||||||
<#list fieldList as field>
|
<#list fieldList as field>
|
||||||
<#if !field.baseField||field.attrName =='status'||field.attrName =='sort'||field.attrName =='remark'>
|
<#if !field.baseField||field.attrName =='status'||field.attrName =='sort'||field.attrName =='remark'>
|
||||||
<#if field.fieldType == 'int'>
|
<#if field.fieldType == 'int'>
|
||||||
<#if field.attrName =='sort'>
|
<#if field.attrName =='status'>
|
||||||
|
${field.attrName}: 1<#sep>,
|
||||||
|
<#elseif field.attrName =='sort'>
|
||||||
${field.attrName}: 1<#sep>,
|
${field.attrName}: 1<#sep>,
|
||||||
<#else>
|
<#else>
|
||||||
${field.attrName}: 0<#sep>,
|
${field.attrName}: 0<#sep>,
|
||||||
@ -237,7 +247,7 @@
|
|||||||
}
|
}
|
||||||
<#if formLayout==2 >
|
<#if formLayout==2 >
|
||||||
// 选择监听
|
// 选择监听
|
||||||
const change = (arr: number[]) => {
|
const change = (arr: string[]) => {
|
||||||
state.ruleForm.${tableParentId} = arr[arr.length - 1];
|
state.ruleForm.${tableParentId} = arr[arr.length - 1];
|
||||||
};
|
};
|
||||||
</#if>
|
</#if>
|
||||||
|
|||||||
@ -227,7 +227,7 @@
|
|||||||
</#if>
|
</#if>
|
||||||
</#list>
|
</#list>
|
||||||
<#if formLayout==2 >
|
<#if formLayout==2 >
|
||||||
,isAll:true,
|
isAll:true,
|
||||||
</#if>
|
</#if>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,8 +8,12 @@ import lombok.Data;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class ThreeQueryBo {
|
public class ThreeQueryBo {
|
||||||
//true:全部数据 false:有效数据(status=0)
|
/**
|
||||||
|
* true:全部数据 false:有效数据(status=0)
|
||||||
|
*/
|
||||||
private Boolean isAll=false;
|
private Boolean isAll=false;
|
||||||
//显示级别,0:全部 1:一级 2:二级 3:三级
|
/**
|
||||||
|
* 显示级别,0:全部 1:一级 2:二级 3:三级
|
||||||
|
*/
|
||||||
private Integer showLevel=0;
|
private Integer showLevel=0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,7 +40,7 @@ public class BaseEntity extends PageQuery {
|
|||||||
/* --------------- 业务状态控制字段 --------------- */
|
/* --------------- 业务状态控制字段 --------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据状态(1=禁用,0=启用)
|
* 数据状态(0=禁用,1=启用)
|
||||||
*/
|
*/
|
||||||
@TableField(fill = FieldFill.INSERT)
|
@TableField(fill = FieldFill.INSERT)
|
||||||
private Integer status = 0;
|
private Integer status = 0;
|
||||||
|
|||||||
@ -11,9 +11,7 @@ import com.sxpcwlkj.gen.entity.TableEntity;
|
|||||||
import com.sxpcwlkj.gen.entity.TableFieldEntity;
|
import com.sxpcwlkj.gen.entity.TableFieldEntity;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.sql.DatabaseMetaData;
|
import java.sql.*;
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -185,4 +183,130 @@ public class GenUtils {
|
|||||||
return NamingCase.toCamelCase(className);
|
return NamingCase.toCamelCase(className);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行更新SQL(INSERT/UPDATE/DELETE)
|
||||||
|
* @param datasource 数据源
|
||||||
|
* @param sql SQL语句
|
||||||
|
* @param params SQL参数
|
||||||
|
* @return 受影响的行数
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 示例:增加 编辑 删除
|
||||||
|
// int affectedRows = executeUpdate(datasource,
|
||||||
|
// "UPDATE users SET name = ? WHERE id = ?",
|
||||||
|
// new Object[]{"张三", 1});
|
||||||
|
public static int executeUpdate(GenDataSource datasource, String sql, Object[] params) {
|
||||||
|
try (Connection conn = datasource.getConnection();
|
||||||
|
PreparedStatement pstmt = conn.prepareStatement(sql)) {
|
||||||
|
|
||||||
|
// 设置参数
|
||||||
|
if (params != null) {
|
||||||
|
for (int i = 0; i < params.length; i++) {
|
||||||
|
pstmt.setObject(i + 1, params[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pstmt.executeUpdate();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("执行更新失败: {}", sql, e);
|
||||||
|
throw new MmsException("执行更新操作失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量执行SQL
|
||||||
|
* @param datasource 数据源
|
||||||
|
* @param sql SQL语句
|
||||||
|
* @param batchParams 批量参数列表
|
||||||
|
* @return 每个操作的受影响行数数组
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 示例:批量插入
|
||||||
|
// List<Object[]> batchParams = new ArrayList<>();
|
||||||
|
// batchParams.add(new Object[]{"user1", "user1@example.com"});
|
||||||
|
// batchParams.add(new Object[]{"user2", "user2@example.com"});
|
||||||
|
// int[] batchResult = executeBatch(datasource,
|
||||||
|
// "INSERT INTO users (name, email) VALUES (?, ?)",
|
||||||
|
// batchParams);
|
||||||
|
public static int[] executeBatch(GenDataSource datasource, String sql, List<Object[]> batchParams) {
|
||||||
|
try (Connection conn = datasource.getConnection();
|
||||||
|
PreparedStatement pstmt = conn.prepareStatement(sql)) {
|
||||||
|
|
||||||
|
// 禁用自动提交,开启事务
|
||||||
|
conn.setAutoCommit(false);
|
||||||
|
|
||||||
|
for (Object[] params : batchParams) {
|
||||||
|
if (params != null) {
|
||||||
|
for (int i = 0; i < params.length; i++) {
|
||||||
|
pstmt.setObject(i + 1, params[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pstmt.addBatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] result = pstmt.executeBatch();
|
||||||
|
// 提交事务
|
||||||
|
conn.commit();
|
||||||
|
// 恢复自动提交
|
||||||
|
conn.setAutoCommit(true);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("批量执行失败: {}", sql, e);
|
||||||
|
throw new MmsException("批量执行操作失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行查询SQL并返回对象列表
|
||||||
|
* @param datasource 数据源
|
||||||
|
* @param sql SQL语句
|
||||||
|
* @param params SQL参数
|
||||||
|
* @param mapper 结果映射器
|
||||||
|
* @param <T> 返回类型
|
||||||
|
* @return 查询结果列表
|
||||||
|
*/
|
||||||
|
|
||||||
|
//示例:查询
|
||||||
|
// List<User> users = queryForList(datasource,
|
||||||
|
// "SELECT * FROM users WHERE status = ?",
|
||||||
|
// new Object[]{"active"},
|
||||||
|
// rs -> {
|
||||||
|
// User u = new User();
|
||||||
|
// u.setId(rs.getInt("id"));
|
||||||
|
// u.setName(rs.getString("name"));
|
||||||
|
// return u;
|
||||||
|
// });
|
||||||
|
public static <T> List<T> queryForList(GenDataSource datasource, String sql, Object[] params,
|
||||||
|
ResultSetMapper<T> mapper) {
|
||||||
|
List<T> resultList = new ArrayList<>();
|
||||||
|
|
||||||
|
try (Connection conn = datasource.getConnection();
|
||||||
|
PreparedStatement pstmt = conn.prepareStatement(sql)) {
|
||||||
|
|
||||||
|
// 设置参数
|
||||||
|
if (params != null) {
|
||||||
|
for (int i = 0; i < params.length; i++) {
|
||||||
|
pstmt.setObject(i + 1, params[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try (ResultSet rs = pstmt.executeQuery()) {
|
||||||
|
while (rs.next()) {
|
||||||
|
resultList.add(mapper.mapRow(rs));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("执行查询失败: {}", sql, e);
|
||||||
|
throw new MmsException("查询数据失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 结果映射器接口
|
||||||
|
public interface ResultSetMapper<T> {
|
||||||
|
T mapRow(ResultSet rs) throws SQLException;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,9 +2,9 @@ oms.env=prod
|
|||||||
|
|
||||||
####### Database properties(Configure according to the the environment) #######
|
####### Database properties(Configure according to the the environment) #######
|
||||||
spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver
|
spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
spring.datasource.core.jdbc-url=jdbc:mysql://localhost:3306/sxpcwlkj_mms?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
|
spring.datasource.core.jdbc-url=jdbc:mysql://localhost:3306/mms?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
|
||||||
spring.datasource.core.username=sxpcwlkj_mms
|
spring.datasource.core.username=mms
|
||||||
spring.datasource.core.password=dkfa7WNTbdDJB8ny
|
spring.datasource.core.password=123456
|
||||||
spring.datasource.core.maximum-pool-size=20
|
spring.datasource.core.maximum-pool-size=20
|
||||||
spring.datasource.core.minimum-idle=5
|
spring.datasource.core.minimum-idle=5
|
||||||
|
|
||||||
|
|||||||
13
pom.xml
13
pom.xml
@ -556,7 +556,18 @@
|
|||||||
<artifactId>weixin-java-cp</artifactId>
|
<artifactId>weixin-java-cp</artifactId>
|
||||||
<version>${weixin.version}</version>
|
<version>${weixin.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- 文档管理模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sxpcwlkj</groupId>
|
||||||
|
<artifactId>mms-doc-admin</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- 文档API模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sxpcwlkj</groupId>
|
||||||
|
<artifactId>mms-doc-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|||||||
57437
script/db/mms.pdma
Normal file
57437
script/db/mms.pdma
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user