feat: 消息类型CURD完成,修改部分错误内容
This commit is contained in:
parent
06c4c66d4c
commit
a423552a2f
|
@ -14,13 +14,13 @@ public class AdminCodeGenerator {
|
|||
// 作者名称
|
||||
public static final String author = "Bunny";
|
||||
// 公共路径
|
||||
// public static final String outputDir = "D:\\MyFolder\\auth-admin\\auth-server-java\\service";
|
||||
public static final String outputDir = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service";
|
||||
public static final String outputDir = "D:\\MyFolder\\auth-admin\\auth-server-java\\service";
|
||||
// public static final String outputDir = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service";
|
||||
// 实体类名称
|
||||
public static final String entity = "Bunny";
|
||||
|
||||
public static void main(String[] args) {
|
||||
Generation("log_user_login");
|
||||
Generation("sys_message", "sys_message_type");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,10 +3,10 @@ package cn.bunny.common.generator.generator;
|
|||
import cn.bunny.common.generator.entity.BaseField;
|
||||
import cn.bunny.common.generator.entity.BaseResultMap;
|
||||
import cn.bunny.common.generator.utils.GeneratorCodeUtils;
|
||||
import cn.bunny.dao.dto.log.UserLoginLogDto;
|
||||
import cn.bunny.dao.dto.log.UserLoginLogUpdateDto;
|
||||
import cn.bunny.dao.entity.log.UserLoginLog;
|
||||
import cn.bunny.dao.vo.log.UserLoginLogVo;
|
||||
import cn.bunny.dao.dto.system.message.MessageTypeDto;
|
||||
import cn.bunny.dao.dto.system.message.MessageTypeUpdateDto;
|
||||
import cn.bunny.dao.entity.system.MessageType;
|
||||
import cn.bunny.dao.vo.system.message.MessageTypeVo;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.google.common.base.CaseFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
@ -35,26 +35,26 @@ import java.util.stream.Stream;
|
|||
@Service
|
||||
public class WebGeneratorCode {
|
||||
// 公共路径
|
||||
public static String commonPath = "D:\\Project\\web\\PC\\auth\\auth-web\\src";
|
||||
public static String commonPath = "D:\\MyFolder\\auth-admin\\auth-web\\src";
|
||||
// 生成API请求路径
|
||||
public static String apiPath = commonPath + "\\api\\v1\\";
|
||||
// 生成vue路径
|
||||
public static String vuePath = commonPath + "\\views\\monitor\\";
|
||||
public static String vuePath = commonPath + "\\views\\message\\";
|
||||
// 生成仓库路径
|
||||
public static String storePath = commonPath + "\\store\\monitor\\";
|
||||
public static String storePath = commonPath + "\\store\\message\\";
|
||||
// 后端controller
|
||||
public static String controllerPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\controller\\";
|
||||
public static String servicePath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\";
|
||||
public static String serviceImplPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\impl\\";
|
||||
public static String mapperPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\mapper\\";
|
||||
public static String resourceMapperPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\resources\\mapper\\";
|
||||
public static String controllerPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\controller\\";
|
||||
public static String servicePath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\";
|
||||
public static String serviceImplPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\impl\\";
|
||||
public static String mapperPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\mapper\\";
|
||||
public static String resourceMapperPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\resources\\mapper\\";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
Class<?> originalClass = UserLoginLog.class;
|
||||
Class<?> dtoClass = UserLoginLogDto.class;
|
||||
Class<?> addDtoClass = UserLoginLogDto.class;
|
||||
Class<?> updateDtoClass = UserLoginLogUpdateDto.class;
|
||||
Class<?> voClass = UserLoginLogVo.class;
|
||||
Class<?> originalClass = MessageType.class;
|
||||
Class<?> dtoClass = MessageTypeDto.class;
|
||||
Class<?> addDtoClass = MessageTypeDto.class;
|
||||
Class<?> updateDtoClass = MessageTypeUpdateDto.class;
|
||||
Class<?> voClass = MessageTypeVo.class;
|
||||
|
||||
// 设置velocity资源加载器
|
||||
Properties prop = new Properties();
|
||||
|
|
|
@ -21,12 +21,12 @@
|
|||
from $tableName
|
||||
<where>
|
||||
#foreach($field in $pageQueryMap)
|
||||
is_deleted = 0
|
||||
<if test="dto.${field.property} != null and dto.${field.property} != ''">
|
||||
and $field.column like CONCAT('%',#{dto.${field.property}},'%')
|
||||
</if>
|
||||
#end
|
||||
</where>
|
||||
order by update_time desc
|
||||
</select>
|
||||
|
||||
<!-- 物理删除${classTitle} -->
|
||||
|
|
|
@ -7,7 +7,7 @@ export const columns: TableColumnList = [
|
|||
{ type: 'index', index: (index: number) => index + 1, label: '序号', width: 60 },
|
||||
#foreach($field in $baseFieldList)
|
||||
// $field.annotation
|
||||
{ label: $t('${lowercaseName}_$field.name'), prop: '$field.name' },
|
||||
{ label: $t('$field.name'), prop: '$field.name' },
|
||||
#end
|
||||
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
|
||||
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
|
||||
|
@ -17,9 +17,9 @@ export const columns: TableColumnList = [
|
|||
];
|
||||
|
||||
// 添加规则
|
||||
export const rules = reactive({
|
||||
export const rules = reactive<FormRules>({
|
||||
#foreach($field in $baseFieldList)
|
||||
// $field.annotation
|
||||
$field.name: [{ required: true, message: `$leftBrace$t('input')}$leftBrace$t('${lowercaseName}_${field.name}')}`, trigger: 'blur' }],
|
||||
$field.name: [{ required: true, message: `$leftBrace$t('input')}$leftBrace$t('${field.name}')}`, trigger: 'blur' }],
|
||||
#end
|
||||
});
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
#foreach($item in $baseFieldList)
|
||||
|
||||
<!-- $item.annotation -->
|
||||
<el-form-item :label="$t('${lowercaseName}_${item.name}')" prop="$item.name">
|
||||
<el-input v-model="form.$item.name" autocomplete="off" type="text" :placeholder="$t('input') + $t('${lowercaseName}_${item.name}')" />
|
||||
<el-form-item :label="$t('${item.name}')" prop="$item.name">
|
||||
<el-input v-model="form.$item.name" autocomplete="off" type="text" :placeholder="$t('input') + $t('${item.name}')" />
|
||||
</el-form-item>
|
||||
#end
|
||||
</el-form>
|
||||
|
|
|
@ -6,6 +6,7 @@ import { h, ref } from 'vue';
|
|||
import { messageBox } from '@/utils/message';
|
||||
import type { FormItemProps } from '${typesPath}';
|
||||
import { $t } from '@/plugins/i18n';
|
||||
import type { FormRules } from 'element-plus';
|
||||
|
||||
export const formRef = ref();
|
||||
// 删除ids
|
||||
|
@ -21,12 +22,10 @@ export async function onSearch() {
|
|||
${lowercaseName}Store.loading = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* * 添加${classTitle}
|
||||
*/
|
||||
/** 添加${classTitle} */
|
||||
export function onAdd() {
|
||||
addDialog({
|
||||
title: `$leftBrace $t("add_new")}$leftBrace$t("${lowercaseName}")}`,
|
||||
title: `$leftBrace $t("addNew")}$leftBrace$t("${lowercaseName}")}`,
|
||||
width: '30%',
|
||||
props: {
|
||||
formInline: {
|
||||
|
@ -86,15 +85,13 @@ export function onUpdate(row: any) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* * 删除${classTitle}
|
||||
*/
|
||||
/** 删除${classTitle} */
|
||||
export const onDelete = async (row: any) => {
|
||||
const id = row.id;
|
||||
|
||||
// 是否确认删除
|
||||
const result = await messageBox({
|
||||
title: $t('confirm_delete'),
|
||||
title: $t('confirmDelete'),
|
||||
showMessage: false,
|
||||
confirmMessage: undefined,
|
||||
cancelMessage: $t("cancel_delete"),
|
||||
|
@ -106,22 +103,32 @@ export const onDelete = async (row: any) => {
|
|||
await onSearch();
|
||||
};
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
/** 批量删除 */
|
||||
export const onDeleteBatch = async () => {
|
||||
const ids = deleteIds.value;
|
||||
const formDeletedBatchRef = ref();
|
||||
|
||||
// 是否确认删除
|
||||
const result = await messageBox({
|
||||
title: $t('confirm_delete'),
|
||||
showMessage: false,
|
||||
confirmMessage: undefined,
|
||||
cancelMessage: $t('cancel_delete'),
|
||||
addDialog({
|
||||
title: $t('deleteBatchTip'),
|
||||
width: '30%',
|
||||
props: { formInline: { confirmText: '' } },
|
||||
draggable: true,
|
||||
fullscreenIcon: true,
|
||||
closeOnClickModal: false,
|
||||
contentRenderer: () => h(DeleteBatchDialog, { ref: formDeletedBatchRef }),
|
||||
beforeSure: (done, { options }) => {
|
||||
formDeletedBatchRef.value.formDeletedBatchRef.validate(async (valid: any) => {
|
||||
if (!valid) return;
|
||||
|
||||
const text = options.props.formInline.confirmText.toLowerCase();
|
||||
if (text === 'yes' || text === 'y') {
|
||||
// 删除数据
|
||||
await ${lowercaseName}Store.delete${originalName}(ids);
|
||||
await onSearch();
|
||||
|
||||
done();
|
||||
} else message($t('deleteBatchTip'), { type: 'warning' });
|
||||
});
|
||||
},
|
||||
});
|
||||
if (!result) return;
|
||||
|
||||
// 删除数据
|
||||
await ${lowercaseName}Store.delete${originalName}(ids);
|
||||
await onSearch();
|
||||
};
|
|
@ -18,9 +18,7 @@
|
|||
const formRef = ref();
|
||||
const ${lowercaseName}Store = use${originalName}Store();
|
||||
|
||||
/**
|
||||
* * 当前页改变时
|
||||
*/
|
||||
/** 当前页改变时 */
|
||||
const onCurrentPageChange = async (value: number) => {
|
||||
${lowercaseName}Store.pagination.currentPage = value;
|
||||
await onSearch();
|
||||
|
@ -64,8 +62,8 @@ onMounted(() => {
|
|||
#foreach($item in $formList)
|
||||
|
||||
<!-- $item.annotation -->
|
||||
<el-form-item :label="$t('${lowercaseName}_${item.name}')" prop="${item.name}">
|
||||
<el-input v-model="${lowercaseName}Store.form.${item.name}" :placeholder="`$leftBrace$t('input')}$leftBrace$t('${lowercaseName}_${item.name}')}`" class="!w-[180px]" clearable />
|
||||
<el-form-item :label="$t('${item.name}')" prop="${item.name}">
|
||||
<el-input v-model="${lowercaseName}Store.form.${item.name}" :placeholder="`$leftBrace$t('input')}$leftBrace$t('${item.name}')}`" class="!w-[180px]" clearable />
|
||||
</el-form-item>
|
||||
#end
|
||||
<el-form-item>
|
||||
|
@ -76,7 +74,7 @@ onMounted(() => {
|
|||
|
||||
<PureTableBar :columns="columns" title="${classDescription}" @fullscreen="tableRef.setAdaptive()" @refresh="onSearch">
|
||||
<template #buttons>
|
||||
<el-button :icon="useRenderIcon(AddFill)" type="primary" @click="onAdd"> {{ $t('add_new') }} </el-button>
|
||||
<el-button :icon="useRenderIcon(AddFill)" type="primary" @click="onAdd"> {{ $t('addNew') }} </el-button>
|
||||
|
||||
<!-- 批量删除按钮 -->
|
||||
<el-button v-show="deleteIds.length > 0" :icon="useRenderIcon(Delete)" type="danger" @click="onDeleteBatch">
|
||||
|
@ -116,7 +114,7 @@ onMounted(() => {
|
|||
|
||||
<template #operation="{ row }">
|
||||
<el-button :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary" @click="onUpdate(row)"> {{ $t('modify') }} </el-button>
|
||||
<el-button :icon="useRenderIcon(AddFill)" :size="size" class="reset-margin" link type="primary" @click="onAdd"> {{ $t('add_new') }} </el-button>
|
||||
<el-button :icon="useRenderIcon(AddFill)" :size="size" class="reset-margin" link type="primary" @click="onAdd"> {{ $t('addNew') }} </el-button>
|
||||
<!-- TODO 待完成 -->
|
||||
<el-popconfirm :title="`${leftBrace}$t('delete')}${row.email}?`" @confirm="onDelete(row)">
|
||||
<template #reference>
|
||||
|
|
|
@ -36,7 +36,7 @@ public class MinioUtil {
|
|||
/**
|
||||
* 获取Minio文件路径
|
||||
*/
|
||||
public static MinioFilePath initUploadFile4MinioFilePath(String buckName, String minioPreType, MultipartFile file) {
|
||||
public static MinioFilePath initUploadFileReturnMinioFilePath(String buckName, String minioPreType, MultipartFile file) {
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
// 定义日期时间格式
|
||||
LocalDateTime currentDateTime = LocalDateTime.now();
|
||||
|
@ -75,19 +75,20 @@ public class MinioUtil {
|
|||
/**
|
||||
* * 上传文件并返回处理信息
|
||||
*/
|
||||
public MinioFilePath uploadObject4FilePath(MultipartFile file, String minioPreType) throws IOException {
|
||||
public MinioFilePath uploadObjectReturnFilePath(MultipartFile file, String minioPreType) throws IOException {
|
||||
if (file == null) return null;
|
||||
String bucketName = properties.getBucketName();
|
||||
if (file != null) {
|
||||
MinioFilePath minioFile = initUploadFile4MinioFilePath(bucketName, minioPreType, file);
|
||||
String filepath = minioFile.getFilepath();
|
||||
|
||||
// 上传对象
|
||||
try {
|
||||
MinioFilePath minioFile = initUploadFileReturnMinioFilePath(bucketName, minioPreType, file);
|
||||
|
||||
// 上传对象
|
||||
putObject(bucketName, filepath, file.getInputStream(), file.getSize());
|
||||
minioClient.putObject(PutObjectArgs.builder().bucket(bucketName).object(minioFile.getFilepath()).stream(file.getInputStream(), file.getSize(), -1).build());
|
||||
|
||||
// 设置图片地址
|
||||
return minioFile;
|
||||
} catch (Exception exception) {
|
||||
throw new BunnyException(ResultCodeEnum.UPDATE_ERROR);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package cn.bunny.dao.dto.system.message;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "MessageTypeAddDto对象", title = "系统消息类型", description = "系统消息类型")
|
||||
public class MessageTypeAddDto {
|
||||
|
||||
@Schema(name = "messageName", title = "消息名称")
|
||||
@NotBlank(message = "消息名称 不能为空")
|
||||
@NotNull(message = "消息名称 不能为空")
|
||||
private String messageName;
|
||||
|
||||
@Schema(name = "messageType", title = "sys:系统消息,user用户消息")
|
||||
@NotBlank(message = "消息类型 不能为空")
|
||||
@NotNull(message = "消息类型 不能为空")
|
||||
private String messageType;
|
||||
|
||||
@Schema(name = "summary", title = "消息备注")
|
||||
private String summary;
|
||||
|
||||
@Schema(name = "status", title = "消息类型")
|
||||
private Boolean status = true;
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package cn.bunny.dao.dto.system.message;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "MessageType对象", title = "系统消息类型", description = "系统消息类型")
|
||||
public class MessageTypeDto {
|
||||
|
||||
@Schema(name = "status", title = "1:启用 0:禁用")
|
||||
private Boolean status;
|
||||
|
||||
@Schema(name = "messageName", title = "消息名称")
|
||||
private String messageName;
|
||||
|
||||
@Schema(name = "messageType", title = "sys:系统消息,user用户消息")
|
||||
private String messageType;
|
||||
|
||||
@Schema(name = "summary", title = "消息备注")
|
||||
private String summary;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package cn.bunny.dao.dto.system.message;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "MessageTypeUpdateDto对象", title = "系统消息类型", description = "系统消息类型")
|
||||
public class MessageTypeUpdateDto {
|
||||
|
||||
@Schema(name = "id", title = "主键")
|
||||
@NotNull(message = "id不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(name = "status", title = "1:启用 0:禁用")
|
||||
private Boolean status;
|
||||
|
||||
@Schema(name = "messageName", title = "消息名称")
|
||||
private String messageName;
|
||||
|
||||
@Schema(name = "messageType", title = "sys:系统消息,user用户消息")
|
||||
private String messageType;
|
||||
|
||||
@Schema(name = "summary", title = "消息备注")
|
||||
private String summary;
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package cn.bunny.dao.entity.system;
|
||||
|
||||
import cn.bunny.dao.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统消息
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-10-30
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(chain = true)
|
||||
@TableName("sys_message")
|
||||
@Schema(name = "Message对象", title = "系统消息", description = "系统消息")
|
||||
public class Message extends BaseEntity {
|
||||
|
||||
@Schema(name = "receivedUserId", title = "接收人用户ID")
|
||||
private Long receivedUserId;
|
||||
|
||||
@Schema(name = "sendUserId", title = "发送人用户ID")
|
||||
private Long sendUserId;
|
||||
|
||||
@Schema(name = "sendNickName", title = "发送人昵称")
|
||||
private String sendNickName;
|
||||
|
||||
@Schema(name = "messageType", title = "sys:系统消息,user用户消息")
|
||||
private String messageType;
|
||||
|
||||
@Schema(name = "content", title = "消息内容")
|
||||
private String content;
|
||||
|
||||
@Schema(name = "editorType", title = "编辑器类型")
|
||||
private String editorType;
|
||||
|
||||
@Schema(name = "status", title = "0:未读 1:已读")
|
||||
private Boolean status;
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package cn.bunny.dao.entity.system;
|
||||
|
||||
import cn.bunny.dao.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统消息类型
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-10-30
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(chain = true)
|
||||
@TableName("sys_message_type")
|
||||
@Schema(name = "MessageType对象", title = "系统消息类型", description = "系统消息类型")
|
||||
public class MessageType extends BaseEntity {
|
||||
|
||||
@Schema(name = "messageName", title = "消息名称")
|
||||
private String messageName;
|
||||
|
||||
@Schema(name = "messageType", title = "sys:系统消息,user用户消息")
|
||||
private String messageType;
|
||||
|
||||
@Schema(name = "summary", title = "消息备注")
|
||||
private String summary;
|
||||
|
||||
@Schema(name = "status", title = "0:启用 1:禁用")
|
||||
private Boolean status;
|
||||
|
||||
}
|
||||
|
|
@ -9,25 +9,19 @@ import java.util.Map;
|
|||
public class MinioConstant {
|
||||
public static final String favicon = "favicon";
|
||||
public static final String avatar = "avatar";
|
||||
public static final String article = "article";
|
||||
public static final String message = "message";
|
||||
public static final String carousel = "carousel";
|
||||
public static final String feedback = "feedback";
|
||||
public static final String backup = "backup";
|
||||
public static final String articleCovers = "articleCovers";
|
||||
public static final String articleAttachment = "articleAttachment";
|
||||
public static final Map<String, String> typeMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
typeMap.put(favicon, "/favicon/");
|
||||
typeMap.put(avatar, "/avatar/");
|
||||
typeMap.put(article, "/article/");
|
||||
typeMap.put(message, "/message/");
|
||||
typeMap.put(carousel, "/carousel/");
|
||||
typeMap.put(feedback, "/feedback/");
|
||||
typeMap.put(backup, "/backup/");
|
||||
typeMap.put("articleImages", "/articleImages/");
|
||||
typeMap.put("articleVideo", "/articleVideo/");
|
||||
typeMap.put(articleCovers, "/articleCovers/");
|
||||
typeMap.put(articleAttachment, "/articleAttachment/");
|
||||
typeMap.put("images", "/images/");
|
||||
typeMap.put("video", "/video/");
|
||||
typeMap.put("default", "/default/");
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package cn.bunny.dao.vo.system.message;
|
||||
|
||||
import cn.bunny.dao.vo.common.BaseVo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "MessageTypeVo对象", title = "系统消息类型", description = "系统消息类型")
|
||||
public class MessageTypeVo extends BaseVo {
|
||||
|
||||
@Schema(name = "messageName", title = "消息名称")
|
||||
private String messageName;
|
||||
|
||||
@Schema(name = "messageType", title = "sys:系统消息,user用户消息")
|
||||
private String messageType;
|
||||
|
||||
@Schema(name = "summary", title = "消息备注")
|
||||
private String summary;
|
||||
|
||||
@Schema(name = "status", title = "消息状态")
|
||||
private Boolean status;
|
||||
|
||||
}
|
|
@ -14,7 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Tag(name = "配置", description = "系统配置相关接口")
|
||||
@Tag(name = "系统配置", description = "系统配置相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/admin/config")
|
||||
public class ConfigurationController {
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.List;
|
|||
* @author Bunny
|
||||
* @since 2024-10-04 10:39:08
|
||||
*/
|
||||
@Tag(name = "部门", description = "部门相关接口")
|
||||
@Tag(name = "系统部门", description = "部门相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/admin/dept")
|
||||
public class DeptController {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package cn.bunny.services.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统消息 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-10-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/admin/message")
|
||||
public class MessageController {
|
||||
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package cn.bunny.services.controller;
|
||||
|
||||
import cn.bunny.dao.dto.system.message.MessageTypeAddDto;
|
||||
import cn.bunny.dao.dto.system.message.MessageTypeDto;
|
||||
import cn.bunny.dao.dto.system.message.MessageTypeUpdateDto;
|
||||
import cn.bunny.dao.entity.system.MessageType;
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import cn.bunny.dao.pojo.result.Result;
|
||||
import cn.bunny.dao.pojo.result.ResultCodeEnum;
|
||||
import cn.bunny.dao.vo.system.message.MessageTypeVo;
|
||||
import cn.bunny.services.service.MessageTypeService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统消息类型表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-10-30 13:19:33
|
||||
*/
|
||||
@Tag(name = "系统消息类型", description = "系统消息类型相关接口")
|
||||
@RestController
|
||||
@RequestMapping("admin/messageType")
|
||||
public class MessageTypeController {
|
||||
|
||||
@Autowired
|
||||
private MessageTypeService messageTypeService;
|
||||
|
||||
@Operation(summary = "分页查询系统消息类型", description = "分页查询系统消息类型")
|
||||
@GetMapping("getMessageTypeList/{page}/{limit}")
|
||||
public Mono<Result<PageResult<MessageTypeVo>>> getMessageTypeList(
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@PathVariable("page") Integer page,
|
||||
@Parameter(name = "limit", description = "每页记录数", required = true)
|
||||
@PathVariable("limit") Integer limit,
|
||||
MessageTypeDto dto) {
|
||||
Page<MessageType> pageParams = new Page<>(page, limit);
|
||||
PageResult<MessageTypeVo> pageResult = messageTypeService.getMessageTypeList(pageParams, dto);
|
||||
return Mono.just(Result.success(pageResult));
|
||||
}
|
||||
|
||||
@Operation(summary = "获取所有消息类型", description = "获取所有消息类型")
|
||||
@GetMapping("noManage/getAllMessageTypes")
|
||||
public Mono<Result<List<MessageTypeVo>>> getNoManageMessageTypes() {
|
||||
List<MessageTypeVo> voList = messageTypeService.getNoManageMessageTypes();
|
||||
return Mono.just(Result.success(voList));
|
||||
}
|
||||
|
||||
@Operation(summary = "添加系统消息类型", description = "添加系统消息类型")
|
||||
@PostMapping("addMessageType")
|
||||
public Mono<Result<String>> addMessageType(@Valid @RequestBody MessageTypeAddDto dto) {
|
||||
messageTypeService.addMessageType(dto);
|
||||
return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS));
|
||||
}
|
||||
|
||||
@Operation(summary = "更新系统消息类型", description = "更新系统消息类型")
|
||||
@PutMapping("updateMessageType")
|
||||
public Mono<Result<String>> updateMessageType(@Valid @RequestBody MessageTypeUpdateDto dto) {
|
||||
messageTypeService.updateMessageType(dto);
|
||||
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
|
||||
}
|
||||
|
||||
@Operation(summary = "删除系统消息类型", description = "删除系统消息类型")
|
||||
@DeleteMapping("deleteMessageType")
|
||||
public Mono<Result<String>> deleteMessageType(@RequestBody List<Long> ids) {
|
||||
messageTypeService.deleteMessageType(ids);
|
||||
return Mono.just(Result.success(ResultCodeEnum.DELETE_SUCCESS));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package cn.bunny.services.mapper;
|
||||
|
||||
import cn.bunny.dao.entity.system.Message;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统消息 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-10-30
|
||||
*/
|
||||
@Mapper
|
||||
public interface MessageMapper extends BaseMapper<Message> {
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package cn.bunny.services.mapper;
|
||||
|
||||
import cn.bunny.dao.dto.system.message.MessageTypeDto;
|
||||
import cn.bunny.dao.entity.system.MessageType;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统消息类型 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-10-30 13:19:33
|
||||
*/
|
||||
@Mapper
|
||||
public interface MessageTypeMapper extends BaseMapper<MessageType> {
|
||||
|
||||
/**
|
||||
* * 分页查询系统消息类型内容
|
||||
*
|
||||
* @param pageParams 系统消息类型分页参数
|
||||
* @param dto 系统消息类型查询表单
|
||||
* @return 系统消息类型分页结果
|
||||
*/
|
||||
IPage<MessageType> selectListByPage(@Param("page") Page<MessageType> pageParams, @Param("dto") MessageTypeDto dto);
|
||||
|
||||
/**
|
||||
* 物理删除系统消息类型
|
||||
*
|
||||
* @param ids 删除 id 列表
|
||||
*/
|
||||
void deleteBatchIdsWithPhysics(List<Long> ids);
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package cn.bunny.services.service;
|
||||
|
||||
import cn.bunny.dao.entity.system.Message;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统消息 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-10-30
|
||||
*/
|
||||
public interface MessageService extends IService<Message> {
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package cn.bunny.services.service;
|
||||
|
||||
import cn.bunny.dao.dto.system.message.MessageTypeAddDto;
|
||||
import cn.bunny.dao.dto.system.message.MessageTypeDto;
|
||||
import cn.bunny.dao.dto.system.message.MessageTypeUpdateDto;
|
||||
import cn.bunny.dao.entity.system.MessageType;
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import cn.bunny.dao.vo.system.message.MessageTypeVo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统消息类型 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-10-30 13:19:33
|
||||
*/
|
||||
public interface MessageTypeService extends IService<MessageType> {
|
||||
|
||||
/**
|
||||
* * 获取系统消息类型列表
|
||||
*
|
||||
* @return 系统消息类型返回列表
|
||||
*/
|
||||
PageResult<MessageTypeVo> getMessageTypeList(Page<MessageType> pageParams, MessageTypeDto dto);
|
||||
|
||||
/**
|
||||
* * 添加系统消息类型
|
||||
*
|
||||
* @param dto 添加表单
|
||||
*/
|
||||
void addMessageType(@Valid MessageTypeAddDto dto);
|
||||
|
||||
/**
|
||||
* * 更新系统消息类型
|
||||
*
|
||||
* @param dto 更新表单
|
||||
*/
|
||||
void updateMessageType(@Valid MessageTypeUpdateDto dto);
|
||||
|
||||
/**
|
||||
* * 删除|批量删除系统消息类型类型
|
||||
*
|
||||
* @param ids 删除id列表
|
||||
*/
|
||||
void deleteMessageType(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获取所有消息类型
|
||||
*
|
||||
* @return 系统消息类型列表
|
||||
*/
|
||||
List<MessageTypeVo> getNoManageMessageTypes();
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
package cn.bunny.services.service.impl;
|
||||
|
||||
import cn.bunny.common.service.context.BaseContext;
|
||||
import cn.bunny.common.service.exception.BunnyException;
|
||||
import cn.bunny.common.service.utils.FileUtil;
|
||||
import cn.bunny.common.service.utils.minio.MinioProperties;
|
||||
import cn.bunny.common.service.utils.minio.MinioUtil;
|
||||
import cn.bunny.dao.dto.system.files.FileUploadDto;
|
||||
|
@ -13,7 +15,6 @@ import cn.bunny.dao.pojo.result.PageResult;
|
|||
import cn.bunny.dao.pojo.result.ResultCodeEnum;
|
||||
import cn.bunny.dao.vo.system.files.FileInfoVo;
|
||||
import cn.bunny.dao.vo.system.files.FilesVo;
|
||||
import cn.bunny.services.factory.FileFactory;
|
||||
import cn.bunny.services.mapper.FilesMapper;
|
||||
import cn.bunny.services.service.FilesService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
@ -24,6 +25,7 @@ import jakarta.validation.Valid;
|
|||
import lombok.SneakyThrows;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
|
@ -50,14 +52,17 @@ import java.util.Set;
|
|||
@Transactional
|
||||
public class FilesServiceImpl extends ServiceImpl<FilesMapper, Files> implements FilesService {
|
||||
|
||||
@Value("${spring.servlet.multipart.max-file-size}")
|
||||
private String maxFileSize;
|
||||
|
||||
@Autowired
|
||||
private MinioProperties properties;
|
||||
|
||||
@Autowired
|
||||
private FileFactory fileFactory;
|
||||
private MinioUtil minioUtil;
|
||||
|
||||
@Autowired
|
||||
private MinioUtil minioUtil;
|
||||
private FilesMapper filesMapper;
|
||||
|
||||
/**
|
||||
* * 系统文件表 服务实现类
|
||||
|
@ -94,7 +99,7 @@ public class FilesServiceImpl extends ServiceImpl<FilesMapper, Files> implements
|
|||
public void addFiles(FilesAddDto dto) {
|
||||
List<Files> list = dto.getFiles().stream().map(file -> {
|
||||
try {
|
||||
MinioFilePath minioFilePath = minioUtil.uploadObject4FilePath(file, dto.getFilepath());
|
||||
MinioFilePath minioFilePath = minioUtil.uploadObjectReturnFilePath(file, dto.getFilepath());
|
||||
|
||||
Files files = new Files();
|
||||
files.setFileType(file.getContentType());
|
||||
|
@ -133,7 +138,6 @@ public class FilesServiceImpl extends ServiceImpl<FilesMapper, Files> implements
|
|||
files.setFileType(file.getContentType());
|
||||
}
|
||||
|
||||
|
||||
// 更新内容
|
||||
files = new Files();
|
||||
BeanUtils.copyProperties(dto, files);
|
||||
|
@ -149,10 +153,45 @@ public class FilesServiceImpl extends ServiceImpl<FilesMapper, Files> implements
|
|||
@SneakyThrows
|
||||
@Override
|
||||
public FileInfoVo upload(FileUploadDto dto) {
|
||||
// 上传的文件
|
||||
MultipartFile file = dto.getFile();
|
||||
// 上传文件类型
|
||||
String type = dto.getType();
|
||||
// 管理员Id
|
||||
Long userId = BaseContext.getUserId();
|
||||
// 文件大小
|
||||
long fileSize = file.getSize();
|
||||
// 文件类型
|
||||
String contentType = file.getContentType();
|
||||
// 文件名
|
||||
String filename = file.getOriginalFilename();
|
||||
|
||||
return fileFactory.uploadFile(file, type);
|
||||
// 上传文件
|
||||
MinioFilePath minioFIlePath = minioUtil.uploadObjectReturnFilePath(file, type);
|
||||
String bucketNameFilepath = minioFIlePath.getBucketNameFilepath();
|
||||
|
||||
// 盘读研数据是否过大
|
||||
String mb = maxFileSize.replace("MB", "");
|
||||
if (fileSize / 1024 / 1024 > Long.parseLong(mb)) throw new BunnyException(ResultCodeEnum.DATA_TOO_LARGE);
|
||||
|
||||
// 插入文件信息
|
||||
Files adminFiles = new Files();
|
||||
adminFiles.setFileSize(fileSize);
|
||||
adminFiles.setFileType(contentType);
|
||||
adminFiles.setFilename(filename);
|
||||
adminFiles.setFilepath(bucketNameFilepath);
|
||||
adminFiles.setCreateUser(userId);
|
||||
filesMapper.insert(adminFiles);
|
||||
|
||||
// 返回信息内容化
|
||||
return FileInfoVo.builder()
|
||||
.size(FileUtil.getSize(fileSize))
|
||||
.filepath(bucketNameFilepath)
|
||||
.fileSize(fileSize)
|
||||
.fileType(contentType)
|
||||
.filename(filename)
|
||||
.url(minioUtil.getObjectNameFullPath(bucketNameFilepath))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package cn.bunny.services.service.impl;
|
||||
|
||||
import cn.bunny.dao.entity.system.Message;
|
||||
import cn.bunny.services.mapper.MessageMapper;
|
||||
import cn.bunny.services.service.MessageService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统消息 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-10-30
|
||||
*/
|
||||
@Service
|
||||
public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> implements MessageService {
|
||||
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
package cn.bunny.services.service.impl;
|
||||
|
||||
import cn.bunny.dao.dto.system.message.MessageTypeAddDto;
|
||||
import cn.bunny.dao.dto.system.message.MessageTypeDto;
|
||||
import cn.bunny.dao.dto.system.message.MessageTypeUpdateDto;
|
||||
import cn.bunny.dao.entity.system.MessageType;
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import cn.bunny.dao.vo.system.message.MessageTypeVo;
|
||||
import cn.bunny.services.mapper.MessageTypeMapper;
|
||||
import cn.bunny.services.service.MessageTypeService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统消息类型 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-10-30 13:19:33
|
||||
*/
|
||||
@Service
|
||||
public class MessageTypeServiceImpl extends ServiceImpl<MessageTypeMapper, MessageType> implements MessageTypeService {
|
||||
|
||||
/**
|
||||
* * 系统消息类型 服务实现类
|
||||
*
|
||||
* @param pageParams 系统消息类型分页查询page对象
|
||||
* @param dto 系统消息类型分页查询对象
|
||||
* @return 查询分页系统消息类型返回对象
|
||||
*/
|
||||
@Override
|
||||
public PageResult<MessageTypeVo> getMessageTypeList(Page<MessageType> pageParams, MessageTypeDto dto) {
|
||||
// 分页查询菜单图标
|
||||
IPage<MessageType> page = baseMapper.selectListByPage(pageParams, dto);
|
||||
|
||||
List<MessageTypeVo> voList = page.getRecords().stream().map(messageType -> {
|
||||
MessageTypeVo messageTypeVo = new MessageTypeVo();
|
||||
BeanUtils.copyProperties(messageType, messageTypeVo);
|
||||
return messageTypeVo;
|
||||
}).toList();
|
||||
|
||||
return PageResult.<MessageTypeVo>builder()
|
||||
.list(voList)
|
||||
.pageNo(page.getCurrent())
|
||||
.pageSize(page.getSize())
|
||||
.total(page.getTotal())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加系统消息类型
|
||||
*
|
||||
* @param dto 系统消息类型添加
|
||||
*/
|
||||
@Override
|
||||
public void addMessageType(@Valid MessageTypeAddDto dto) {
|
||||
// 保存数据
|
||||
MessageType messageType = new MessageType();
|
||||
BeanUtils.copyProperties(dto, messageType);
|
||||
save(messageType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新系统消息类型
|
||||
*
|
||||
* @param dto 系统消息类型更新
|
||||
*/
|
||||
@Override
|
||||
public void updateMessageType(@Valid MessageTypeUpdateDto dto) {
|
||||
// 更新内容
|
||||
MessageType messageType = new MessageType();
|
||||
BeanUtils.copyProperties(dto, messageType);
|
||||
updateById(messageType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除|批量删除系统消息类型
|
||||
*
|
||||
* @param ids 删除id列表
|
||||
*/
|
||||
@Override
|
||||
public void deleteMessageType(List<Long> ids) {
|
||||
baseMapper.deleteBatchIdsWithPhysics(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有消息类型
|
||||
*
|
||||
* @return 系统消息类型列表
|
||||
*/
|
||||
@Override
|
||||
public List<MessageTypeVo> getNoManageMessageTypes() {
|
||||
return list(Wrappers.<MessageType>lambdaQuery().eq(MessageType::getStatus, true)).stream().map(messageType -> {
|
||||
MessageTypeVo messageTypeVo = new MessageTypeVo();
|
||||
BeanUtils.copyProperties(messageType, messageTypeVo);
|
||||
return messageTypeVo;
|
||||
}).toList();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.bunny.services.mapper.MessageMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.system.Message">
|
||||
<id column="id" property="id"/>
|
||||
<result column="received_user_id" property="receivedUserId"/>
|
||||
<result column="send_user_id" property="sendUserId"/>
|
||||
<result column="send_nick_name" property="sendNickName"/>
|
||||
<result column="message_type" property="messageType"/>
|
||||
<result column="content" property="content"/>
|
||||
<result column="editor_type" property="editorType"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, received_user_id, send_user_id, send_nick_name, message_type, content, editor_type, status, create_time, update_time, update_user, is_deleted
|
||||
</sql>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.bunny.services.mapper.MessageTypeMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.system.MessageType">
|
||||
<id column="id" property="id"/>
|
||||
<id column="create_time" property="createTime"/>
|
||||
<id column="update_time" property="updateTime"/>
|
||||
<id column="create_user" property="createUser"/>
|
||||
<id column="update_user" property="updateUser"/>
|
||||
<id column="is_deleted" property="isDeleted"/>
|
||||
<id column="message_name" property="messageName"/>
|
||||
<id column="message_type" property="messageType"/>
|
||||
<id column="summary" property="summary"/>
|
||||
<id column="status" property="status"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, create_time, update_time, create_user, update_user, is_deleted, message_name, message_type, summary, status
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询系统消息类型内容 -->
|
||||
<select id="selectListByPage" resultType="cn.bunny.dao.entity.system.MessageType">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from sys_message_type
|
||||
<where>
|
||||
is_deleted = 0
|
||||
<if test="dto.status != null">
|
||||
and status = #{dto.status}
|
||||
</if>
|
||||
<if test="dto.messageName != null and dto.messageName != ''">
|
||||
and message_name like CONCAT('%',#{dto.messageName},'%')
|
||||
</if>
|
||||
<if test="dto.messageType != null and dto.messageType != ''">
|
||||
and message_type like CONCAT('%',#{dto.messageType},'%')
|
||||
</if>
|
||||
<if test="dto.summary != null and dto.summary != ''">
|
||||
and summary like CONCAT('%',#{dto.summary},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 物理删除系统消息类型 -->
|
||||
<delete id="deleteBatchIdsWithPhysics">
|
||||
delete
|
||||
from sys_message_type
|
||||
where id in
|
||||
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue