!300 refactor: vue3 vxe table

Merge pull request !300 from xingyu/feature/vue3
This commit is contained in:
芋道源码 2022-11-28 11:41:21 +00:00 committed by Gitee
commit 391fec3758
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
294 changed files with 16654 additions and 15311 deletions

View File

@ -190,11 +190,11 @@ ps核心功能已经实现正在对接微信小程序中...
|---------------------------------------------------------------------------------------------|-----------------------|-------------|----------------------------------------------------------------|
| [Spring Boot](https://spring.io/projects/spring-boot) | 应用开发框架 | 2.6.13 | [文档](https://github.com/YunaiV/SpringBoot-Labs) |
| [MySQL](https://www.mysql.com/cn/) | 数据库服务器 | 5.7 / 8.0+ | |
| [Druid](https://github.com/alibaba/druid) | JDBC 连接池、监控组件 | 1.2.14 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) |
| [Druid](https://github.com/alibaba/druid) | JDBC 连接池、监控组件 | 1.2.15 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) |
| [MyBatis Plus](https://mp.baomidou.com/) | MyBatis 增强工具包 | 3.5.2 | [文档](http://www.iocoder.cn/Spring-Boot/MyBatis/?yudao) |
| [Dynamic Datasource](https://dynamic-datasource.com/) | 动态数据源 | 3.5.2 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) |
| [Redis](https://redis.io/) | key-value 数据库 | 5.0 / 6.0 | |
| [Redisson](https://github.com/redisson/redisson) | Redis 客户端 | 3.17.7 | [文档](http://www.iocoder.cn/Spring-Boot/Redis/?yudao) |
| [Redisson](https://github.com/redisson/redisson) | Redis 客户端 | 3.18.0 | [文档](http://www.iocoder.cn/Spring-Boot/Redis/?yudao) |
| [Spring MVC](https://github.com/spring-projects/spring-framework/tree/master/spring-webmvc) | MVC 框架 | 5.3.23 | [文档](http://www.iocoder.cn/SpringMVC/MVC/?yudao) |
| [Spring Security](https://github.com/spring-projects/spring-security) | Spring 安全框架 | 5.6.8 | [文档](http://www.iocoder.cn/Spring-Boot/Spring-Security/?yudao) |
| [Hibernate Validator](https://github.com/hibernate/hibernate-validator) | 参数校验组件 | 6.2.3 | [文档](http://www.iocoder.cn/Spring-Boot/Validation/?yudao) |
@ -220,15 +220,14 @@ ps核心功能已经实现正在对接微信小程序中...
### [管理后台 Vue3 前端](./yudao-ui-admin-vue3)
| 框架 | 说明 | 版本 |
|----------------------------------------------------------------------|-----------------|--------|
| [Vue](https://staging-cn.vuejs.org/) | Vue 框架 | 3.2.44 |
|----------------------------------------------------------------------|:------------:|:------:|
| [Vue](https://staging-cn.vuejs.org/) | Vue 框架 | 3.2.45 |
| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 3.2.3 |
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.2.20 |
| [TypeScript](https://www.typescriptlang.org/docs/) | TypeScript | 4.8.4 |
| [pinia](https://pinia.vuejs.org/) | vuex5 | 2.0.23 |
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.2.25 |
| [TypeScript](https://www.typescriptlang.org/docs/) | TypeScript | 4.9.3 |
| [pinia](https://pinia.vuejs.org/) | vuex5 | 2.0.27 |
| [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 9.2.2 |
| [windicss](https://cn.windicss.org/) | 下一代工具优先的 CSS 框架 | 3.5.6 |
| [iconify](https://icon-sets.iconify.design/) | 在线图标库 | 3.0.0 |
| [vxe-table](https://vxetable.cn/) | vue最强表单 | 4.5.6 |
### [管理后台 uni-app 跨端](./yudao-ui-admin-uniapp)

View File

@ -19,15 +19,14 @@
<spring.boot.version>2.6.13</spring.boot.version>
<!-- Web 相关 -->
<knife4j.version>3.0.3</knife4j.version>
<swagger-annotations.version>1.6.7</swagger-annotations.version>
<swagger-annotations.version>1.6.8</swagger-annotations.version>
<servlet.versoin>2.5</servlet.versoin>
<!-- DB 相关 -->
<druid.version>1.2.14</druid.version>
<druid.version>1.2.15</druid.version>
<mybatis-plus.version>3.5.2</mybatis-plus.version>
<mybatis-plus-generator.version>3.5.2</mybatis-plus-generator.version>
<dynamic-datasource.version>3.5.2</dynamic-datasource.version>
<redisson.version>3.17.7</redisson.version>
<!-- Config 配置中心相关 -->
<redisson.version>3.18.0</redisson.version>
<!-- 服务保障相关 -->
<lock4j.version>2.2.2</lock4j.version>
<resilience4j.version>1.7.1</resilience4j.version>
@ -44,8 +43,8 @@
<!-- 工具类相关 -->
<lombok.version>1.18.24</lombok.version>
<mapstruct.version>1.5.3.Final</mapstruct.version>
<hutool.version>5.8.9</hutool.version>
<easyexcel.verion>3.1.2</easyexcel.verion>
<hutool.version>5.8.10</hutool.version>
<easyexcel.verion>3.1.3</easyexcel.verion>
<velocity.version>2.3</velocity.version>
<screw.version>1.0.5</screw.version>
<fastjson.version>1.2.83</fastjson.version>
@ -496,6 +495,7 @@
<artifactId>commons-net</artifactId> <!-- 解决 ftp 连接 -->
<version>${commons-net.version}</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId> <!-- 解决 sftp 连接 -->
@ -559,6 +559,12 @@
<groupId>org.jeecgframework.jimureport</groupId>
<artifactId>jimureport-spring-boot-starter</artifactId>
<version>${jimureport.version}</version>
<exclusions>
<exclusion>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>xerces</groupId>

View File

@ -52,7 +52,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.9</version>
<version>5.8.10</version>
</dependency>
<dependency>

View File

@ -52,7 +52,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.9</version>
<version>5.8.10</version>
</dependency>
<dependency>

View File

@ -83,11 +83,6 @@ public class DateUtils {
return buildTime(year, mouth, day, 0, 0, 0);
}
@Deprecated
public static LocalDateTime buildLocalDateTime(int year, int mouth, int day) {
return LocalDateTime.of(year, mouth, day, 0, 0, 0);
}
/**
* 创建指定时间
*
@ -132,11 +127,6 @@ public class DateUtils {
return a.isAfter(b) ? a : b;
}
@Deprecated
public static boolean afterNow(LocalDateTime localDateTime) {
return localDateTime.isAfter(LocalDateTime.now());
}
/**
* 计算当期时间相差的日期
*

View File

@ -39,7 +39,7 @@ public abstract class AbstractChannelMessageListener<T extends AbstractChannelMe
@SneakyThrows
protected AbstractChannelMessageListener() {
this.messageType = getMessageClass();
this.channel = messageType.newInstance().getChannel();
this.channel = messageType.getDeclaredConstructor().newInstance().getChannel();
}
/**

View File

@ -50,7 +50,7 @@ public abstract class AbstractStreamMessageListener<T extends AbstractStreamMess
@SneakyThrows
protected AbstractStreamMessageListener() {
this.messageType = getMessageClass();
this.streamKey = messageType.newInstance().getStreamKey();
this.streamKey = messageType.getDeclaredConstructor().newInstance().getStreamKey();
}
@Override

View File

@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.bpm.service.definition;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
import cn.iocoder.yudao.framework.test.core.util.AssertUtils;
import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
@ -19,7 +18,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.USER_GROUP_NOT_EXISTS;
@ -106,7 +105,7 @@ public class BpmUserGroupServiceTest extends BaseDbUnitTest {
BpmUserGroupDO dbUserGroup = RandomUtils.randomPojo(BpmUserGroupDO.class, o -> { // 等会查询到
o.setName("芋道源码");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(DateUtils.buildLocalDateTime(2021, 11, 11));
o.setCreateTime(buildTime(2021, 11, 11));
});
userGroupMapper.insert(dbUserGroup);
// 测试 name 不匹配
@ -114,12 +113,12 @@ public class BpmUserGroupServiceTest extends BaseDbUnitTest {
// 测试 status 不匹配
userGroupMapper.insert(cloneIgnoreId(dbUserGroup, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
// 测试 createTime 不匹配
userGroupMapper.insert(cloneIgnoreId(dbUserGroup, o -> o.setCreateTime(DateUtils.buildLocalDateTime(2021, 12, 12))));
userGroupMapper.insert(cloneIgnoreId(dbUserGroup, o -> o.setCreateTime(buildTime(2021, 12, 12))));
// 准备参数
BpmUserGroupPageReqVO reqVO = new BpmUserGroupPageReqVO();
reqVO.setName("源码");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 11, 10),buildLocalDateTime(2021, 11, 12)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 11, 10),buildTime(2021, 11, 12)}));
// 调用
PageResult<BpmUserGroupDO> pageResult = userGroupService.getUserGroupPage(reqVO);

View File

@ -91,8 +91,6 @@ public class CodegenEngine {
vue3FilePath("views/${table.moduleName}/${classNameVar}/${classNameVar}.data.ts"))
.put(vue3TemplatePath("api/api.ts"),
vue3FilePath("api/${table.moduleName}/${classNameVar}/index.ts"))
.put(vue3TemplatePath("api/types.ts"),
vue3FilePath("api/${table.moduleName}/${classNameVar}/types.ts"))
// SQL
.put("codegen/sql/sql.vm", "sql/sql.sql")
.put("codegen/sql/h2.vm", "sql/h2.sql")

View File

@ -1,7 +1,48 @@
import request from '@/config/axios'
import { ${simpleClassName}VO, ${simpleClassName}PageReqVO, ${simpleClassName}ExcelReqVO } from './types'
export interface ${simpleClassName}VO {
#foreach ($column in $columns)
#if ($column.createOperation || $column.updateOperation)
#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer")
${column.javaField}: number
#elseif(${column.javaType.toLowerCase()} == "date")
${column.javaField}: string
#else
${column.javaField}: ${column.javaType.toLowerCase()}
#end
#end
#end
}
export interface ${simpleClassName}PageReqVO extends PageParam {
#foreach ($column in $columns)
#if (${column.listOperation})##查询操作
#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer")
${column.javaField}?: number
#elseif(${column.javaType.toLowerCase()} == "date")
${column.javaField}?: string[]
#else
${column.javaField}?: ${column.javaType.toLowerCase()}
#end
#end
#end
}
export interface ${simpleClassName}ExcelReqVO {
#foreach ($column in $columns)
#if (${column.listOperation})##查询操作
#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer")
${column.javaField}?: number
#elseif(${column.javaType.toLowerCase()} == "date")
${column.javaField}?: string[]
#else
${column.javaField}?: ${column.javaType.toLowerCase()}
#end
#end
#end
}
#set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}")
// 查询${table.classComment}列表
export const get${simpleClassName}PageApi = async (params: ${simpleClassName}PageReqVO) => {
return await request.get({ url: '${baseURL}/page', params })

View File

@ -1,41 +0,0 @@
export type ${simpleClassName}VO = {
#foreach ($column in $columns)
#if ($column.createOperation || $column.updateOperation)
#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer")
${column.javaField}: number
#elseif(${column.javaType.toLowerCase()} == "date")
${column.javaField}: string
#else
${column.javaField}: ${column.javaType.toLowerCase()}
#end
#end
#end
}
export type ${simpleClassName}PageReqVO = {
#foreach ($column in $columns)
#if (${column.listOperation})##查询操作
#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer")
${column.javaField}: number
#elseif(${column.javaType.toLowerCase()} == "date")
${column.javaField}: string
#else
${column.javaField}: ${column.javaType.toLowerCase()}
#end
#end
#end
}
export type ${simpleClassName}ExcelReqVO = {
#foreach ($column in $columns)
#if (${column.listOperation})##查询操作
#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer")
${column.javaField}: number
#elseif(${column.javaType.toLowerCase()} == "date")
${column.javaField}: string
#else
${column.javaField}: ${column.javaType.toLowerCase()}
#end
#end
#end
}

View File

@ -1,51 +1,54 @@
import { reactive } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
import { DICT_TYPE } from '@/utils/dict'
import { required } from '@/utils/formRules'
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
const { t } = useI18n() // 国际化
// 表单校验
export const rules = reactive({
#foreach ($column in $columns)
#if (($column.createOperation || $column.updateOperation) && !$column.nullable && !${column.primaryKey})## 创建或者更新操作 && 要求非空 && 非主键
#set($comment=$column.columnComment)
$column.javaField: [{ required: true, message: '${comment}不能为空', trigger: #if($column.htmlType == "select")'change'#else'blur'#end }],
$column.javaField: [required],
#end
#end
})
// CrudSchema
const crudSchemas = reactive<CrudSchema[]>([
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id', // 默认的主键ID
primaryTitle: t('common.index'), // 默认显示的值
primaryType: 'seq', // 默认为seq序号模式
action: true,
actionWidth: '200', // 3个按钮默认200如有删减对应增减即可
columns: [
#foreach($column in $columns)
#if ($column.listOperation || $column.listOperationResult || $column.createOperation || $column.updateOperation)
#set ($dictType = $column.dictType)
#if(!$column.primaryKey)
{
label: '${column.columnComment}',
title: '${column.columnComment}',
field: '${column.javaField}',
#if ("" != $dictType)## 有数据字典
dictType: DICT_TYPE.$dictType.toUpperCase(),
#end
#if($column.primaryKey)
type: 'index',
form: {
show: false
},
detail: {
show: false
}
#if (${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer")
dictData: 'number',
#else
dictData: 'string',
#end
#end
#if (!$column.createOperation && !$column.updateOperation)
form: {
show: false
},
isForm: false,
#elseif(!("" != $column.dictType))
form: {
show: true,
#if ($column.htmlType == "datetime")## 时间框
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'YYYY-MM-DD HH:mm:ss'
}
},
#elseif($column.htmlType == "editor")## 文本编辑器
form: {
component: 'Editor',
colProps: {
span: 24
@ -53,7 +56,9 @@ const crudSchemas = reactive<CrudSchema[]>([
componentProps: {
valueHtml: ''
}
},
#elseif($column.htmlType == "textarea")## 文本框
form: {
component: 'Input',
componentProps: {
type: 'textarea',
@ -62,50 +67,32 @@ const crudSchemas = reactive<CrudSchema[]>([
colProps: {
span: 24
}
#end
},
#elseif(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer")## 数字类型
form: {
component: 'InputNumber',
value: 0
},
#end
#end
#if ($column.listOperationResult)
search: {
#if($column.htmlType == "input")
show: true
#else
#if($column.htmlType == "datetime")
isSearch: true,
#elseif("" != $dictType)
isSearch: true,
#elseif($column.htmlType == "datetime")
search: {
show: true,
component: 'DatePicker',
componentProps: {
type: 'datetimerange',
valueFormat: 'YYYY-MM-DD HH:mm:ss'
itemRender: {
name: 'XDataTimePicker'
}
#elseif($column.htmlType == "select" || $column.htmlType == "radio")
#if ("" == $dictType)## 没有数据字典
show: true,
component: 'Select',
componentProps: {
option: [{'','请选择字典生成'}]
}
#else
show: true
},
#end
#end
#end
}
#end
#end
},
#end
#end
{
label: t('table.action'),
field: 'action',
width: '240px',
form: {
show: false
},
detail: {
show: false
}
}
])
export const { allSchemas } = useCrudSchemas(crudSchemas)
]
})
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)

View File

@ -1,51 +1,151 @@
<script setup lang="ts">
<template>
<ContentWrap>
<!-- 列表 -->
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
<template #toolbar_buttons>
<!-- 操作:新增 -->
<XButton
type="primary"
preIcon="ep:zoom-in"
:title="t('action.add')"
v-hasPermi="['${permissionPrefix}:create']"
@click="handleCreate()"
/>
<!-- 操作:导出 -->
<XButton
type="warning"
preIcon="ep:download"
:title="t('action.export')"
v-hasPermi="['${permissionPrefix}:export']"
@click="handleExport()"
/>
</template>
<template #actionbtns_default="{ row }">
<!-- 操作:修改 -->
<XTextButton
preIcon="ep:edit"
:title="t('action.edit')"
v-hasPermi="['${permissionPrefix}:update']"
@click="handleUpdate(row.id)"
/>
<!-- 操作:详情 -->
<XTextButton
preIcon="ep:view"
:title="t('action.detail')"
v-hasPermi="['${permissionPrefix}:query']"
@click="handleDetail(row.id)"
/>
<!-- 操作:删除 -->
<XTextButton
preIcon="ep:delete"
:title="t('action.del')"
v-hasPermi="['${permissionPrefix}:delete']"
@click="handleDelete(row.id)"
/>
</template>
</vxe-grid>
</ContentWrap>
<!-- 弹窗 -->
<XModal id="${classNameVar}Model" :loading="modelLoading" v-model="modelVisible" :title="modelTitle">
<!-- 表单:添加/修改 -->
<Form
ref="formRef"
v-if="['create', 'update'].includes(actionType)"
:schema="allSchemas.formSchema"
:rules="rules"
/>
<!-- 表单:详情 -->
<Descriptions
v-if="actionType === 'detail'"
:schema="allSchemas.detailSchema"
:data="detailData"
/>
<template #footer>
<!-- 按钮:保存 -->
<XButton
v-if="['create', 'update'].includes(actionType)"
type="primary"
:title="t('action.save')"
:loading="actionLoading"
@click="submitForm()"
/>
<!-- 按钮:关闭 -->
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="modelVisible = false" />
</template>
</XModal>
</template>
<script setup lang="ts" name="${table.moduleName}">
// 全局相关的 import
import { ref, unref } from 'vue'
import dayjs from 'dayjs'
import { ElMessage } from 'element-plus'
import { DICT_TYPE } from '@/utils/dict'
import { useTable } from '@/hooks/web/useTable'
import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage'
import { useVxeGrid } from '@/hooks/web/useVxeGrid'
import { VxeGridInstance } from 'vxe-table'
import { FormExpose } from '@/components/Form'
import type { ${simpleClassName}VO } from '@/api/${table.moduleName}/${classNameVar}/types'
// 业务相关的 import
import { rules, allSchemas } from './${classNameVar}.data'
import * as ${simpleClassName}Api from '@/api/${table.moduleName}/${classNameVar}'
const { t } = useI18n() // 国际化
// ========== 列表相关 ==========
const { register, tableObject, methods } = useTable<${simpleClassName}VO>({
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗
// 列表相关的变量
const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
const { gridOptions, reloadList, deleteData, exportList } = useVxeGrid<${simpleClassName}Api.${simpleClassName}VO>({
allSchemas: allSchemas,
getListApi: ${simpleClassName}Api.get${simpleClassName}PageApi,
delListApi: ${simpleClassName}Api.delete${simpleClassName}Api,
deleteApi: ${simpleClassName}Api.delete${simpleClassName}Api,
exportListApi: ${simpleClassName}Api.export${simpleClassName}Api
})
const { getList, setSearchParams, delList, exportList } = methods
// ========== CRUD 相关 ==========
const actionLoading = ref(false) // 遮罩层
// 弹窗相关的变量
const modelVisible = ref(false) // 是否显示弹出层
const modelTitle = ref('edit') // 弹出层标题
const modelLoading = ref(false) // 弹出层loading
const actionType = ref('') // 操作按钮的类型
const dialogVisible = ref(false) // 是否显示弹出层
const dialogTitle = ref('edit') // 弹出层标题
const actionLoading = ref(false) // 按钮 Loading
const formRef = ref<FormExpose>() // 表单 Ref
const detailData = ref() // 详情 Ref
// 设置标题
const setDialogTile = (type: string) => {
dialogTitle.value = t('action.' + type)
modelLoading.value = true
modelTitle.value = t('action.' + type)
actionType.value = type
dialogVisible.value = true
modelVisible.value = true
}
// 新增操作
const handleCreate = () => {
setDialogTile('create')
// 重置表单
unref(formRef)?.getElFormRef()?.resetFields()
modelLoading.value = false
}
// 导出操作
const handleExport = async () => {
await exportList(xGrid, '${table.classComment}.xls')
}
// 修改操作
const handleUpdate = async (row: ${simpleClassName}VO) => {
const handleUpdate = async (rowId: number) => {
setDialogTile('update')
// 设置数据
const res = await ${simpleClassName}Api.get${simpleClassName}Api(row.id)
const res = await ${simpleClassName}Api.get${simpleClassName}Api(rowId)
unref(formRef)?.setValues(res)
modelLoading.value = false
}
// 详情操作
const handleDetail = async (rowId: number) => {
setDialogTile('detail')
const res = await ${simpleClassName}Api.get${simpleClassName}Api(rowId)
detailData.value = res
modelLoading.value = false
}
// 删除操作
const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId)
}
// 提交按钮
@ -57,156 +157,21 @@ const submitForm = async () => {
actionLoading.value = true
// 提交请求
try {
const data = unref(formRef)?.formModel as ${simpleClassName}VO
const data = unref(formRef)?.formModel as ${simpleClassName}Api.${simpleClassName}VO
if (actionType.value === 'create') {
await ${simpleClassName}Api.create${simpleClassName}Api(data)
ElMessage.success(t('common.createSuccess'))
message.success(t('common.createSuccess'))
} else {
await ${simpleClassName}Api.update${simpleClassName}Api(data)
ElMessage.success(t('common.updateSuccess'))
message.success(t('common.updateSuccess'))
}
// 操作成功,重新加载列表
dialogVisible.value = false
await getList()
modelVisible.value = false
} finally {
actionLoading.value = false
// 刷新列表
await reloadList(xGrid)
}
}
})
}
// ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref
// 详情操作
const handleDetail = async (row: ${simpleClassName}VO) => {
// 设置数据
detailRef.value = row
setDialogTile('detail')
}
// ========== 初始化 ==========
getList()
</script>
<template>
<!-- 搜索工作区 -->
<ContentWrap>
<Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<ContentWrap>
<!-- 操作工具栏 -->
<div class="mb-10px">
<XButton
type="primary"
preIcon="ep:zoom-in"
:title="t('action.add')"
v-hasPermi="['${permissionPrefix}:create']"
@click="handleCreate()"
/>
<XButton
type="warning"
preIcon="ep:download"
:title="t('action.export')"
v-hasPermi="['${permissionPrefix}:export']"
@click="exportList('数据.xls')"
/>
</div>
<!-- 列表 -->
<Table
:columns="allSchemas.tableColumns"
:selection="false"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
@register="register"
>
#foreach($column in $columns)
#if ($column.listOperationResult)
#set ($dictType=$column.dictType)
#if ($column.javaType == "LocalDateTime")## 时间类型
<template #${column.javaField}="{ row }">
<span>{{ dayjs(row.${column.javaField}).format('YYYY-MM-DD HH:mm:ss') }}</span>
</template>
#elseif("" != $column.dictType)## 数据字典
<template #${column.javaField}="{ row }">
<DictTag :type="DICT_TYPE.$dictType.toUpperCase()" :value="row.${column.javaField}" />
</template>
#end
#end
#end
<template #action="{ row }">
<XButton
link
type="primary"
preIcon="ep:edit"
:title="t('action.edit')"
v-hasPermi="['${permissionPrefix}:update']"
@click="handleUpdate(row.id)"
/>
<XButton
link
type="primary"
preIcon="ep:view"
:title="t('action.detail')"
v-hasPermi="['${permissionPrefix}:update']"
@click="handleDetail(row)"
/>
<XButton
link
type="primary"
preIcon="ep:delete"
:title="t('action.del')"
v-hasPermi="['${permissionPrefix}:delete']"
@click="handleDelete(row.id)"
/>
</template>
</Table>
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<!-- 对话框(添加 / 修改) -->
<Form
v-if="['create', 'update'].includes(actionType)"
:schema="allSchemas.formSchema"
:rules="rules"
ref="formRef"
/>
<!-- 对话框(详情) -->
<Descriptions
v-if="actionType === 'detail'"
:schema="allSchemas.detailSchema"
:data="detailRef"
>
#foreach($column in $columns)
#if ($column.listOperationResult)
#set ($dictType=$column.dictType)
#if ($column.javaType == "LocalDateTime")## 时间类型
<template #${column.javaField}="{ row }">
<span>{{ dayjs(row.${column.javaField}).format('YYYY-MM-DD HH:mm:ss') }}</span>
</template>
#elseif("" != $column.dictType)## 数据字典
<template #${column.javaField}="{ row }">
<DictTag :type="DICT_TYPE.$dictType.toUpperCase()" :value="row.${column.javaField}" />
</template>
#end
#end
#end
</Descriptions>
<!-- 操作按钮 -->
<template #footer>
<XButton
v-if="['create', 'update'].includes(actionType)"
:loading="actionLoading"
:title="t('action.save')"
type="primary"
@click="submitForm"
/>
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="dialogVisible = false" />
</template>
</Dialog>
</template>

View File

@ -22,7 +22,7 @@ import java.util.List;
import java.util.function.Consumer;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
@ -153,7 +153,7 @@ public class ConfigServiceTest extends BaseDbUnitTest {
o.setName("芋艿");
o.setConfigKey("yunai");
o.setType(ConfigTypeEnum.SYSTEM.getType());
o.setCreateTime(buildLocalDateTime(2021, 2, 1));
o.setCreateTime(buildTime(2021, 2, 1));
});
configMapper.insert(dbConfig);
// 测试 name 不匹配
@ -163,13 +163,13 @@ public class ConfigServiceTest extends BaseDbUnitTest {
// 测试 type 不匹配
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setType(ConfigTypeEnum.CUSTOM.getType())));
// 测试 createTime 不匹配
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildLocalDateTime(2021, 1, 1))));
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1))));
// 准备参数
ConfigPageReqVO reqVO = new ConfigPageReqVO();
reqVO.setName("");
reqVO.setKey("nai");
reqVO.setType(ConfigTypeEnum.SYSTEM.getType());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 1, 15),buildLocalDateTime(2021, 2, 15)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 1, 15),buildTime(2021, 2, 15)}));
// 调用
PageResult<ConfigDO> pageResult = configService.getConfigPage(reqVO);
@ -186,7 +186,7 @@ public class ConfigServiceTest extends BaseDbUnitTest {
o.setName("芋艿");
o.setConfigKey("yunai");
o.setType(ConfigTypeEnum.SYSTEM.getType());
o.setCreateTime(buildLocalDateTime(2021, 2, 1));
o.setCreateTime(buildTime(2021, 2, 1));
});
configMapper.insert(dbConfig);
// 测试 name 不匹配
@ -196,13 +196,13 @@ public class ConfigServiceTest extends BaseDbUnitTest {
// 测试 type 不匹配
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setType(ConfigTypeEnum.CUSTOM.getType())));
// 测试 createTime 不匹配
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildLocalDateTime(2021, 1, 1))));
configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1))));
// 准备参数
ConfigExportReqVO reqVO = new ConfigExportReqVO();
reqVO.setName("");
reqVO.setKey("nai");
reqVO.setType(ConfigTypeEnum.SYSTEM.getType());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 1, 15),buildLocalDateTime(2021, 2, 15)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 1, 15),buildTime(2021, 2, 15)}));
// 调用
List<ConfigDO> list = configService.getConfigList(reqVO);

View File

@ -28,7 +28,7 @@ import java.time.LocalDateTime;
import java.util.Map;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.max;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
@ -219,8 +219,8 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest {
FileConfigPageReqVO reqVO = new FileConfigPageReqVO();
reqVO.setName("芋道");
reqVO.setStorage(FileStorageEnum.LOCAL.getStorage());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2020, 1, 1),
buildLocalDateTime(2020, 1, 24)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2020, 1, 1),
buildTime(2020, 1, 24)}));
// 调用
PageResult<FileConfigDO> pageResult = fileConfigService.getFileConfigPage(reqVO);

View File

@ -17,7 +17,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
@ -43,7 +43,7 @@ public class FileServiceTest extends BaseDbUnitTest {
FileDO dbFile = randomPojo(FileDO.class, o -> { // 等会查询到
o.setPath("yunai");
o.setType("image/jpg");
o.setCreateTime(buildLocalDateTime(2021, 1, 15));
o.setCreateTime(buildTime(2021, 1, 15));
});
fileMapper.insert(dbFile);
// 测试 path 不匹配
@ -54,13 +54,13 @@ public class FileServiceTest extends BaseDbUnitTest {
}));
// 测试 createTime 不匹配
fileMapper.insert(ObjectUtils.cloneIgnoreId(dbFile, o -> {
o.setCreateTime(buildLocalDateTime(2020, 1, 15));
o.setCreateTime(buildTime(2020, 1, 15));
}));
// 准备参数
FilePageReqVO reqVO = new FilePageReqVO();
reqVO.setPath("yunai");
reqVO.setType("jp");
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 1, 10), buildLocalDateTime(2021, 1, 20)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 1, 10), buildTime(2021, 1, 20)}));
// 调用
PageResult<FileDO> pageResult = fileService.getFilePage(reqVO);

View File

@ -16,7 +16,7 @@ import java.util.ArrayList;
import java.util.List;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -96,8 +96,8 @@ public class JobLogServiceTest extends BaseDbUnitTest {
o.setExecuteIndex(1);
o.setHandlerName("handlerName 单元测试");
o.setStatus(JobLogStatusEnum.SUCCESS.getStatus());
o.setBeginTime(buildLocalDateTime(2021, 1, 8));
o.setEndTime(buildLocalDateTime(2021, 1, 8));
o.setBeginTime(buildTime(2021, 1, 8));
o.setEndTime(buildTime(2021, 1, 8));
});
jobLogMapper.insert(dbJobLog);
// 测试 jobId 不匹配
@ -105,9 +105,9 @@ public class JobLogServiceTest extends BaseDbUnitTest {
// 测试 handlerName 不匹配
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString())));
// 测试 beginTime 不匹配
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setBeginTime(buildLocalDateTime(2021, 1, 7))));
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setBeginTime(buildTime(2021, 1, 7))));
// 测试 endTime 不匹配
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildLocalDateTime(2021, 1, 9))));
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9))));
// 测试 status 不匹配
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setStatus(JobLogStatusEnum.FAILURE.getStatus())));
// 准备参数
@ -132,8 +132,8 @@ public class JobLogServiceTest extends BaseDbUnitTest {
o.setExecuteIndex(1);
o.setHandlerName("handlerName 单元测试");
o.setStatus(JobLogStatusEnum.SUCCESS.getStatus());
o.setBeginTime(buildLocalDateTime(2021, 1, 8));
o.setEndTime(buildLocalDateTime(2021, 1, 8));
o.setBeginTime(buildTime(2021, 1, 8));
o.setEndTime(buildTime(2021, 1, 8));
});
jobLogMapper.insert(dbJobLog);
// 测试 jobId 不匹配
@ -141,9 +141,9 @@ public class JobLogServiceTest extends BaseDbUnitTest {
// 测试 handlerName 不匹配
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString())));
// 测试 beginTime 不匹配
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setBeginTime(buildLocalDateTime(2021, 1, 7))));
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setBeginTime(buildTime(2021, 1, 7))));
// 测试 endTime 不匹配
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildLocalDateTime(2021, 1, 9))));
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9))));
// 测试 status 不匹配
jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setStatus(JobLogStatusEnum.FAILURE.getStatus())));
// 准备参数

View File

@ -19,7 +19,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@ -40,7 +40,7 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
int userType = UserTypeEnum.ADMIN.getValue();
String applicationName = "yudao-test";
String requestUrl = "foo";
LocalDateTime beginTime = buildLocalDateTime(2021, 3, 13);
LocalDateTime beginTime = buildTime(2021, 3, 13);
int duration = 1000;
int resultCode = GlobalErrorCodeConstants.SUCCESS.getCode();
@ -65,7 +65,7 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
// requestUrl 不同的
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar")));
// 构造一个早期时间 2021-02-06 00:00:00
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildLocalDateTime(2021, 2, 6))));
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildTime(2021, 2, 6))));
// duration 不同的
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100)));
// resultCode 不同的
@ -77,7 +77,7 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
reqVO.setUserType(userType);
reqVO.setApplicationName(applicationName);
reqVO.setRequestUrl(requestUrl);
reqVO.setBeginTime((new LocalDateTime[]{buildLocalDateTime(2021, 3, 12),buildLocalDateTime(2021, 3, 14)}));
reqVO.setBeginTime((new LocalDateTime[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)}));
reqVO.setDuration(duration);
reqVO.setResultCode(resultCode);
@ -97,7 +97,7 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
int userType = UserTypeEnum.ADMIN.getValue();
String applicationName = "yudao-test";
String requestUrl = "foo";
LocalDateTime beginTime = buildLocalDateTime(2021, 3, 13);
LocalDateTime beginTime = buildTime(2021, 3, 13);
int duration = 1000;
int resultCode = GlobalErrorCodeConstants.SUCCESS.getCode();
@ -122,7 +122,7 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
// requestUrl 不同的
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar")));
// 构造一个早期时间 2021-02-06 00:00:00
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildLocalDateTime(2021, 2, 6))));
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildTime(2021, 2, 6))));
// duration 不同的
apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100)));
// resultCode 不同的
@ -134,7 +134,7 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
reqVO.setUserType(userType);
reqVO.setApplicationName(applicationName);
reqVO.setRequestUrl(requestUrl);
reqVO.setBeginTime((new LocalDateTime[]{buildLocalDateTime(2021, 3, 12),buildLocalDateTime(2021, 3, 14)}));
reqVO.setBeginTime((new LocalDateTime[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)}));
reqVO.setDuration(duration);
reqVO.setResultCode(resultCode);

View File

@ -20,7 +20,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND;
@ -44,7 +44,7 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest {
int userType = UserTypeEnum.ADMIN.getValue();
String applicationName = "yudao-test";
String requestUrl = "foo";
LocalDateTime beginTime = buildLocalDateTime(2021, 3, 13);
LocalDateTime beginTime = buildTime(2021, 3, 13);
int progressStatus = ApiErrorLogProcessStatusEnum.INIT.getStatus();
ApiErrorLogDO infApiErrorLogDO = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> {
@ -67,7 +67,7 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest {
// requestUrl 不同的
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setRequestUrl("bar")));
// 构造一个早期时间 2021-02-06 00:00:00
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildLocalDateTime(2021, 2, 6))));
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6))));
// progressStatus 不同的
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus())));
@ -77,7 +77,7 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest {
reqVO.setUserType(userType);
reqVO.setApplicationName(applicationName);
reqVO.setRequestUrl(requestUrl);
reqVO.setExceptionTime((new LocalDateTime[]{buildLocalDateTime(2021, 3, 12),buildLocalDateTime(2021, 3, 14)}));
reqVO.setExceptionTime((new LocalDateTime[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)}));
reqVO.setProcessStatus(progressStatus);
// 调用service方法
@ -96,7 +96,7 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest {
int userType = UserTypeEnum.ADMIN.getValue();
String applicationName = "yudao-test";
String requestUrl = "foo";
LocalDateTime beginTime = buildLocalDateTime(2021, 3, 13);
LocalDateTime beginTime = buildTime(2021, 3, 13);
int progressStatus = ApiErrorLogProcessStatusEnum.INIT.getStatus();
ApiErrorLogDO infApiErrorLogDO = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> {
@ -119,7 +119,7 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest {
// requestUrl 不同的
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setRequestUrl("bar")));
// 构造一个早期时间 2021-02-06 00:00:00
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildLocalDateTime(2021, 2, 6))));
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6))));
// progressStatus 不同的
infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus())));
@ -129,7 +129,7 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest {
reqVO.setUserType(userType);
reqVO.setApplicationName(applicationName);
reqVO.setRequestUrl(requestUrl);
reqVO.setExceptionTime((new LocalDateTime[]{buildLocalDateTime(2021, 3, 12),buildLocalDateTime(2021, 3, 14)}));
reqVO.setExceptionTime((new LocalDateTime[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)}));
reqVO.setProcessStatus(progressStatus);
// 调用service方法

View File

@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.test;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.TestDemoCreateReqVO;
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.TestDemoExportReqVO;
@ -17,7 +16,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
@ -112,7 +111,7 @@ public class TestDemoServiceImplTest extends BaseDbUnitTest {
o.setType(1);
o.setCategory(2);
o.setRemark("哈哈哈");
o.setCreateTime(DateUtils.buildLocalDateTime(2021, 11, 11));
o.setCreateTime(buildTime(2021, 11, 11));
});
testDemoMapper.insert(dbTestDemo);
// 测试 name 不匹配
@ -126,7 +125,7 @@ public class TestDemoServiceImplTest extends BaseDbUnitTest {
// 测试 remark 不匹配
testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setRemark("呵呵呵")));
// 测试 createTime 不匹配
testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setCreateTime(DateUtils.buildLocalDateTime(2021, 12, 12))));
testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setCreateTime(buildTime(2021, 12, 12))));
// 准备参数
TestDemoPageReqVO reqVO = new TestDemoPageReqVO();
reqVO.setName("芋道");
@ -134,7 +133,7 @@ public class TestDemoServiceImplTest extends BaseDbUnitTest {
reqVO.setType(1);
reqVO.setCategory(2);
reqVO.setRemark("哈哈哈");
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 11, 10),buildLocalDateTime(2021, 11, 12)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 11, 10),buildTime(2021, 11, 12)}));
// 调用
PageResult<TestDemoDO> pageResult = testDemoService.getTestDemoPage(reqVO);
@ -153,7 +152,7 @@ public class TestDemoServiceImplTest extends BaseDbUnitTest {
o.setType(1);
o.setCategory(2);
o.setRemark("哈哈哈");
o.setCreateTime(DateUtils.buildLocalDateTime(2021, 11, 11));
o.setCreateTime(buildTime(2021, 11, 11));
});
testDemoMapper.insert(dbTestDemo);
// 测试 name 不匹配
@ -167,7 +166,7 @@ public class TestDemoServiceImplTest extends BaseDbUnitTest {
// 测试 remark 不匹配
testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setRemark("呵呵呵")));
// 测试 createTime 不匹配
testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setCreateTime(DateUtils.buildLocalDateTime(2021, 12, 12))));
testDemoMapper.insert(cloneIgnoreId(dbTestDemo, o -> o.setCreateTime(buildTime(2021, 12, 12))));
// 准备参数
TestDemoExportReqVO reqVO = new TestDemoExportReqVO();
reqVO.setName("芋道");
@ -175,7 +174,7 @@ public class TestDemoServiceImplTest extends BaseDbUnitTest {
reqVO.setType(1);
reqVO.setCategory(2);
reqVO.setRemark("哈哈哈");
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 11, 10),buildLocalDateTime(2021, 11, 12)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 11, 10),buildTime(2021, 11, 12)}));
// 调用
List<TestDemoDO> list = testDemoService.getTestDemoList(reqVO);

View File

@ -15,7 +15,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
@ -107,7 +107,7 @@ public class ProductBrandServiceImplTest extends BaseDbUnitTest {
ProductBrandDO dbBrand = randomPojo(ProductBrandDO.class, o -> { // 等会查询到
o.setName("芋道源码");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(buildLocalDateTime(2022, 2, 1));
o.setCreateTime(buildTime(2022, 2, 1));
});
brandMapper.insert(dbBrand);
// 测试 name 不匹配
@ -115,12 +115,12 @@ public class ProductBrandServiceImplTest extends BaseDbUnitTest {
// 测试 status 不匹配
brandMapper.insert(cloneIgnoreId(dbBrand, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
// 测试 createTime 不匹配
brandMapper.insert(cloneIgnoreId(dbBrand, o -> o.setCreateTime(buildLocalDateTime(2022, 3, 1))));
brandMapper.insert(cloneIgnoreId(dbBrand, o -> o.setCreateTime(buildTime(2022, 3, 1))));
// 准备参数
ProductBrandPageReqVO reqVO = new ProductBrandPageReqVO();
reqVO.setName("芋道");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2022, 1, 1), buildLocalDateTime(2022, 2, 25)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2022, 1, 1), buildTime(2022, 2, 25)}));
// 调用
PageResult<ProductBrandDO> pageResult = brandService.getBrandPage(reqVO);

View File

@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ -26,7 +26,7 @@ public class CouponPageReqVO extends PageParam {
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] createTime;
private LocalDateTime[] createTime;
@ApiModelProperty(value = "用户昵称", example = "芋艿", notes = "模糊匹配")
private String nickname;

View File

@ -1,8 +1,6 @@
package cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.promotion.enums.common.PromotionDiscountTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -10,8 +8,7 @@ import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ -32,6 +29,6 @@ public class CouponTemplatePageReqVO extends PageParam {
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] createTime;
private LocalDateTime[] createTime;
}

View File

@ -15,11 +15,10 @@ import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.Import;
import javax.annotation.Resource;
import java.util.Date;
import java.time.LocalDateTime;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
@ -119,7 +118,7 @@ public class CouponTemplateServiceImplTest extends BaseDbUnitTest {
o.setName("芋艿");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setDiscountType(PromotionDiscountTypeEnum.PERCENT.getType());
o.setCreateTime(buildLocalDateTime(2022, 2, 2));
o.setCreateTime(buildTime(2022, 2, 2));
});
couponTemplateMapper.insert(dbCouponTemplate);
// 测试 name 不匹配
@ -129,13 +128,13 @@ public class CouponTemplateServiceImplTest extends BaseDbUnitTest {
// 测试 type 不匹配
couponTemplateMapper.insert(cloneIgnoreId(dbCouponTemplate, o -> o.setDiscountType(PromotionDiscountTypeEnum.PRICE.getType())));
// 测试 createTime 不匹配
couponTemplateMapper.insert(cloneIgnoreId(dbCouponTemplate, o -> o.setCreateTime(buildLocalDateTime(2022, 1, 1))));
couponTemplateMapper.insert(cloneIgnoreId(dbCouponTemplate, o -> o.setCreateTime(buildTime(2022, 1, 1))));
// 准备参数
CouponTemplatePageReqVO reqVO = new CouponTemplatePageReqVO();
reqVO.setName("芋艿");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setDiscountType(PromotionDiscountTypeEnum.PERCENT.getType());
reqVO.setCreateTime((new Date[]{buildTime(2022, 2, 1), buildTime(2022, 2, 3)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2022, 2, 1), buildTime(2022, 2, 3)}));
// 调用
PageResult<CouponTemplateDO> pageResult = couponTemplateService.getCouponTemplatePage(reqVO);

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.pay.service.notify;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.exceptions.ExceptionUtil;
import cn.hutool.http.HttpUtil;
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyLogDO;
import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyTaskDO;
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
@ -164,7 +165,7 @@ public class PayNotifyServiceImpl implements PayNotifyService {
// 校验当前任务是否已经被通知过
// 虽然已经通过分布式加锁但是可能同时满足通知的条件然后都去获得锁此时第一个执行完后第二个还是能拿到锁然后会再执行一次
PayNotifyTaskDO dbTask = payNotifyTaskCoreMapper.selectById(task.getId());
if (DateUtils.afterNow(dbTask.getNextNotifyTime())) {
if (LocalDateTimeUtils.afterNow(dbTask.getNextNotifyTime())) {
log.info("[executeNotify][dbTask({}) 任务被忽略,原因是未到达下次通知时间,可能是因为并发执行了]", JsonUtils.toJsonString(dbTask));
return;
}

View File

@ -22,7 +22,7 @@ import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
@ -123,7 +123,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
o.setPayNotifyUrl("https://www.hc.com");
o.setRefundNotifyUrl("https://www.xm.com");
o.setMerchantId(merchantId);
o.setCreateTime(buildLocalDateTime(2021,11,20));
o.setCreateTime(buildTime(2021,11,20));
});
// mock 数据
@ -134,7 +134,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
o.setShortName("灿灿子");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setRemark("灿哥的杂货铺");
o.setCreateTime(buildLocalDateTime(2021,11,3));
o.setCreateTime(buildTime(2021,11,3));
});
Mockito.when(payMerchantMapper.getMerchantListByName(dbMerchant.getName()))
@ -154,7 +154,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
// 测试 merchantId 不匹配
appMapper.insert(cloneIgnoreId(dbApp, o -> o.setMerchantId(mismatchMerchantId)));
// 测试 createTime 不匹配
appMapper.insert(cloneIgnoreId(dbApp, o -> o.setCreateTime(buildLocalDateTime(2021,12,21))));
appMapper.insert(cloneIgnoreId(dbApp, o -> o.setCreateTime(buildTime(2021,12,21))));
// 准备参数
PayAppPageReqVO reqVO = new PayAppPageReqVO();
reqVO.setName("灿灿姐的杂货铺");
@ -163,7 +163,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
reqVO.setPayNotifyUrl("https://www.hc.com");
reqVO.setRefundNotifyUrl("https://www.xm.com");
reqVO.setMerchantName(dbMerchant.getName());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021,11,19),buildLocalDateTime(2021,11,21)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021,11,19),buildTime(2021,11,21)}));
// 调用
PageResult<PayAppDO> pageResult = appService.getAppPage(reqVO);
@ -186,7 +186,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
o.setPayNotifyUrl("https://www.hc.com");
o.setRefundNotifyUrl("https://www.xm.com");
o.setMerchantId(merchantId);
o.setCreateTime(buildLocalDateTime(2021,11,20));
o.setCreateTime(buildTime(2021,11,20));
});
// mock 数据
@ -197,7 +197,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
o.setShortName("灿灿子");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setRemark("灿哥的杂货铺");
o.setCreateTime(buildLocalDateTime(2021,11,3));
o.setCreateTime(buildTime(2021,11,3));
});
Mockito.when(payMerchantMapper.getMerchantListByName(dbMerchant.getName()))
@ -217,7 +217,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
// 测试 merchantId 不匹配
appMapper.insert(cloneIgnoreId(dbApp, o -> o.setMerchantId(mismatchMerchantId)));
// 测试 createTime 不匹配
appMapper.insert(cloneIgnoreId(dbApp, o -> o.setCreateTime(buildLocalDateTime(2021,12,21))));
appMapper.insert(cloneIgnoreId(dbApp, o -> o.setCreateTime(buildTime(2021,12,21))));
// 准备参数
PayAppExportReqVO reqVO = new PayAppExportReqVO();
reqVO.setName("灿灿姐的杂货铺");
@ -226,7 +226,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
reqVO.setPayNotifyUrl("https://www.hc.com");
reqVO.setRefundNotifyUrl("https://www.xm.com");
reqVO.setMerchantName(dbMerchant.getName());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021,11,19),buildLocalDateTime(2021,11,21)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021,11,19),buildTime(2021,11,21)}));
// 调用
List<PayAppDO> list = appService.getAppList(reqVO);

View File

@ -23,7 +23,7 @@ import javax.validation.Validator;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
@ -215,7 +215,7 @@ public class PayChannelServiceTest extends BaseDbUnitTest {
o.setMerchantId(1L);
o.setAppId(1L);
o.setConfig(payClientConfig);
o.setCreateTime(buildLocalDateTime(2021,11,20));
o.setCreateTime(buildTime(2021,11,20));
});
channelMapper.insert(dbChannel);
// 执行拷贝的时候会出现异常所以在插入后要重置为null 后续在写入新的
@ -253,7 +253,7 @@ public class PayChannelServiceTest extends BaseDbUnitTest {
// 测试 createTime 不匹配
channelMapper.insert(cloneIgnoreId(dbChannel, o -> {
o.setConfig(payClientConfig);
o.setCreateTime(buildLocalDateTime(2021, 10, 20));
o.setCreateTime(buildTime(2021, 10, 20));
}));
// 准备参数
PayChannelPageReqVO reqVO = new PayChannelPageReqVO();
@ -264,7 +264,7 @@ public class PayChannelServiceTest extends BaseDbUnitTest {
reqVO.setMerchantId(1L);
reqVO.setAppId(1L);
reqVO.setConfig(JSON.toJSONString(payClientConfig));
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021,11,19),buildLocalDateTime(2021,11,21)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021,11,19),buildTime(2021,11,21)}));
// 调用
PageResult<PayChannelDO> pageResult = channelService.getChannelPage(reqVO);
@ -288,7 +288,7 @@ public class PayChannelServiceTest extends BaseDbUnitTest {
o.setMerchantId(1L);
o.setAppId(1L);
o.setConfig(payClientConfig);
o.setCreateTime(buildLocalDateTime(2021,11,20));
o.setCreateTime(buildTime(2021,11,20));
});
channelMapper.insert(dbChannel);
// 执行拷贝的时候会出现异常所以在插入后要重置为null 后续在写入新的
@ -326,7 +326,7 @@ public class PayChannelServiceTest extends BaseDbUnitTest {
// 测试 createTime 不匹配
channelMapper.insert(cloneIgnoreId(dbChannel, o -> {
o.setConfig(payClientConfig);
o.setCreateTime(buildLocalDateTime(2021, 10, 20));
o.setCreateTime(buildTime(2021, 10, 20));
}));
// 准备参数
PayChannelExportReqVO reqVO = new PayChannelExportReqVO();
@ -337,7 +337,7 @@ public class PayChannelServiceTest extends BaseDbUnitTest {
reqVO.setMerchantId(1L);
reqVO.setAppId(1L);
reqVO.setConfig(JSON.toJSONString(payClientConfig));
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021,11,19),buildLocalDateTime(2021,11,21)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021,11,19),buildTime(2021,11,21)}));
// 调用
List<PayChannelDO> list = channelService.getChannelList(reqVO);

View File

@ -17,7 +17,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
@ -116,7 +116,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest {
o.setShortName("灿灿子");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setRemark("灿哥的杂货铺");
o.setCreateTime(buildLocalDateTime(2021,11,3));
o.setCreateTime(buildTime(2021,11,3));
});
merchantMapper.insert(dbMerchant);
// 测试 no 不匹配
@ -130,7 +130,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest {
// 测试 remark 不匹配
merchantMapper.insert(cloneIgnoreId(dbMerchant, o -> o.setRemark("斌哥的杂货铺")));
// 测试 createTime 不匹配
merchantMapper.insert(cloneIgnoreId(dbMerchant, o -> o.setCreateTime(buildLocalDateTime(2022,12,4))));
merchantMapper.insert(cloneIgnoreId(dbMerchant, o -> o.setCreateTime(buildTime(2022,12,4))));
// 准备参数
PayMerchantPageReqVO reqVO = new PayMerchantPageReqVO();
reqVO.setNo("M1008611");
@ -138,7 +138,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest {
reqVO.setShortName("灿灿子");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setRemark("灿哥的杂货铺");
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021,11,2),buildLocalDateTime(2021,11,4)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021,11,2),buildTime(2021,11,4)}));
// 调用
PageResult<PayMerchantDO> pageResult = merchantService.getMerchantPage(reqVO);
@ -157,7 +157,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest {
o.setShortName("灿灿子");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setRemark("灿哥的杂货铺");
o.setCreateTime(buildLocalDateTime(2021,11,3));
o.setCreateTime(buildTime(2021,11,3));
});
merchantMapper.insert(dbMerchant);
// 测试 no 不匹配
@ -171,7 +171,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest {
// 测试 remark 不匹配
merchantMapper.insert(cloneIgnoreId(dbMerchant, o -> o.setRemark("斌哥的杂货铺")));
// 测试 createTime 不匹配
merchantMapper.insert(cloneIgnoreId(dbMerchant, o -> o.setCreateTime(buildLocalDateTime(2022,12,4))));
merchantMapper.insert(cloneIgnoreId(dbMerchant, o -> o.setCreateTime(buildTime(2022,12,4))));
// 准备参数
PayMerchantExportReqVO reqVO = new PayMerchantExportReqVO();
reqVO.setNo("M1008611");
@ -179,7 +179,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest {
reqVO.setShortName("灿灿子");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setRemark("灿哥的杂货铺");
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021,11,2),buildLocalDateTime(2021,11,4)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021,11,2),buildTime(2021,11,4)}));
// 调用
List<PayMerchantDO> list = merchantService.getMerchantList(reqVO);

View File

@ -24,7 +24,7 @@ import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.eq;
@ -48,7 +48,7 @@ public class DictTypeServiceTest extends BaseDbUnitTest {
o.setName("yunai");
o.setType("芋艿");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(buildLocalDateTime(2021, 1, 15));
o.setCreateTime(buildTime(2021, 1, 15));
});
dictTypeMapper.insert(dbDictType);
// 测试 name 不匹配
@ -58,13 +58,13 @@ public class DictTypeServiceTest extends BaseDbUnitTest {
// 测试 status 不匹配
dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
// 测试 createTime 不匹配
dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setCreateTime(buildLocalDateTime(2021, 1, 1))));
dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setCreateTime(buildTime(2021, 1, 1))));
// 准备参数
DictTypePageReqVO reqVO = new DictTypePageReqVO();
reqVO.setName("nai");
reqVO.setType("");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 1, 10),buildLocalDateTime(2021, 1, 20)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 1, 10),buildTime(2021, 1, 20)}));
// 调用
PageResult<DictTypeDO> pageResult = dictTypeService.getDictTypePage(reqVO);
@ -81,7 +81,7 @@ public class DictTypeServiceTest extends BaseDbUnitTest {
o.setName("yunai");
o.setType("芋艿");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(buildLocalDateTime(2021, 1, 15));
o.setCreateTime(buildTime(2021, 1, 15));
});
dictTypeMapper.insert(dbDictType);
// 测试 name 不匹配
@ -91,13 +91,13 @@ public class DictTypeServiceTest extends BaseDbUnitTest {
// 测试 status 不匹配
dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
// 测试 createTime 不匹配
dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setCreateTime(buildLocalDateTime(2021, 1, 1))));
dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setCreateTime(buildTime(2021, 1, 1))));
// 准备参数
DictTypeExportReqVO reqVO = new DictTypeExportReqVO();
reqVO.setName("nai");
reqVO.setType("");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 1, 10),buildLocalDateTime(2021, 1, 20)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 1, 10),buildTime(2021, 1, 20)}));
// 调用
List<DictTypeDO> list = dictTypeService.getDictTypeList(reqVO);

View File

@ -22,7 +22,7 @@ import java.util.List;
import java.util.function.Consumer;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
@ -96,7 +96,7 @@ public class ErrorCodeServiceTest extends BaseDbUnitTest {
reqVO.setApplicationName("tu");
reqVO.setCode(1);
reqVO.setMessage("ma");
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2020, 11, 1),buildLocalDateTime(2020, 11, 30)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2020, 11, 1),buildTime(2020, 11, 30)}));
// 调用
PageResult<ErrorCodeDO> pageResult = errorCodeService.getErrorCodePage(reqVO);
@ -115,7 +115,7 @@ public class ErrorCodeServiceTest extends BaseDbUnitTest {
o.setApplicationName("tudou");
o.setCode(1);
o.setMessage("yuanma");
o.setCreateTime(buildLocalDateTime(2020, 11, 11));
o.setCreateTime(buildTime(2020, 11, 11));
});
errorCodeMapper.insert(dbErrorCode);
// 测试 type 不匹配
@ -127,7 +127,7 @@ public class ErrorCodeServiceTest extends BaseDbUnitTest {
// 测试 message 不匹配
errorCodeMapper.insert(ObjectUtils.cloneIgnoreId(dbErrorCode, o -> o.setMessage("nai")));
// 测试 createTime 不匹配
errorCodeMapper.insert(ObjectUtils.cloneIgnoreId(dbErrorCode, o -> o.setCreateTime(buildLocalDateTime(2020, 12, 12))));
errorCodeMapper.insert(ObjectUtils.cloneIgnoreId(dbErrorCode, o -> o.setCreateTime(buildTime(2020, 12, 12))));
return dbErrorCode;
}
@ -141,7 +141,7 @@ public class ErrorCodeServiceTest extends BaseDbUnitTest {
reqVO.setApplicationName("tu");
reqVO.setCode(1);
reqVO.setMessage("ma");
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2020, 11, 1),buildLocalDateTime(2020, 11, 30)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2020, 11, 1),buildTime(2020, 11, 30)}));
// 调用
List<ErrorCodeDO> list = errorCodeService.getErrorCodeList(reqVO);

View File

@ -21,7 +21,7 @@ import java.time.LocalDateTime;
import java.util.List;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.module.system.enums.logger.LoginResultEnum.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -46,7 +46,7 @@ public class LoginLogServiceImplTest extends BaseDbUnitTest {
logDO.setUserIp("192.168.199.16");
logDO.setUsername("wangkai");
logDO.setCreateTime(buildLocalDateTime(2021, 3, 6));
logDO.setCreateTime(buildTime(2021, 3, 6));
logDO.setResult(SUCCESS.getResult());
});
loginLogMapper.insert(loginLogDO);
@ -59,7 +59,7 @@ public class LoginLogServiceImplTest extends BaseDbUnitTest {
// 不同username
loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setUsername("yunai")));
// 构造一个早期时间 2021-02-06 00:00:00
loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setCreateTime(buildLocalDateTime(2021, 2, 6))));
loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setCreateTime(buildTime(2021, 2, 6))));
// 构造调用参数
@ -67,8 +67,8 @@ public class LoginLogServiceImplTest extends BaseDbUnitTest {
reqVO.setUsername("wangkai");
reqVO.setUserIp("192.168.199");
reqVO.setStatus(true);
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 3, 5),
buildLocalDateTime(2021, 3, 7)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 3, 5),
buildTime(2021, 3, 7)}));
// 调用service方法
PageResult<LoginLogDO> pageResult = loginLogService.getLoginLogPage(reqVO);
@ -91,7 +91,7 @@ public class LoginLogServiceImplTest extends BaseDbUnitTest {
logDO.setUserIp("192.168.111.16");
logDO.setUsername("wangxiaokai");
logDO.setCreateTime(buildLocalDateTime(2021, 3, 6));
logDO.setCreateTime(buildTime(2021, 3, 6));
logDO.setResult(SUCCESS.getResult());
});
loginLogMapper.insert(loginLogDO);
@ -104,15 +104,15 @@ public class LoginLogServiceImplTest extends BaseDbUnitTest {
// 不同username
loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setUsername("yunai")));
// 构造一个早期时间 2021-02-06 00:00:00
loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setCreateTime(buildLocalDateTime(2021, 2, 6))));
loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setCreateTime(buildTime(2021, 2, 6))));
// 构造调用参数
LoginLogExportReqVO reqVO = new LoginLogExportReqVO();
reqVO.setUsername("wangxiaokai");
reqVO.setUserIp("192.168.111");
reqVO.setStatus(true);
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 3, 5),
buildLocalDateTime(2021, 3, 7)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 3, 5),
buildTime(2021, 3, 7)}));
// 调用service方法
List<LoginLogDO> loginLogList = loginLogService.getLoginLogList(reqVO);

View File

@ -29,7 +29,7 @@ import java.util.List;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -81,7 +81,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest {
o.setUserType(randomEle(UserTypeEnum.values()).getValue());
o.setModule("order");
o.setType(OperateTypeEnum.CREATE.getType());
o.setStartTime(buildLocalDateTime(2021, 3, 6));
o.setStartTime(buildTime(2021, 3, 6));
o.setResultCode(GlobalErrorCodeConstants.SUCCESS.getCode());
o.setExts(MapUtil.<String, Object>builder("orderId", randomLongId()).build());
});
@ -95,7 +95,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest {
// type 不同
operateLogMapper.insert(ObjectUtils.cloneIgnoreId(sysOperateLogDO, logDO -> logDO.setType(OperateTypeEnum.IMPORT.getType())));
// createTime 不同
operateLogMapper.insert(ObjectUtils.cloneIgnoreId(sysOperateLogDO, logDO -> logDO.setStartTime(buildLocalDateTime(2021, 2, 6))));
operateLogMapper.insert(ObjectUtils.cloneIgnoreId(sysOperateLogDO, logDO -> logDO.setStartTime(buildTime(2021, 2, 6))));
// resultCode 不同
operateLogMapper.insert(ObjectUtils.cloneIgnoreId(sysOperateLogDO, logDO -> logDO.setResultCode(BAD_REQUEST.getCode())));
@ -104,8 +104,8 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest {
reqVO.setUserNickname("wangkai");
reqVO.setModule("order");
reqVO.setType(OperateTypeEnum.CREATE.getType());
reqVO.setStartTime((new LocalDateTime[]{buildLocalDateTime(2021, 3, 5),
buildLocalDateTime(2021, 3, 7)}));
reqVO.setStartTime((new LocalDateTime[]{buildTime(2021, 3, 5),
buildTime(2021, 3, 7)}));
reqVO.setSuccess(true);
// 调用service方法
@ -133,7 +133,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest {
o.setUserType(randomEle(UserTypeEnum.values()).getValue());
o.setModule("order");
o.setType(OperateTypeEnum.CREATE.getType());
o.setStartTime(buildLocalDateTime(2021, 3, 6));
o.setStartTime(buildTime(2021, 3, 6));
o.setResultCode(GlobalErrorCodeConstants.SUCCESS.getCode());
o.setExts(MapUtil.<String, Object>builder("orderId", randomLongId()).build());
});
@ -147,7 +147,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest {
// type 不同
operateLogMapper.insert(ObjectUtils.cloneIgnoreId(sysOperateLogDO, logDO -> logDO.setType(OperateTypeEnum.IMPORT.getType())));
// createTime 不同
operateLogMapper.insert(ObjectUtils.cloneIgnoreId(sysOperateLogDO, logDO -> logDO.setStartTime(buildLocalDateTime(2021, 2, 6))));
operateLogMapper.insert(ObjectUtils.cloneIgnoreId(sysOperateLogDO, logDO -> logDO.setStartTime(buildTime(2021, 2, 6))));
// resultCode 不同
operateLogMapper.insert(ObjectUtils.cloneIgnoreId(sysOperateLogDO, logDO -> logDO.setResultCode(BAD_REQUEST.getCode())));
@ -156,7 +156,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest {
reqVO.setUserNickname("wangkai");
reqVO.setModule("order");
reqVO.setType(OperateTypeEnum.CREATE.getType());
reqVO.setStartTime((new LocalDateTime[]{buildLocalDateTime(2021, 3, 5),buildLocalDateTime(2021, 3, 7)}));
reqVO.setStartTime((new LocalDateTime[]{buildTime(2021, 3, 5),buildTime(2021, 3, 7)}));
reqVO.setSuccess(true);
// 调用 service 方法

View File

@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.system.service.permission;
import cn.hutool.core.util.RandomUtil;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleCreateReqVO;
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleExportReqVO;
@ -21,9 +20,8 @@ import org.springframework.context.annotation.Import;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.max;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
@ -129,7 +127,7 @@ public class RoleServiceTest extends BaseDbUnitTest {
Long roleId = roleDO.getId();
//调用
Set<Long> deptIdSet = Arrays.asList(1L, 2L, 3L, 4L, 5L).stream().collect(Collectors.toSet());
Set<Long> deptIdSet = new HashSet<>(Arrays.asList(1L, 2L, 3L, 4L, 5L));
roleService.updateRoleDataScope(roleId, DataScopeEnum.DEPT_CUSTOM.getScope(), deptIdSet);
//断言
@ -137,7 +135,7 @@ public class RoleServiceTest extends BaseDbUnitTest {
assertEquals(DataScopeEnum.DEPT_CUSTOM.getScope(), newRoleDO.getDataScope());
Set<Long> newDeptIdSet = newRoleDO.getDataScopeDeptIds();
assertTrue(deptIdSet.size() == newDeptIdSet.size());
assertEquals(deptIdSet.size(), newDeptIdSet.size());
deptIdSet.stream().forEach(d -> assertTrue(newDeptIdSet.contains(d)));
verify(roleProducer).sendRoleRefreshMessage();
@ -166,7 +164,7 @@ public class RoleServiceTest extends BaseDbUnitTest {
o.setName("土豆");
o.setCode("tudou");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(DateUtils.buildLocalDateTime(2022, 2, 8));
o.setCreateTime(buildTime(2022, 2, 8));
});
roleMapper.insert(dbRole);
// 测试 name 不匹配
@ -174,13 +172,13 @@ public class RoleServiceTest extends BaseDbUnitTest {
// 测试 code 不匹配
roleMapper.insert(cloneIgnoreId(dbRole, o -> o.setCode("hong")));
// 测试 createTime 不匹配
roleMapper.insert(cloneIgnoreId(dbRole, o -> o.setCreateTime(DateUtils.buildLocalDateTime(2022, 2, 16))));
roleMapper.insert(cloneIgnoreId(dbRole, o -> o.setCreateTime(buildTime(2022, 2, 16))));
// 准备参数
RoleExportReqVO reqVO = new RoleExportReqVO();
reqVO.setName("土豆");
reqVO.setCode("tu");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2022, 2, 1),buildLocalDateTime(2022, 2, 12)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2022, 2, 1),buildTime(2022, 2, 12)}));
// 调用
List<RoleDO> list = roleService.getRoleList(reqVO);
@ -196,7 +194,7 @@ public class RoleServiceTest extends BaseDbUnitTest {
o.setName("土豆");
o.setCode("tudou");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(DateUtils.buildLocalDateTime(2022, 2, 8));
o.setCreateTime(buildTime(2022, 2, 8));
});
roleMapper.insert(dbRole);
// 测试 name 不匹配
@ -204,13 +202,13 @@ public class RoleServiceTest extends BaseDbUnitTest {
// 测试 code 不匹配
roleMapper.insert(cloneIgnoreId(dbRole, o -> o.setCode("hong")));
// 测试 createTime 不匹配
roleMapper.insert(cloneIgnoreId(dbRole, o -> o.setCreateTime(DateUtils.buildLocalDateTime(2022, 2, 16))));
roleMapper.insert(cloneIgnoreId(dbRole, o -> o.setCreateTime(buildTime(2022, 2, 16))));
// 准备参数
RolePageReqVO reqVO = new RolePageReqVO();
reqVO.setName("土豆");
reqVO.setCode("tu");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2022, 2, 1),buildLocalDateTime(2022, 2, 12)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2022, 2, 1),buildTime(2022, 2, 12)}));
// 调用
PageResult<RoleDO> pageResult = roleService.getRolePage(reqVO);

View File

@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.system.service.sensitiveword;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.SetUtils;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
import cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo.SensitiveWordCreateReqVO;
import cn.iocoder.yudao.module.system.controller.admin.sensitiveword.vo.SensitiveWordExportReqVO;
@ -21,7 +20,7 @@ import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.max;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
@ -145,7 +144,7 @@ public class SensitiveWordServiceImplTest extends BaseDbUnitTest {
o.setName("笨蛋");
o.setTags(Arrays.asList("论坛", "蔬菜"));
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(DateUtils.buildLocalDateTime(2022, 2, 8));
o.setCreateTime(buildTime(2022, 2, 8));
});
sensitiveWordMapper.insert(dbSensitiveWord);
// 测试 name 不匹配
@ -153,13 +152,13 @@ public class SensitiveWordServiceImplTest extends BaseDbUnitTest {
// 测试 tags 不匹配
sensitiveWordMapper.insert(cloneIgnoreId(dbSensitiveWord, o -> o.setTags(Arrays.asList("短信", "日用品"))));
// 测试 createTime 不匹配
sensitiveWordMapper.insert(cloneIgnoreId(dbSensitiveWord, o -> o.setCreateTime(DateUtils.buildLocalDateTime(2022, 2, 16))));
sensitiveWordMapper.insert(cloneIgnoreId(dbSensitiveWord, o -> o.setCreateTime(buildTime(2022, 2, 16))));
// 准备参数
SensitiveWordPageReqVO reqVO = new SensitiveWordPageReqVO();
reqVO.setName("");
reqVO.setTag("论坛");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2022, 2, 1),buildLocalDateTime(2022, 2, 12)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2022, 2, 1),buildTime(2022, 2, 12)}));
// 调用
PageResult<SensitiveWordDO> pageResult = sensitiveWordService.getSensitiveWordPage(reqVO);
@ -176,7 +175,7 @@ public class SensitiveWordServiceImplTest extends BaseDbUnitTest {
o.setName("笨蛋");
o.setTags(Arrays.asList("论坛", "蔬菜"));
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(DateUtils.buildLocalDateTime(2022, 2, 8));
o.setCreateTime(buildTime(2022, 2, 8));
});
sensitiveWordMapper.insert(dbSensitiveWord);
// 测试 name 不匹配
@ -184,13 +183,13 @@ public class SensitiveWordServiceImplTest extends BaseDbUnitTest {
// 测试 tags 不匹配
sensitiveWordMapper.insert(cloneIgnoreId(dbSensitiveWord, o -> o.setTags(Arrays.asList("短信", "日用品"))));
// 测试 createTime 不匹配
sensitiveWordMapper.insert(cloneIgnoreId(dbSensitiveWord, o -> o.setCreateTime(DateUtils.buildLocalDateTime(2022, 2, 16))));
sensitiveWordMapper.insert(cloneIgnoreId(dbSensitiveWord, o -> o.setCreateTime(buildTime(2022, 2, 16))));
// 准备参数
SensitiveWordExportReqVO reqVO = new SensitiveWordExportReqVO();
reqVO.setName("");
reqVO.setTag("论坛");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2022, 2, 1),buildLocalDateTime(2022, 2, 12)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2022, 2, 1),buildTime(2022, 2, 12)}));
// 调用
List<SensitiveWordDO> list = sensitiveWordService.getSensitiveWordList(reqVO);

View File

@ -24,7 +24,7 @@ import java.util.function.Consumer;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.SMS_CHANNEL_HAS_CHILDREN;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.SMS_CHANNEL_NOT_EXISTS;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.max;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
@ -159,7 +159,7 @@ public class SmsChannelServiceTest extends BaseDbUnitTest {
SmsChannelDO dbSmsChannel = randomPojo(SmsChannelDO.class, o -> { // 等会查询到
o.setSignature("芋道源码");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(buildLocalDateTime(2020, 12, 12));
o.setCreateTime(buildTime(2020, 12, 12));
});
smsChannelMapper.insert(dbSmsChannel);
// 测试 signature 不匹配
@ -167,12 +167,12 @@ public class SmsChannelServiceTest extends BaseDbUnitTest {
// 测试 status 不匹配
smsChannelMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsChannel, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
// 测试 createTime 不匹配
smsChannelMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsChannel, o -> o.setCreateTime(buildLocalDateTime(2020, 11, 11))));
smsChannelMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsChannel, o -> o.setCreateTime(buildTime(2020, 11, 11))));
// 准备参数
SmsChannelPageReqVO reqVO = new SmsChannelPageReqVO();
reqVO.setSignature("芋道");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2020, 12, 1),buildLocalDateTime(2020, 12, 24)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2020, 12, 1),buildTime(2020, 12, 24)}));
// 调用
PageResult<SmsChannelDO> pageResult = smsChannelService.getSmsChannelPage(reqVO);

View File

@ -26,7 +26,7 @@ import java.util.function.Consumer;
import static cn.hutool.core.util.RandomUtil.randomBoolean;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -49,9 +49,9 @@ public class SmsLogServiceTest extends BaseDbUnitTest {
o.setTemplateId(10L);
o.setMobile("15601691300");
o.setSendStatus(SmsSendStatusEnum.INIT.getStatus());
o.setSendTime(buildLocalDateTime(2020, 11, 11));
o.setSendTime(buildTime(2020, 11, 11));
o.setReceiveStatus(SmsReceiveStatusEnum.INIT.getStatus());
o.setReceiveTime(buildLocalDateTime(2021, 11, 11));
o.setReceiveTime(buildTime(2021, 11, 11));
});
smsLogMapper.insert(dbSmsLog);
// 测试 channelId 不匹配
@ -63,22 +63,22 @@ public class SmsLogServiceTest extends BaseDbUnitTest {
// 测试 sendStatus 不匹配
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setSendStatus(SmsSendStatusEnum.IGNORE.getStatus())));
// 测试 sendTime 不匹配
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setSendTime(buildLocalDateTime(2020, 12, 12))));
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setSendTime(buildTime(2020, 12, 12))));
// 测试 receiveStatus 不匹配
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setReceiveStatus(SmsReceiveStatusEnum.SUCCESS.getStatus())));
// 测试 receiveTime 不匹配
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setReceiveTime(buildLocalDateTime(2021, 12, 12))));
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setReceiveTime(buildTime(2021, 12, 12))));
// 准备参数
SmsLogPageReqVO reqVO = new SmsLogPageReqVO();
reqVO.setChannelId(1L);
reqVO.setTemplateId(10L);
reqVO.setMobile("156");
reqVO.setSendStatus(SmsSendStatusEnum.INIT.getStatus());
reqVO.setSendTime((new LocalDateTime[]{buildLocalDateTime(2020, 11, 1),
buildLocalDateTime(2020, 11, 30)}));
reqVO.setSendTime((new LocalDateTime[]{buildTime(2020, 11, 1),
buildTime(2020, 11, 30)}));
reqVO.setReceiveStatus(SmsReceiveStatusEnum.INIT.getStatus());
reqVO.setReceiveTime((new LocalDateTime[]{buildLocalDateTime(2021, 11, 1),
buildLocalDateTime(2021, 11, 30)}));
reqVO.setReceiveTime((new LocalDateTime[]{buildTime(2021, 11, 1),
buildTime(2021, 11, 30)}));
// 调用
PageResult<SmsLogDO> pageResult = smsLogService.getSmsLogPage(reqVO);
@ -96,9 +96,9 @@ public class SmsLogServiceTest extends BaseDbUnitTest {
o.setTemplateId(10L);
o.setMobile("15601691300");
o.setSendStatus(SmsSendStatusEnum.INIT.getStatus());
o.setSendTime(buildLocalDateTime(2020, 11, 11));
o.setSendTime(buildTime(2020, 11, 11));
o.setReceiveStatus(SmsReceiveStatusEnum.INIT.getStatus());
o.setReceiveTime(buildLocalDateTime(2021, 11, 11));
o.setReceiveTime(buildTime(2021, 11, 11));
});
smsLogMapper.insert(dbSmsLog);
// 测试 channelId 不匹配
@ -110,22 +110,22 @@ public class SmsLogServiceTest extends BaseDbUnitTest {
// 测试 sendStatus 不匹配
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setSendStatus(SmsSendStatusEnum.IGNORE.getStatus())));
// 测试 sendTime 不匹配
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setSendTime(buildLocalDateTime(2020, 12, 12))));
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setSendTime(buildTime(2020, 12, 12))));
// 测试 receiveStatus 不匹配
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setReceiveStatus(SmsReceiveStatusEnum.SUCCESS.getStatus())));
// 测试 receiveTime 不匹配
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setReceiveTime(buildLocalDateTime(2021, 12, 12))));
smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setReceiveTime(buildTime(2021, 12, 12))));
// 准备参数
SmsLogExportReqVO reqVO = new SmsLogExportReqVO();
reqVO.setChannelId(1L);
reqVO.setTemplateId(10L);
reqVO.setMobile("156");
reqVO.setSendStatus(SmsSendStatusEnum.INIT.getStatus());
reqVO.setSendTime((new LocalDateTime[]{buildLocalDateTime(2020, 11, 1),
buildLocalDateTime(2020, 11, 30)}));
reqVO.setSendTime((new LocalDateTime[]{buildTime(2020, 11, 1),
buildTime(2020, 11, 30)}));
reqVO.setReceiveStatus(SmsReceiveStatusEnum.INIT.getStatus());
reqVO.setReceiveTime((new LocalDateTime[]{buildLocalDateTime(2021, 11, 1),
buildLocalDateTime(2021, 11, 30)}));
reqVO.setReceiveTime((new LocalDateTime[]{buildTime(2021, 11, 1),
buildTime(2021, 11, 30)}));
// 调用
List<SmsLogDO> list = smsLogService.getSmsLogList(reqVO);

View File

@ -34,7 +34,7 @@ import static cn.hutool.core.bean.BeanUtil.getFieldValue;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.max;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
@ -205,7 +205,7 @@ public class SmsTemplateServiceTest extends BaseDbUnitTest {
o.setContent("芋道源码");
o.setApiTemplateId("yunai");
o.setChannelId(1L);
o.setCreateTime(buildLocalDateTime(2021, 11, 11));
o.setCreateTime(buildTime(2021, 11, 11));
});
smsTemplateMapper.insert(dbSmsTemplate);
// 测试 type 不匹配
@ -221,7 +221,7 @@ public class SmsTemplateServiceTest extends BaseDbUnitTest {
// 测试 channelId 不匹配
smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setChannelId(2L)));
// 测试 createTime 不匹配
smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setCreateTime(buildLocalDateTime(2021, 12, 12))));
smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setCreateTime(buildTime(2021, 12, 12))));
// 准备参数
SmsTemplatePageReqVO reqVO = new SmsTemplatePageReqVO();
reqVO.setType(SmsTemplateTypeEnum.PROMOTION.getType());
@ -230,7 +230,7 @@ public class SmsTemplateServiceTest extends BaseDbUnitTest {
reqVO.setContent("芋道");
reqVO.setApiTemplateId("yu");
reqVO.setChannelId(1L);
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 11, 1),buildLocalDateTime(2021, 12, 1)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 11, 1),buildTime(2021, 12, 1)}));
// 调用
PageResult<SmsTemplateDO> pageResult = smsTemplateService.getSmsTemplatePage(reqVO);
@ -250,7 +250,7 @@ public class SmsTemplateServiceTest extends BaseDbUnitTest {
o.setContent("芋道源码");
o.setApiTemplateId("yunai");
o.setChannelId(1L);
o.setCreateTime(buildLocalDateTime(2021, 11, 11));
o.setCreateTime(buildTime(2021, 11, 11));
});
smsTemplateMapper.insert(dbSmsTemplate);
// 测试 type 不匹配
@ -266,7 +266,7 @@ public class SmsTemplateServiceTest extends BaseDbUnitTest {
// 测试 channelId 不匹配
smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setChannelId(2L)));
// 测试 createTime 不匹配
smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setCreateTime(buildLocalDateTime(2021, 12, 12))));
smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setCreateTime(buildTime(2021, 12, 12))));
// 准备参数
SmsTemplateExportReqVO reqVO = new SmsTemplateExportReqVO();
reqVO.setType(SmsTemplateTypeEnum.PROMOTION.getType());
@ -275,7 +275,7 @@ public class SmsTemplateServiceTest extends BaseDbUnitTest {
reqVO.setContent("芋道");
reqVO.setApiTemplateId("yu");
reqVO.setChannelId(1L);
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 11, 1),buildLocalDateTime(2021, 12, 1)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2021, 11, 1),buildTime(2021, 12, 1)}));
// 调用
List<SmsTemplateDO> list = smsTemplateService.getSmsTemplateList(reqVO);

View File

@ -17,7 +17,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
@ -142,7 +142,7 @@ public class TenantPackageServiceImplTest extends BaseDbUnitTest {
o.setName("芋道源码");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setRemark("源码解析");
o.setCreateTime(buildLocalDateTime(2022, 10, 10));
o.setCreateTime(buildTime(2022, 10, 10));
});
tenantPackageMapper.insert(dbTenantPackage);
// 测试 name 不匹配
@ -152,13 +152,13 @@ public class TenantPackageServiceImplTest extends BaseDbUnitTest {
// 测试 remark 不匹配
tenantPackageMapper.insert(cloneIgnoreId(dbTenantPackage, o -> o.setRemark("解析")));
// 测试 createTime 不匹配
tenantPackageMapper.insert(cloneIgnoreId(dbTenantPackage, o -> o.setCreateTime(buildLocalDateTime(2022, 11, 11))));
tenantPackageMapper.insert(cloneIgnoreId(dbTenantPackage, o -> o.setCreateTime(buildTime(2022, 11, 11))));
// 准备参数
TenantPackagePageReqVO reqVO = new TenantPackagePageReqVO();
reqVO.setName("芋道");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setRemark("源码");
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2022, 10, 9),buildLocalDateTime(2022, 10, 11)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2022, 10, 9),buildTime(2022, 10, 11)}));
// 调用
PageResult<TenantPackageDO> pageResult = tenantPackageService.getTenantPackagePage(reqVO);

View File

@ -34,7 +34,7 @@ import java.util.Collections;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
@ -110,7 +110,7 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
public void testValidTenant_expired() {
// mock 数据
TenantDO tenant = randomPojo(TenantDO.class, o -> o.setId(1L).setStatus(CommonStatusEnum.ENABLE.getStatus())
.setExpireTime(buildLocalDateTime(2020, 2, 2)));
.setExpireTime(buildTime(2020, 2, 2)));
tenantMapper.insert(tenant);
// 调用并断言业务异常
@ -291,7 +291,7 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
o.setContactName("芋艿");
o.setContactMobile("15601691300");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(buildLocalDateTime(2020, 12, 12));
o.setCreateTime(buildTime(2020, 12, 12));
});
tenantMapper.insert(dbTenant);
// 测试 name 不匹配
@ -303,14 +303,14 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
// 测试 status 不匹配
tenantMapper.insert(cloneIgnoreId(dbTenant, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
// 测试 createTime 不匹配
tenantMapper.insert(cloneIgnoreId(dbTenant, o -> o.setCreateTime(buildLocalDateTime(2021, 12, 12))));
tenantMapper.insert(cloneIgnoreId(dbTenant, o -> o.setCreateTime(buildTime(2021, 12, 12))));
// 准备参数
TenantPageReqVO reqVO = new TenantPageReqVO();
reqVO.setName("芋道");
reqVO.setContactName("");
reqVO.setContactMobile("1560");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime(new LocalDateTime[]{buildLocalDateTime(2020, 12, 1),buildLocalDateTime(2020, 12, 24)});
reqVO.setCreateTime(new LocalDateTime[]{buildTime(2020, 12, 1),buildTime(2020, 12, 24)});
// 调用
PageResult<TenantDO> pageResult = tenantService.getTenantPage(reqVO);
@ -328,7 +328,7 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
o.setContactName("芋艿");
o.setContactMobile("15601691300");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(buildLocalDateTime(2020, 12, 12));
o.setCreateTime(buildTime(2020, 12, 12));
});
tenantMapper.insert(dbTenant);
// 测试 name 不匹配
@ -340,14 +340,14 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
// 测试 status 不匹配
tenantMapper.insert(cloneIgnoreId(dbTenant, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
// 测试 createTime 不匹配
tenantMapper.insert(cloneIgnoreId(dbTenant, o -> o.setCreateTime(buildLocalDateTime(2021, 12, 12))));
tenantMapper.insert(cloneIgnoreId(dbTenant, o -> o.setCreateTime(buildTime(2021, 12, 12))));
// 准备参数
TenantExportReqVO reqVO = new TenantExportReqVO();
reqVO.setName("芋道");
reqVO.setContactName("");
reqVO.setContactMobile("1560");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime(new LocalDateTime[]{buildLocalDateTime(2020, 12, 1),buildLocalDateTime(2020, 12, 24)});
reqVO.setCreateTime(new LocalDateTime[]{buildTime(2020, 12, 1),buildTime(2020, 12, 24)});
// 调用
List<TenantDO> list = tenantService.getTenantList(reqVO);

View File

@ -40,7 +40,7 @@ import java.util.function.Consumer;
import static cn.hutool.core.util.RandomUtil.randomBytes;
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
@ -295,7 +295,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
reqVO.setUsername("tu");
reqVO.setMobile("1560");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2020, 12, 1),buildLocalDateTime(2020, 12, 24)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2020, 12, 1),buildTime(2020, 12, 24)}));
reqVO.setDeptId(1L); // 其中1L 2L 的父部门
// mock 方法
List<DeptDO> deptList = newArrayList(randomPojo(DeptDO.class, o -> o.setId(2L)));
@ -318,7 +318,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
reqVO.setUsername("tu");
reqVO.setMobile("1560");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2020, 12, 1),buildLocalDateTime(2020, 12, 24)}));
reqVO.setCreateTime((new LocalDateTime[]{buildTime(2020, 12, 1),buildTime(2020, 12, 24)}));
reqVO.setDeptId(1L); // 其中1L 2L 的父部门
// mock 方法
List<DeptDO> deptList = newArrayList(randomPojo(DeptDO.class, o -> o.setId(2L)));
@ -340,7 +340,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
o.setUsername("tudou");
o.setMobile("15601691300");
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
o.setCreateTime(buildLocalDateTime(2020, 12, 12));
o.setCreateTime(buildTime(2020, 12, 12));
o.setDeptId(2L);
});
userMapper.insert(dbUser);
@ -351,7 +351,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
// 测试 status 不匹配
userMapper.insert(ObjectUtils.cloneIgnoreId(dbUser, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
// 测试 createTime 不匹配
userMapper.insert(ObjectUtils.cloneIgnoreId(dbUser, o -> o.setCreateTime(buildLocalDateTime(2020, 11, 11))));
userMapper.insert(ObjectUtils.cloneIgnoreId(dbUser, o -> o.setCreateTime(buildTime(2020, 11, 11))));
// 测试 dept 不匹配
userMapper.insert(ObjectUtils.cloneIgnoreId(dbUser, o -> o.setDeptId(0L)));
return dbUser;

View File

@ -100,7 +100,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.6.7</version> <!-- 如果 spring.boot.version 版本修改,则这里也要跟着修改 -->
<version>2.6.13</version> <!-- 如果 spring.boot.version 版本修改,则这里也要跟着修改 -->
<configuration>
<fork>true</fork>
</configuration>

View File

@ -1,24 +1,26 @@
<h1>🌈 yudao-ui-admin-vue3</h1>
<p align="center">
<img src="https://img.shields.io/badge/-Vue3.2-34495e?logo=vue.j" />
<img src="https://img.shields.io/badge/-Vite3-646cff?logo=vite&logoColor=white" />
<img src="https://img.shields.io/badge/-TypeScript4.8-blue?logo=typescript&logoColor=white" />
<img src="https://img.shields.io/badge/-TypeScript4.9-blue?logo=typescript&logoColor=white" />
<img src="https://img.shields.io/badge/-Pinia2-yellow?logo=picpay&logoColor=white" />
<img src="https://img.shields.io/badge/-ESLint-4b32c3?logo=eslint&logoColor=white" />
<img src="https://img.shields.io/badge/-pnpm7-F69220?logo=pnpm&logoColor=white" />
<img src="https://img.shields.io/badge/-Axios-008fc7?logo=axios.js&logoColor=white" />
<img src="https://img.shields.io/badge/-Prettier-ef9421?logo=Prettier&logoColor=white" alt="Prettier">
<img src="https://img.shields.io/badge/-Less-1D365D?logo=less&logoColor=white" alt="Less">
<img src="https://img.shields.io/badge/-Sass-1D365D?logo=Sass&logoColor=white" alt="Sass">
<img src="https://img.shields.io/badge/-Wind%20CSS-06B6D4?logo=Tailwind%20CSS&logoColor=white" alt="Taiwind">
</p>
## 介绍
- 基于 vue3.2+ TypeScript Element Plus 2.2.0+ Vite3 Pinia Windicss 等开发的后台管理系统
- 基于 vue3.2+ TypeScript Element Plus 2.2.0+ Vite3 Pinia Vxe-table , Windicss 等开发的后台管理系统
## 注意事项
- 项目路径请不要使用中文命名!!!会造成解析乱码!!!请使用全英文路径!!!
- node >=14.19.0(建议使用 16 版本) ,pnpm >=7
- node >=14.19.0(后续升级版本,对应 node 最低版本也会升级,建议直接使用 16 版本) ,pnpm >=7
- 开发建议使用 [谷歌浏览器-开发者版](https://www.google.cn/intl/zh-CN/chrome/dev/) 不支持 IE\QQ 等浏览器
### 点击查看[使用说明](./use.md)
@ -26,18 +28,19 @@
### 前端依赖
| 框架 | 说明 | 版本 |
| --- | --- |--------|
| [Vue](https://staging-cn.vuejs.org/) | vue 框架 | 3.2.44 |
| --- | --- | --- |
| [Vue](https://staging-cn.vuejs.org/) | vue 框架 | 3.2.45 |
| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 3.2.3 |
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.2.20 |
| [TypeScript](https://www.typescriptlang.org/docs/) | JavaScript 的超集 | 4.8.4 |
| [pinia](https://pinia.vuejs.org/) | Vue 存储库 替代 vuex5 | 2.0.23 |
| [vueuse](https://vueuse.org//) | 常用工具集 | 9.4.0 |
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.2.23 |
| [TypeScript](https://www.typescriptlang.org/docs/) | JavaScript 的超集 | 4.9.3 |
| [pinia](https://pinia.vuejs.org/) | Vue 存储库 替代 vuex5 | 2.0.26 |
| [vueuse](https://vueuse.org/) | 常用工具集 | 9.6.0 |
| [vxe-table](https://vxetable.cn/) | vue 最强表单 | 4.3.6 |
| [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 9.2.2 |
| [vue-router](https://router.vuejs.org/) | vue 路由 | 4.1.6 |
| [windicss](https://cn.windicss.org/) | 下一代工具优先的 CSS 框架 | 3.5.6 |
| [iconify](https://icon-sets.iconify.design/) | 在线图标库 | 3.0.0 |
| [wangeditor](https://www.wangeditor.com/) | 富文本编辑器 | 5.1.22 |
| [wangeditor](https://www.wangeditor.com/) | 富文本编辑器 | 5.1.23 |
### 推荐 VScode 开发,插件如下
@ -82,7 +85,7 @@ pnpm install
- 运行项目
```bash
pnpm run dev
pnpm dev
```
- 打包
@ -103,7 +106,13 @@ pnpm add 包名
pnpm remove 包名
```
- 其他命令请看 package.json
- 设置镜像源
```bash
pnpm config set registry https://registry.npm.taobao.org/
```
- 其他命令请看 package.json scripts
## 浏览器支持

View File

@ -7,11 +7,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="keywords"
content="芋道管理系统 基于 vue3 + CompositionAPI + typescript + vite + element plus 的后台开源免费管理系统!"
content="芋道管理系统 基于 vue3 + CompositionAPI + typescript + vite3 + element plus 的后台开源免费管理系统!"
/>
<meta
name="description"
content="芋道管理系统 基于 vue3 + CompositionAPI + typescript + vite + element plus 的后台开源免费管理系统!"
content="芋道管理系统 基于 vue3 + CompositionAPI + typescript + vite3 + element plus 的后台开源免费管理系统!"
/>
<title><%= title %></title>
</head>

View File

@ -1,6 +1,6 @@
{
"name": "ruoyi-vue-pro-vue3",
"version": "1.6.4.1841",
"version": "1.6.4.1863",
"description": "基于vue3、vite3、element-plus、typesScript",
"author": "xingyu",
"private": false,
@ -18,7 +18,7 @@
"clean": "npx rimraf node_modules",
"clean:cache": "npx rimraf node_modules/.cache",
"lint:eslint": "eslint --fix --ext .js,.ts,.vue ./src",
"lint:format": "prettier --write --loglevel warn \"src/**/*.{js,ts,json,tsx,css,less,vue,html,md}\"",
"lint:format": "prettier --write --loglevel warn \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"",
"lint:style": "stylelint --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
"lint:lint-staged": "lint-staged -c ",
"lint:pretty": "pretty-quick --staged",
@ -26,40 +26,40 @@
},
"dependencies": {
"@iconify/iconify": "^3.0.0",
"@vueuse/core": "^9.5.0",
"@wangeditor/editor": "^5.1.22",
"@vueuse/core": "^9.6.0",
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.10",
"@zxcvbn-ts/core": "^2.1.0",
"animate.css": "^4.1.1",
"axios": "^0.27.2",
"axios": "^1.2.0",
"crypto-js": "^4.1.1",
"dayjs": "^1.11.6",
"echarts": "^5.4.0",
"echarts-wordcloud": "^2.0.0",
"element-plus": "2.2.20",
"echarts-wordcloud": "^2.1.0",
"element-plus": "2.2.25",
"intro.js": "^6.0.0",
"jsencrypt": "^3.3.1",
"js-cookie": "^3.0.1",
"jsencrypt": "^3.3.1",
"lodash-es": "^4.17.21",
"mitt": "^3.0.0",
"nprogress": "^0.2.0",
"pinia": "^2.0.23",
"pinia": "^2.0.27",
"qrcode": "^1.5.1",
"qs": "^6.11.0",
"url": "^0.11.0",
"vue": "3.2.44",
"vue": "3.2.45",
"vue-cropper": "^1.0.3",
"vue-i18n": "9.2.2",
"vue-router": "^4.1.6",
"vue-types": "^4.2.1",
"vxe-table": "^4.3.5",
"vue-types": "^5.0.1",
"vxe-table": "^4.3.6",
"web-storage-cache": "^1.1.1",
"xe-utils": "^3.5.7"
},
"devDependencies": {
"@commitlint/cli": "^17.2.0",
"@commitlint/config-conventional": "^17.2.0",
"@iconify/json": "^2.1.135",
"@commitlint/cli": "^17.3.0",
"@commitlint/config-conventional": "^17.3.0",
"@iconify/json": "^2.1.144",
"@intlify/vite-plugin-vue-i18n": "^6.0.3",
"@purge-icons/generated": "^0.9.0",
"@types/intro.js": "^5.1.0",
@ -68,40 +68,41 @@
"@types/nprogress": "^0.2.0",
"@types/qrcode": "^1.5.0",
"@types/qs": "^6.9.7",
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^5.42.1",
"@typescript-eslint/eslint-plugin": "^5.44.0",
"@typescript-eslint/parser": "^5.44.0",
"@vitejs/plugin-vue": "^3.2.0",
"@vitejs/plugin-vue-jsx": "^2.1.1",
"autoprefixer": "^10.4.13",
"eslint": "^8.27.0",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-define-config": "^1.12.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.7.0",
"less": "^4.1.3",
"lint-staged": "^13.0.3",
"eslint-plugin-vue": "^9.8.0",
"lint-staged": "^13.0.4",
"plop": "^3.1.1",
"postcss": "^8.4.18",
"postcss": "^8.4.19",
"postcss-html": "^1.5.0",
"postcss-less": "^6.0.0",
"prettier": "^2.7.1",
"postcss-scss": "^4.0.6",
"prettier": "^2.8.0",
"rimraf": "^3.0.2",
"rollup": "^3.2.5",
"stylelint": "^14.14.1",
"rollup": "^3.5.0",
"sass": "^1.56.1",
"stylelint": "^14.15.0",
"stylelint-config-html": "^1.1.0",
"stylelint-config-prettier": "^9.0.4",
"stylelint-config-recommended": "^9.0.0",
"stylelint-config-standard": "^29.0.0",
"stylelint-order": "^5.0.0",
"typescript": "4.8.4",
"unplugin-vue-macros": "^0.16.2",
"vite": "3.2.3",
"typescript": "4.9.3",
"vite": "3.2.4",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-html": "^3.2.0",
"vite-plugin-progress": "^0.0.6",
"vite-plugin-purge-icons": "^0.9.1",
"vite-plugin-style-import": "2.0.0",
"vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-vue-setup-extend": "^0.4.0",
"vite-plugin-windicss": "^1.8.8",
"vue-tsc": "^1.0.9",
"windicss": "^3.5.6"

View File

@ -1,6 +1,5 @@
<script setup lang="ts">
</script>
<template>
<ContentWrap title="{{ upperFirstName }}"> {{ name }} </ContentWrap>
</template>
<script setup lang="ts" name="{{ name }}">
</script>

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +1,22 @@
<script setup lang="ts">
import { computed } from 'vue'
import { useAppStore } from '@/store/modules/app'
import { ConfigGlobal } from '@/components/ConfigGlobal'
import { isDark } from '@/utils/is'
import { useAppStore } from '@/store/modules/app'
import { useDesign } from '@/hooks/web/useDesign'
import Cookies from 'js-cookie'
import { ConfigGlobal } from '@/components/ConfigGlobal'
import { useCache } from '@/hooks/web/useCache'
const { getPrefixCls } = useDesign()
const prefixCls = getPrefixCls('app')
const appStore = useAppStore()
const currentSize = computed(() => appStore.getCurrentSize)
const greyMode = computed(() => appStore.getGreyMode)
const { wsCache } = useCache()
//
const setDefaultTheme = () => {
if (Cookies.get('isDark')) {
if (Cookies.get('isDark') === 'true') {
if (wsCache.get('isDark')) {
if (wsCache.get('isDark') || wsCache.get('isDark') === 'true') {
appStore.setIsDark(true)
} else {
appStore.setIsDark(false)
@ -31,34 +28,29 @@ const setDefaultTheme = () => {
}
setDefaultTheme()
</script>
<template>
<ConfigGlobal :size="currentSize">
<RouterView :class="greyMode ? `${prefixCls}-grey-mode` : ''" />
</ConfigGlobal>
</template>
<style lang="less">
@prefix-cls: ~'@{namespace}-app';
<style lang="scss">
$prefix-cls: #{$namespace}-app;
.size {
width: 100%;
height: 100%;
}
html,
body {
padding: 0 !important;
margin: 0;
overflow: hidden;
.size;
@extend .size;
#app {
.size;
@extend .size;
}
}
.@{prefix-cls}-grey-mode {
.#{$prefix-cls}-grey-mode {
filter: grayscale(100%);
}
</style>

View File

@ -1,5 +1,20 @@
import request from '@/config/axios'
export interface ApiAccessLogVO {
id: number
traceId: string
userId: string
userType: string
applicationName: string
requestMethod: string
requestParams: string
requestUrl: string
beginTime: string
endTIme: string
duration: string
resultCode: number
}
// 查询列表API 访问日志
export const getApiAccessLogPageApi = (params) => {
return request.get({ url: '/infra/api-access-log/page', params })

View File

@ -1,14 +0,0 @@
export type ApiAccessLogVO = {
id: number
traceId: string
userId: string
userType: string
applicationName: string
requestMethod: string
requestParams: string
requestUrl: string
beginTime: string
endTIme: string
duration: string
resultCode: number
}

View File

@ -1,5 +1,23 @@
import request from '@/config/axios'
export interface ApiErrorLogVO {
id: number
userId: string
userIp: string
userAgent: string
userType: string
applicationName: string
requestMethod: string
requestParams: string
requestUrl: string
exceptionTime: string
exceptionName: string
exceptionStackTrace: string
processUserId: string
processStatus: number
resultCode: number
}
// 查询列表API 访问日志
export const getApiErrorLogPageApi = (params) => {
return request.get({ url: '/infra/api-error-log/page', params })

View File

@ -1,17 +0,0 @@
export type ApiErrorLogVO = {
id: number
userId: string
userIp: string
userAgent: string
userType: string
applicationName: string
requestMethod: string
requestParams: string
requestUrl: string
exceptionTime: string
exceptionName: string
exceptionStackTrace: string
processUserId: string
processStatus: number
resultCode: number
}

View File

@ -1,8 +1,31 @@
import request from '@/config/axios'
import type { ConfigVO } from './types'
export interface ConfigVO {
id: number
group: string
name: string
key: string
value: string
type: string
visible: boolean
remark: string
createTime: string
}
export interface ConfigPageReqVO extends PageParam {
name?: string
type?: number
createTime?: string[]
}
export interface ConfigExportReqVO {
name?: string
type?: number
createTime?: string[]
}
// 查询参数列表
export const getConfigPageApi = (params) => {
export const getConfigPageApi = (params: ConfigPageReqVO) => {
return request.get({ url: '/infra/config/page', params })
}
@ -32,6 +55,6 @@ export const deleteConfigApi = (id: number) => {
}
// 导出参数
export const exportConfigApi = (params) => {
export const exportConfigApi = (params: ConfigExportReqVO) => {
return request.download({ url: '/infra/config/export', params })
}

View File

@ -1,11 +0,0 @@
export type ConfigVO = {
id: number
group: string
name: string
key: string
value: string
type: string
visible: boolean
remark: string
createTime: string
}

View File

@ -1,5 +1,13 @@
import request from '@/config/axios'
import type { DataSourceConfigVO } from './types'
export interface DataSourceConfigVO {
id: number
name: string
url: string
username: string
password: string
createTime: string
}
// 查询数据源配置列表
export const getDataSourceConfigListApi = () => {

View File

@ -1,8 +0,0 @@
export type DataSourceConfigVO = {
id: number
name: string
url: string
username: string
password: string
createTime: string
}

View File

@ -1,5 +1,28 @@
import request from '@/config/axios'
import type { FileConfigVO } from './types'
export interface ConfigType {
basePath: string
host: string
port: string
username: string
password: string
mode: string
endpoint: string
bucket: string
accessKey: string
accessSecret: string
domain: string
}
export interface FileConfigVO {
id: number
name: string
storage: string
master: boolean
visible: boolean
config: ConfigType
remark: string
createTime: string
}
// 查询文件配置列表
export const getFileConfigPageApi = (params) => {

View File

@ -1,23 +0,0 @@
export type ConfigType = {
basePath: string
host: string
port: string
username: string
password: string
mode: string
endpoint: string
bucket: string
accessKey: string
accessSecret: string
domain: string
}
export type FileConfigVO = {
id: number
name: string
storage: string
primary: number
visible: boolean
config: ConfigType
remark: string
createTime: string
}

View File

@ -1,7 +1,21 @@
import request from '@/config/axios'
export interface FileVO {
id: number
path: string
url: string
size: string
type: string
createTime: string
}
export interface FilePageReqVO extends PageParam {
name?: string
createTime?: string[]
}
// 查询文件列表
export const getFilePageApi = (params) => {
export const getFilePageApi = (params: FilePageReqVO) => {
return request.get({ url: '/infra/file/page', params })
}

View File

@ -1,8 +0,0 @@
export type FileVO = {
id: number
path: string
url: string
size: string
type: string
createTime: string
}

View File

@ -1,5 +1,16 @@
import request from '@/config/axios'
import type { JobVO } from './types'
export interface JobVO {
id: number
name: string
status: number
handlerName: string
handlerParam: string
cronExpression: string
retryCount: number
retryInterval: number
monitorTimeout: number
}
// 任务列表
export const getJobPageApi = (params) => {

View File

@ -1,11 +0,0 @@
export type JobVO = {
id: number
name: string
status: number
handlerName: string
handlerParam: string
cronExpression: string
retryCount: number
retryInterval: number
monitorTimeout: number
}

View File

@ -1,5 +1,19 @@
import request from '@/config/axios'
export interface JobLogVO {
id: number
jobId: number
handlerName: string
handlerParam: string
cronExpression: string
executeIndex: string
beginTime: string
endTime: string
duration: string
status: number
createTime: string
}
// 任务日志列表
export const getJobLogPageApi = (params) => {
return request.get({ url: '/infra/job-log/page', params })

View File

@ -1,13 +0,0 @@
export type JobLogVO = {
id: number
jobId: number
handlerName: string
handlerParam: string
cronExpression: string
executeIndex: string
beginTime: Date
endTime: Date
duration: string
status: number
createTime: string
}

View File

@ -62,3 +62,12 @@ export const socialAuthRedirectApi = (type: string, redirectUri: string) => {
url: '/system/auth/social-auth-redirect?type=' + type + '&redirectUri=' + redirectUri
})
}
// 获取验证图片 以及token
export const getCodeApi = (data) => {
return request.postOriginal({ url: 'system/captcha/get', data })
}
// 滑动或者点选验证
export const reqCheckApi = (data) => {
return request.postOriginal({ url: 'system/captcha/check', data })
}

View File

@ -1,32 +1,47 @@
import request from '@/config/axios'
import type { DeptVO, DeptListReqVO } from './types'
export interface DeptVO {
id?: number
name: string
parentId: number
status: number
sort: number
leaderUserId: number
phone: string
email: string
}
export interface DeptPageReqVO {
name?: string
status?: number
}
// 查询部门(精简)列表
export const listSimpleDeptApi = () => {
return request.get({ url: '/system/dept/list-all-simple' })
export const listSimpleDeptApi = async () => {
return await request.get({ url: '/system/dept/list-all-simple' })
}
// 查询部门列表
export const getDeptPageApi = (params: DeptListReqVO) => {
return request.get({ url: '/system/dept/list', params })
export const getDeptPageApi = async (params: DeptPageReqVO) => {
return await request.get({ url: '/system/dept/list', params })
}
// 查询部门详情
export const getDeptApi = (id: number) => {
return request.get({ url: '/system/dept/get?id=' + id })
export const getDeptApi = async (id: number) => {
return await request.get({ url: '/system/dept/get?id=' + id })
}
// 新增部门
export const createDeptApi = (data: DeptVO) => {
return request.post({ url: '/system/dept/create', data: data })
export const createDeptApi = async (data: DeptVO) => {
return await request.post({ url: '/system/dept/create', data: data })
}
// 修改部门
export const updateDeptApi = (params: DeptVO) => {
return request.put({ url: '/system/dept/update', data: params })
export const updateDeptApi = async (params: DeptVO) => {
return await request.put({ url: '/system/dept/update', data: params })
}
// 删除部门
export const deleteDeptApi = (id: number) => {
return request.delete({ url: '/system/dept/delete?id=' + id })
export const deleteDeptApi = async (id: number) => {
return await request.delete({ url: '/system/dept/delete?id=' + id })
}

View File

@ -1,15 +0,0 @@
export type DeptVO = {
id: number
name: string
parentId: number
status: number
sort: number
leaderUserId: number
phone: string
email: string
}
export type DeptListReqVO = {
name: string
status: number
}

View File

@ -1,8 +1,25 @@
import request from '@/config/axios'
import type { ErrorCodeVO } from './types'
export interface ErrorCodeVO {
id: number
type: number
applicationName: string
code: number
message: string
memo: string
createTime: string
}
export interface ErrorCodePageReqVO extends PageParam {
type?: number
applicationName?: string
code?: number
message?: string
createTime?: string[]
}
// 查询错误码列表
export const getErrorCodePageApi = (params) => {
export const getErrorCodePageApi = (params: ErrorCodePageReqVO) => {
return request.get({ url: '/system/error-code/page', params })
}
@ -26,6 +43,6 @@ export const deleteErrorCodeApi = (id: number) => {
return request.delete({ url: '/system/error-code/delete?id=' + id })
}
// 导出错误码
export const excelErrorCodeApi = (params) => {
export const excelErrorCodeApi = (params: ErrorCodePageReqVO) => {
return request.download({ url: '/system/error-code/export-excel', params })
}

View File

@ -1,9 +0,0 @@
export type ErrorCodeVO = {
id: number
type: number
applicationName: string
code: number
message: string
memo: string
createTime: string
}

View File

@ -1,10 +1,29 @@
import request from '@/config/axios'
export interface LoginLogVO {
id: number
logType: number
traceId: number
userType: number
username: string
status: number
userIp: string
userAgent: string
createTime: string
}
export interface LoginLogReqVO extends PageParam {
userIp?: string
username?: string
status?: boolean
createTime?: string[]
}
// 查询登录日志列表
export const getLoginLogPageApi = (params) => {
export const getLoginLogPageApi = (params: LoginLogReqVO) => {
return request.get({ url: '/system/login-log/page', params })
}
// 导出登录日志
export const exportLoginLogApi = (params) => {
export const exportLoginLogApi = (params: LoginLogReqVO) => {
return request.download({ url: '/system/login-log/export', params })
}

View File

@ -1,11 +0,0 @@
export type LoginLogVO = {
id: number
logType: number
traceId: number
userType: number
username: string
status: number
userIp: string
userAgent: string
createTime: string
}

View File

@ -1,5 +1,25 @@
import request from '@/config/axios'
import type { MenuVO } from './types'
export interface MenuVO {
id: number
name: string
permission: string
type: number
sort: number
parentId: number
path: string
icon: string
component: string
status: number
visible: boolean
keepAlive: boolean
createTime: string
}
export interface MenuPageReqVO {
name?: string
status?: number
}
// 查询菜单(精简)列表
export const listSimpleMenusApi = () => {
@ -7,7 +27,7 @@ export const listSimpleMenusApi = () => {
}
// 查询菜单列表
export const getMenuListApi = (params) => {
export const getMenuListApi = (params: MenuPageReqVO) => {
return request.get({ url: '/system/menu/list', params })
}

View File

@ -1,15 +0,0 @@
export type MenuVO = {
id: number
name: string
permission: string
type: number
sort: number
parentId: number
path: string
icon: string
component: string
status: number
visible: boolean
keepAlive: boolean
createTime: string
}

View File

@ -1,8 +1,25 @@
import request from '@/config/axios'
import type { NoticeVO } from './types'
export interface NoticeVO {
id: number
title: string
type: number
content: string
status: number
remark: string
creator: string
createTime: string
updater: string
updateTime: string
}
export interface NoticePageReqVO extends PageParam {
title?: string
status?: number
}
// 查询公告列表
export const getNoticePageApi = (params) => {
export const getNoticePageApi = (params: NoticePageReqVO) => {
return request.get({ url: '/system/notice/page', params })
}

View File

@ -1,12 +0,0 @@
export type NoticeVO = {
id: number
title: string
type: number
content: string
status: number
remark: string
creator: string
createTime: string
updater: string
updateTime: string
}

View File

@ -1,5 +1,25 @@
import request from '@/config/axios'
import { OAuth2ClientVo } from './client.types'
export interface OAuth2ClientVO {
id: number
clientId: string
secret: string
name: string
logo: string
description: string
status: number
accessTokenValiditySeconds: number
refreshTokenValiditySeconds: number
redirectUris: string[]
autoApprove: boolean
authorizedGrantTypes: string[]
scopes: string[]
authorities: string[]
resourceIds: string[]
additionalInformation: string
isAdditionalInformationJson: boolean
createTime: string
}
// 查询 OAuth2列表
export const getOAuth2ClientPageApi = (params) => {
@ -12,12 +32,12 @@ export const getOAuth2ClientApi = (id: number) => {
}
// 新增 OAuth2
export const createOAuth2ClientApi = (data: OAuth2ClientVo) => {
export const createOAuth2ClientApi = (data: OAuth2ClientVO) => {
return request.post({ url: '/system/oauth2-client/create', data })
}
// 修改 OAuth2
export const updateOAuth2ClientApi = (data: OAuth2ClientVo) => {
export const updateOAuth2ClientApi = (data: OAuth2ClientVO) => {
return request.put({ url: '/system/oauth2-client/update', data })
}

View File

@ -1,20 +0,0 @@
export type OAuth2ClientVo = {
id: number
clientId: string
secret: string
name: string
logo: string
description: string
status: number
accessTokenValiditySeconds: number
refreshTokenValiditySeconds: number
redirectUris: string[]
autoApprove: boolean
authorizedGrantTypes: string[]
scopes: string[]
authorities: string[]
resourceIds: string[]
additionalInformation: string
isAdditionalInformationJson: boolean
createTime: string
}

View File

@ -1,7 +1,24 @@
import request from '@/config/axios'
export interface OAuth2TokenVO {
id: number
accessToken: string
refreshToken: string
userId: number
userType: number
clientId: string
createTime: string
expiresTime: string
}
export interface OAuth2TokenPageReqVO extends PageParam {
code?: string
name?: string
status?: number
}
// 查询 token列表
export const getAccessTokenPageApi = (params) => {
export const getAccessTokenPageApi = (params: OAuth2TokenPageReqVO) => {
return request.get({ url: '/system/oauth2-token/page', params })
}

View File

@ -1,10 +0,0 @@
export type OAuth2TokenVo = {
id: number
accessToken: string
refreshToken: string
userId: number
userType: number
clientId: string
createTime: string
expiresTime: string
}

View File

@ -1,10 +1,41 @@
import request from '@/config/axios'
export type OperateLogVO = {
id: number
userNickname: string
traceId: string
userId: number
module: string
name: string
type: number
content: string
exts: object
requestMethod: string
requestUrl: string
userIp: string
userAgent: string
javaMethod: string
javaMethodArgs: string
startTime: string
duration: number
resultCode: number
resultMsg: string
resultData: string
}
export interface OperateLogPageReqVO extends PageParam {
module?: string
userNickname?: string
type?: number
success?: boolean
startTime?: string[]
}
// 查询操作日志列表
export const getOperateLogPageApi = (params) => {
export const getOperateLogPageApi = (params: OperateLogPageReqVO) => {
return request.get({ url: '/system/operate-log/page', params })
}
// 导出操作日志
export const exportOperateLogApi = (params) => {
export const exportOperateLogApi = (params: OperateLogPageReqVO) => {
return request.download({ url: '/system/operate-log/export', params })
}

View File

@ -1,22 +0,0 @@
export type OperateLogVO = {
id: number
userNickname: string
traceId: string
userId: number
module: string
name: string
type: number
content: string
exts: object
requestMethod: string
requestUrl: string
userIp: string
userAgent: string
javaMethod: string
javaMethodArgs: string
startTime: string
duration: number
resultCode: number
resultMsg: string
resultData: string
}

View File

@ -1,9 +1,20 @@
import request from '@/config/axios'
import type {
PermissionAssignRoleDataScopeReqVO,
PermissionAssignRoleMenuReqVO,
PermissionAssignUserRoleReqVO
} from './types'
export interface PermissionAssignUserRoleReqVO {
userId: number
roleIds: number[]
}
export interface PermissionAssignRoleMenuReqVO {
roleId: number
menuIds: number[]
}
export interface PermissionAssignRoleDataScopeReqVO {
roleId: number
dataScope: number
dataScopeDeptIds: number[]
}
// 查询角色拥有的菜单权限
export const listRoleMenusApi = async (roleId: number) => {

View File

@ -1,15 +0,0 @@
export type PermissionAssignUserRoleReqVO = {
userId: number
roleIds: number[]
}
export type PermissionAssignRoleMenuReqVO = {
roleId: number
menuIds: number[]
}
export type PermissionAssignRoleDataScopeReqVO = {
roleId: number
dataScope: number
dataScopeDeptIds: number[]
}

View File

@ -1,5 +1,26 @@
import request from '@/config/axios'
import type { PostVO, PostPageReqVO, PostExportReqVO } from './types'
export interface PostVO {
id?: number
name: string
code: string
sort: number
status: number
remark: string
createTime?: string
}
export interface PostPageReqVO extends PageParam {
code?: string
name?: string
status?: number
}
export interface PostExportReqVO {
code?: string
name?: string
status?: number
}
// 查询岗位列表
export const getPostPageApi = async (params: PostPageReqVO) => {
@ -10,6 +31,7 @@ export const getPostPageApi = async (params: PostPageReqVO) => {
export const listSimplePostsApi = async () => {
return await request.get({ url: '/system/post/list-all-simple' })
}
// 查询岗位详情
export const getPostApi = async (id: number) => {
return await request.get({ url: '/system/post/get?id=' + id })
@ -31,7 +53,6 @@ export const deletePostApi = async (id: number) => {
}
// 导出岗位
// TODO @星语:导出这块,咱怎么弄哈
export const exportPostApi = async (params: PostExportReqVO) => {
return await request.download({ url: '/system/post/export', params })
}

View File

@ -1,24 +0,0 @@
export type PostVO = {
id?: number
name: string
code: string
sort: number
status: number
remark: string
createTime?: string
}
// TODO @星语:要不要搞个 Page 基类呀?和后端对应
export type PostPageReqVO = {
code: string
name: string
status?: number
pageSize?: number
pageNo?: number
}
export type PostExportReqVO = {
code: string
name: string
status?: number
}

View File

@ -1,8 +1,24 @@
import request from '@/config/axios'
import type { RoleVO } from './types'
export interface RoleVO {
id: number
name: string
code: string
sort: number
status: number
type: number
createTime: string
}
export interface RolePageReqVO extends PageParam {
name?: string
code?: string
status?: number
createTime?: string[]
}
// 查询角色列表
export const getRolePageApi = async (params) => {
export const getRolePageApi = async (params: RolePageReqVO) => {
return await request.get({ url: '/system/role/page', params })
}

View File

@ -1,9 +0,0 @@
export type RoleVO = {
id: number
name: string
code: string
sort: number
status: number
type: number
createTime: string
}

View File

@ -1,8 +1,27 @@
import request from '@/config/axios'
import type { SensitiveWordVO } from './types'
export interface SensitiveWordVO {
id: number
name: string
status: number
description: string
tags: string
type: number
createTime: string
}
export interface SensitiveWordPageReqVO extends PageParam {
name?: string
status?: number
}
export interface SensitiveWordExportReqVO {
name?: string
status?: number
}
// 查询敏感词列表
export const getSensitiveWordPageApi = (params) => {
export const getSensitiveWordPageApi = (params: SensitiveWordPageReqVO) => {
return request.get({ url: '/system/sensitive-word/page', params })
}
@ -27,7 +46,7 @@ export const deleteSensitiveWordApi = (id: number) => {
}
// 导出敏感词
export const exportSensitiveWordApi = (params) => {
export const exportSensitiveWordApi = (params: SensitiveWordExportReqVO) => {
return request.download({ url: '/system/sensitive-word/export-excel', params })
}

View File

@ -1,9 +0,0 @@
export type SensitiveWordVO = {
id: number
name: string
status: number
description: string
tags: string
type: number
createTime: string
}

View File

@ -1,8 +1,24 @@
import request from '@/config/axios'
import type { SmsChannelVO } from './types'
export interface SmsChannelVO {
id: number
status: number
signature: string
remark: string
apiKey: string
apiSecret: string
callbackUrl: string
createTime: string
}
export interface SmsChannelPageReqVO extends PageParam {
signature?: string
code?: string
status?: number
}
// 查询短信渠道列表
export const getSmsChannelPageApi = (params) => {
export const getSmsChannelPageApi = (params: SmsChannelPageReqVO) => {
return request.get({ url: '/system/sms-channel/page', params })
}

View File

@ -1,10 +0,0 @@
export type SmsChannelVO = {
id: number
status: number
signature: string
remark: string
apiKey: string
apiSecret: string
callbackUrl: string
createTime: string
}

View File

@ -1,11 +1,39 @@
import request from '@/config/axios'
export interface SmsLogVO {
id: number
idchannelId: number
templateId: number
mobile: string
userId: number
userType: number
sendStatus: number
receiveStatus: number
templateType: number
templateContent: string
templateParams: Map<string, object>
apiTemplateId: string
sendTime: string
createTime: string
}
export interface SmsLogPageReqVO extends PageParam {
signature?: string
code?: string
status?: number
}
export interface SmsLogExportReqVO {
code?: string
name?: string
status?: number
}
// 查询短信日志列表
export const getSmsLogPageApi = (params) => {
export const getSmsLogPageApi = (params: SmsLogPageReqVO) => {
return request.get({ url: '/system/sms-log/page', params })
}
// 导出短信日志
export const exportSmsLogApi = (params) => {
export const exportSmsLogApi = (params: SmsLogExportReqVO) => {
return request.download({ url: '/system/sms-log/export', params })
}

View File

@ -1,9 +0,0 @@
export type SmsLogVO = {
id: number
idchannelId: number
templateId: number
mobile: string
sendStatus: number
receiveStatus: number
createTime: string
}

View File

@ -1,5 +1,24 @@
import request from '@/config/axios'
import type { SmsTemplateVO } from './types'
export interface SmsTemplateVO {
id: number
type: number
status: number
code: string
name: string
content: string
remark: string
apiTemplateId: string
channelId: number
channelCode: string
createTime: string
}
export type SmsSendVO = {
mobile: string
templateCode: string
templateParams: string
}
// 查询短信模板列表
export const getSmsTemplatePageApi = (params) => {

View File

@ -1,19 +0,0 @@
export type SmsTemplateVO = {
id: number
type: number
status: number
code: string
name: string
content: string
remark: string
apiTemplateId: string
channelId: number
channelCode: string
createTime: string
}
export type SmsSendVO = {
mobile: string
templateCode: string
templateParams: string
}

View File

@ -1,8 +1,36 @@
import request from '@/config/axios'
import type { TenantVO } from './types'
export interface TenantVO {
id: number
name: string
packageId: number
contactName: string
contactMobile: string
username: string
password: string
accountCount: number
expireTime: string
domain: string
status: number
createTime: string
}
export interface TenantPageReqVO extends PageParam {
name?: string
contactName?: string
contactMobile?: string
status?: number
}
export interface TenantExportReqVO {
name?: string
contactName?: string
contactMobile?: string
status?: number
}
// 查询租户列表
export const getTenantPageApi = (params) => {
export const getTenantPageApi = (params: TenantPageReqVO) => {
return request.get({ url: '/system/tenant/page', params })
}
@ -27,6 +55,6 @@ export const deleteTenantApi = (id: number) => {
}
// 导出租户
export const exportTenantApi = (params) => {
export const exportTenantApi = (params: TenantExportReqVO) => {
return request.download({ url: '/system/tenant/export-excel', params })
}

View File

@ -1,14 +0,0 @@
export type TenantVO = {
id: number
name: string
packageId: number
contactName: string
contactMobile: string
username: string
password: string
accountCount: number
expireTime: string
domain: string
status: number
createTime: string
}

View File

@ -1,8 +1,26 @@
import request from '@/config/axios'
import type { TenantPackageVO } from './types'
export interface TenantPackageVO {
id: number
name: string
status: number
remark: string
creator: string
createTime: string
updater: string
updateTime: string
menuIds: string[]
}
export interface TenantPackagePageReqVO extends PageParam {
name?: string
contactName?: string
contactMobile?: string
status?: number
}
// 查询租户套餐列表
export const getTenantPackageTypePageApi = (params) => {
export const getTenantPackageTypePageApi = (params: TenantPackagePageReqVO) => {
return request.get({ url: '/system/tenant-package/page', params })
}
@ -25,7 +43,7 @@ export const updateTenantPackageTypeApi = (data: TenantPackageVO) => {
export const deleteTenantPackageTypeApi = (id: number) => {
return request.delete({ url: '/system/tenant-package/delete?id=' + id })
}
// // 获取租户套餐精简信息列表
// 获取租户套餐精简信息列表
export const getTenantPackageList = () => {
return request.get({ url: '/system/tenant-package/get-simple-list' })
}

View File

@ -1,11 +0,0 @@
export type TenantPackageVO = {
id: number
name: string
status: number
remark: string
creator: string
createTime: string
updater: string
updateTime: string
menuIds: string[]
}

View File

@ -1,8 +1,39 @@
import request from '@/config/axios'
import type { UserVO } from './types'
export interface UserVO {
id: number
username: string
nickname: string
deptId: number
postIds: string[]
email: string
mobile: string
sex: number
avatar: string
loginIp: string
status: number
remark: string
loginDate: string
createTime: string
}
export interface UserPageReqVO extends PageParam {
deptId?: number
username?: string
mobile?: string
status?: number
createTime?: string[]
}
export interface UserExportReqVO {
code?: string
name?: string
status?: number
createTime?: string[]
}
// 查询用户管理列表
export const getUserPageApi = (params) => {
export const getUserPageApi = (params: UserPageReqVO) => {
return request.get({ url: '/system/user/page', params })
}
@ -27,7 +58,7 @@ export const deleteUserApi = (id: number) => {
}
// 导出用户
export const exportUserApi = (params) => {
export const exportUserApi = (params: UserExportReqVO) => {
return request.download({ url: '/system/user/export', params })
}

View File

@ -0,0 +1,77 @@
import request from '@/config/axios'
export interface ProfileDept {
id: number
name: string
}
export interface ProfileRole {
id: number
name: string
}
export interface ProfilePost {
id: number
name: string
}
export interface SocialUser {
id: number
type: number
openid: string
token: string
rawTokenInfo: string
nickname: string
avatar: string
rawUserInfo: string
code: string
state: string
}
export interface ProfileVO {
id: number
username: string
nickname: string
dept: ProfileDept
roles: ProfileRole[]
posts: ProfilePost[]
socialUsers: SocialUser[]
email: string
mobile: string
sex: number
avatar: string
status: number
remark: string
loginIp: string
loginDate: Date
createTime: Date
}
export interface UserProfileUpdateReqVO {
nickname: string
email: string
mobile: string
sex: number
}
// 查询用户个人信息
export const getUserProfileApi = () => {
return request.get({ url: '/system/user/profile/get' })
}
// 修改用户个人信息
export const updateUserProfileApi = (data: UserProfileUpdateReqVO) => {
return request.put({ url: '/system/user/profile/update', data })
}
// 用户密码重置
export const updateUserPwdApi = (oldPassword: string, newPassword: string) => {
return request.put({
url: '/system/user/profile/update-password',
data: {
oldPassword: oldPassword,
newPassword: newPassword
}
})
}
// 用户头像上传
export const uploadAvatarApi = (data) => {
return request.put({ url: '/system/user/profile/update-avatar', data })
}

Some files were not shown because too many files have changed in this diff Show More