初始化博客后端

This commit is contained in:
2026-05-14 16:35:50 +08:00
commit 84e70aff12
646 changed files with 44291 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
org.springframework.boot.env.EnvironmentPostProcessor=\
online.junmowen.blog.base.config.YamlProcessor

View File

@@ -0,0 +1,44 @@
${AnsiColor.BRIGHT_GREEN}
${AnsiColor.BRIGHT_RED}_ooOoo_ ${AnsiColor.BRIGHT_YELLOW}
${AnsiColor.BRIGHT_RED}o8888888o ${AnsiColor.BRIGHT_YELLOW}
${AnsiColor.BRIGHT_RED}88${AnsiColor.BRIGHT_YELLOW}" . "${AnsiColor.BRIGHT_RED}88 ${AnsiColor.BRIGHT_YELLOW}
(| -_- |) ${AnsiColor.BRIGHT_YELLOW}
${AnsiColor.BLUE}O${AnsiColor.BRIGHT_YELLOW}\ = /${AnsiColor.BLUE}O ${AnsiColor.BRIGHT_YELLOW}
____/`---'\____ ${AnsiColor.BRIGHT_YELLOW}
.' \\| |// `. ${AnsiColor.BRIGHT_YELLOW}
/ \\||| : |||// \ ${AnsiColor.BRIGHT_YELLOW}
/ _||||| -:- |||||- \ ${AnsiColor.BRIGHT_YELLOW}
| | \\\ - /// | | ${AnsiColor.BRIGHT_YELLOW}
| \_| ''\---/'' | | ${AnsiColor.BRIGHT_YELLOW}
\ .-\__ `-` ___/-. / ${AnsiColor.BRIGHT_YELLOW}
___`. .' /--.--\ `. . __ ${AnsiColor.BRIGHT_YELLOW}
."" '< `.___\_<|>_/___.' >'"". ${AnsiColor.BRIGHT_YELLOW}
| | : `- \`.;`\ _ /`;.`/ - ` : | | ${AnsiColor.BRIGHT_YELLOW}
\ \ `-. \_ __\ /__ _/ .-` / / ${AnsiColor.BRIGHT_YELLOW}
${AnsiColor.BRIGHT_MAGENTA}======${AnsiColor.BRIGHT_YELLOW}`-.____`-.___\_____/___.-`____.-'${AnsiColor.BRIGHT_MAGENTA}======
`=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^ 佛祖保佑 永无BUG ^
佛曰bug 泛滥,我已瘫痪!
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
${AnsiColor.BRIGHT_BLUE}佛曰:
${AnsiColor.BRIGHT_BLUE} 写字楼里写字间,写字间里程序员;
${AnsiColor.BRIGHT_BLUE} 程序人员写程序,又拿程序换酒钱
${AnsiColor.BRIGHT_BLUE} 酒醒只在网上坐,酒醉还来网下眠;
${AnsiColor.BRIGHT_BLUE} 酒醉酒醒日复日,网上网下年复年。
${AnsiColor.BRIGHT_BLUE} 但愿老死电脑间,不愿鞠躬老板前;
${AnsiColor.BRIGHT_BLUE} 奔驰宝马贵者趣,公交自行程序员。
${AnsiColor.BRIGHT_BLUE} 别人笑我忒疯癫,我笑自己命太贱;
${AnsiColor.BRIGHT_BLUE} 不见满街漂亮妹,哪个归得程序员?
${AnsiColor.BLUE}保持谦逊 保持学习 !
${AnsiColor.BLUE}热爱代码 热爱生活 !
${AnsiColor.BLUE}永远年轻 永远前行 !
${AnsiColor.BRIGHT_CYAN}莫问博客后台管理系统 作者:${AnsiColor.BRIGHT_CYAN}君莫问 @copyright${AnsiColor.BRIGHT_CYAN}【 moshangjunmowen 】
${AnsiColor.DEFAULT}

View File

@@ -0,0 +1,23 @@
package ${packageName};
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* ${enumDesc}
*
* @Author ${basic.backendAuthor}
* @Date ${basic.backendDate}
* @Copyright ${basic.copyright}
*/
@AllArgsConstructor
@Getter
public enum ${enumName} implements BaseEnum {
;
private final ${enumJavaType} value;
private final String desc;
}

View File

@@ -0,0 +1,74 @@
package ${packageName};
#foreach ($importClass in $importPackageList)
$importClass
#end
import online.junmowen.blog.base.common.domain.ResponseDTO;
import online.junmowen.blog.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import cn.dev33.satoken.annotation.SaCheckPermission;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
/**
* ${basic.description} Controller
*
* @Author ${basic.backendAuthor}
* @Date ${basic.backendDate}
* @Copyright ${basic.copyright}
*/
@RestController
@Tag(name = "${basic.description}")
public class ${name.upperCamel}Controller {
@Resource
private ${name.upperCamel}Service ${name.lowerCamel}Service;
@Operation(summary = "分页查询 @author ${basic.backendAuthor}")
@PostMapping("/${name.lowerCamel}/queryPage")
@SaCheckPermission("${name.lowerCamel}:query")
public ResponseDTO<PageResult<${name.upperCamel}VO>> queryPage(@RequestBody @Valid ${name.upperCamel}QueryForm queryForm) {
return ResponseDTO.ok(${name.lowerCamel}Service.queryPage(queryForm));
}
#if($insertAndUpdate.isSupportInsertAndUpdate)
@Operation(summary = "添加 @author ${basic.backendAuthor}")
@PostMapping("/${name.lowerCamel}/add")
@SaCheckPermission("${name.lowerCamel}:add")
public ResponseDTO<String> add(@RequestBody @Valid ${name.upperCamel}AddForm addForm) {
return ${name.lowerCamel}Service.add(addForm);
}
@Operation(summary = "更新 @author ${basic.backendAuthor}")
@PostMapping("/${name.lowerCamel}/update")
@SaCheckPermission("${name.lowerCamel}:update")
public ResponseDTO<String> update(@RequestBody @Valid ${name.upperCamel}UpdateForm updateForm) {
return ${name.lowerCamel}Service.update(updateForm);
}
#end
#if($deleteInfo.isSupportDelete)
#if($deleteInfo.deleteEnum == "Batch" || $deleteInfo.deleteEnum == "SingleAndBatch")
@Operation(summary = "批量删除 @author ${basic.backendAuthor}")
@PostMapping("/${name.lowerCamel}/batchDelete")
@SaCheckPermission("${name.lowerCamel}:delete")
public ResponseDTO<String> batchDelete(@RequestBody ValidateList<${primaryKeyJavaType}> idList) {
return ${name.lowerCamel}Service.batchDelete(idList);
}
#end
#if($deleteInfo.deleteEnum == "Single" || $deleteInfo.deleteEnum == "SingleAndBatch")
@Operation(summary = "单个删除 @author ${basic.backendAuthor}")
@GetMapping("/${name.lowerCamel}/delete/{${primaryKeyFieldName}}")
@SaCheckPermission("${name.lowerCamel}:delete")
public ResponseDTO<String> batchDelete(@PathVariable ${primaryKeyJavaType} ${primaryKeyFieldName}) {
return ${name.lowerCamel}Service.delete(${primaryKeyFieldName});
}
#end
#end
}

View File

@@ -0,0 +1,51 @@
package ${packageName};
#foreach ($importClass in $importPackageList)
$importClass
#end
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
/**
* ${basic.description} Dao
*
* @Author ${basic.backendAuthor}
* @Date ${basic.backendDate}
* @Copyright ${basic.copyright}
*/
@Mapper
public interface ${name.upperCamel}Dao extends BaseMapper<${name.upperCamel}Entity> {
/**
* 分页 查询
*
* @param page
* @param queryForm
* @return
*/
List<${name.upperCamel}VO> queryPage(Page page, @Param("queryForm") ${name.upperCamel}QueryForm queryForm);
#if($deleteInfo.isSupportDelete)
### 假删除
#if(!${deleteInfo.isPhysicallyDeleted})
#if($deleteInfo.deleteEnum == "Single" || $deleteInfo.deleteEnum == "SingleAndBatch")
/**
* 更新删除状态
*/
long updateDeleted(@Param("${primaryKeyFieldName}")${primaryKeyJavaType} ${primaryKeyFieldName},@Param("deletedFlag")boolean deletedFlag);
#end
#if($deleteInfo.deleteEnum == "Batch" || $deleteInfo.deleteEnum == "SingleAndBatch")
/**
* 批量更新删除状态
*/
void batchUpdateDeleted(@Param("idList")List<${primaryKeyJavaType}> idList,@Param("deletedFlag")boolean deletedFlag);
#end
#end
#end
}

View File

@@ -0,0 +1,38 @@
package ${basic.javaPackageName}.domain.entity;
#foreach ($importClass in $importPackageList)
$importClass
#end
/**
* ${basic.description} 实体类
*
* @Author ${basic.backendAuthor}
* @Date ${basic.backendDate}
* @Copyright ${basic.copyright}
*/
@Data
@TableName("${tableName}")
public class ${name.upperCamel}Entity {
#foreach ($field in $fields)
/**
* $field.columnComment
*/
#if($field.primaryKeyFlag && $field.autoIncreaseFlag)
@TableId(type = IdType.AUTO)
#end
#if($field.primaryKeyFlag && !$field.autoIncreaseFlag)
@TableId
#end
#if($field.columnName == "create_time")
@TableField(fill = FieldFill.INSERT)
#end
#if($field.columnName == "update_time")
@TableField(fill = FieldFill.INSERT_UPDATE)
#end
private $field.javaType $field.fieldName;
#end
}

View File

@@ -0,0 +1,30 @@
package ${packageName};
#foreach ($importClass in $importPackageList)
$importClass
#end
/**
* ${basic.description} 新建表单
*
* @Author ${basic.backendAuthor}
* @Date ${basic.backendDate}
* @Copyright ${basic.copyright}
*/
@Data
public class ${name.upperCamel}AddForm {
#foreach ($field in $fields)
#if($field.isEnum)
${field.apiModelProperty}
${field.checkEnum}
private $field.javaType $field.fieldName;
#end
#if(!$field.isEnum)
${field.apiModelProperty}$!{field.notEmpty}$!{field.dict}$!{field.file}
private $field.javaType $field.fieldName;
#end
#end
}

View File

@@ -0,0 +1,39 @@
package ${packageName};
import online.junmowen.blog.base.common.domain.PageParam;
#foreach ($importClass in $importPackageList)
$importClass
#end
/**
* ${basic.description} 分页查询表单
*
* @Author ${basic.backendAuthor}
* @Date ${basic.backendDate}
* @Copyright ${basic.copyright}
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class ${name.upperCamel}QueryForm extends PageParam {
#foreach ($field in $fields)
#if($field.isEnum)
${field.apiModelProperty}
${field.checkEnum}
private $field.javaType $field.fieldName;
#end
#if(!$field.isEnum && $field.queryTypeEnum != "DateRange")
${field.apiModelProperty}$!{field.dict}
private $field.javaType $field.fieldName;
#end
#if(!$field.isEnum && $field.queryTypeEnum == "DateRange")
${field.apiModelProperty}
private $field.javaType ${field.fieldName}Begin;
${field.apiModelProperty}
private $field.javaType ${field.fieldName}End;
#end
#end
}

View File

@@ -0,0 +1,30 @@
package ${packageName};
#foreach ($importClass in $importPackageList)
$importClass
#end
/**
* ${basic.description} 更新表单
*
* @Author ${basic.backendAuthor}
* @Date ${basic.backendDate}
* @Copyright ${basic.copyright}
*/
@Data
public class ${name.upperCamel}UpdateForm {
#foreach ($field in $fields)
#if($field.isEnum)
${field.apiModelProperty}
${field.checkEnum}
private $field.javaType $field.fieldName;
#end
#if(!$field.isEnum)
${field.apiModelProperty}$!{field.notEmpty}$!{field.dict}$!{field.file}
private $field.javaType $field.fieldName;
#end
#end
}

View File

@@ -0,0 +1,24 @@
package ${packageName};
#foreach ($importClass in $importPackageList)
$importClass
#end
/**
* ${basic.description} 列表VO
*
* @Author ${basic.backendAuthor}
* @Date ${basic.backendDate}
* @Copyright ${basic.copyright}
*/
@Data
public class ${name.upperCamel}VO {
#foreach ($field in $fields)
${field.apiModelProperty}$!{field.notEmpty}$!{field.file}
private $field.javaType $field.fieldName;
#end
}

View File

@@ -0,0 +1,21 @@
package ${packageName};
#foreach ($importClass in $importPackageList)
$importClass
#end
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* ${basic.description} Manager
*
* @Author ${basic.backendAuthor}
* @Date ${basic.backendDate}
* @Copyright ${basic.copyright}
*/
@Service
public class ${name.upperCamel}Manager extends ServiceImpl<${name.upperCamel}Dao, ${name.upperCamel}Entity> {
}

View File

@@ -0,0 +1,76 @@
<?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="${daoClassName}">
<!-- 查询结果列 -->
<sql id="base_columns">
#foreach ($field in $fields)
${tableName}.${field.columnName}#if($foreach.hasNext),#end
#end
</sql>
<!-- 分页查询 -->
<select id="queryPage" resultType="${basic.javaPackageName}.domain.vo.${name.upperCamel}VO">
SELECT
<include refid="base_columns"/>
FROM ${tableName}
#if($queryFields.size() > 0)
<where>
#foreach ($queryField in $queryFields)
<!--${queryField.label}-->
#if(${queryField.queryTypeEnum} == "Like")
<if test="queryForm.${queryField.fieldName} != null and queryForm.${queryField.fieldName} != ''">
${queryField.likeStr}
</if>
#end
#if(${queryField.queryTypeEnum} == "Dict")
<if test="queryForm.${queryField.fieldName} != null and queryForm.${queryField.fieldName} != ''">
${queryField.likeStr}
</if>
#end
#if(${queryField.queryTypeEnum} == "Equal" || ${queryField.queryTypeEnum} == "Enum")
<if test="queryForm.${queryField.fieldName} != null">
AND ${tableName}.${queryField.columnName} = #{queryForm.${queryField.fieldName}}
</if>
#end
#if(${queryField.queryTypeEnum} == "Date")
<if test="queryForm.${queryField.fieldName} != null">
AND ${tableName}.${queryField.columnName} = #{queryForm.${queryField.fieldName}}
</if>
#end
#if(${queryField.queryTypeEnum} == "DateRange")
<if test="queryForm.${queryField.fieldName}Begin != null">
AND ${tableName}.${queryField.columnName} &gt;= #{queryForm.${queryField.fieldName}Begin}
</if>
<if test="queryForm.${queryField.fieldName}End != null">
AND ${tableName}.${queryField.columnName} &lt;= #{queryForm.${queryField.fieldName}End}
</if>
#end
#end
</where>
#end
</select>
#if($deleteInfo.isSupportDelete)
### 假删除
#if(!${deleteInfo.isPhysicallyDeleted})
#if($deleteInfo.deleteEnum == "Batch" || $deleteInfo.deleteEnum == "SingleAndBatch")
<update id="batchUpdateDeleted">
update ${tableName} set deleted_flag = #{deletedFlag}
where ${primaryKeyColumnName} in
<foreach collection="idList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</update>
#end
#if($deleteInfo.deleteEnum == "Single" || $deleteInfo.deleteEnum == "SingleAndBatch")
<update id="updateDeleted">
update ${tableName} set deleted_flag = #{deletedFlag}
where ${primaryKeyColumnName} = #{${primaryKeyFieldName}}
</update>
#end
#end
#end
</mapper>

View File

@@ -0,0 +1,99 @@
package ${packageName};
#foreach ($importClass in $importPackageList)
$importClass
#end
import online.junmowen.blog.base.common.util.SmartBeanUtil;
import online.junmowen.blog.base.common.util.SmartPageUtil;
import online.junmowen.blog.base.common.domain.ResponseDTO;
import online.junmowen.blog.base.common.domain.PageResult;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.collections4.CollectionUtils;
import jakarta.annotation.Resource;
/**
* ${basic.description} Service
*
* @Author ${basic.backendAuthor}
* @Date ${basic.backendDate}
* @Copyright ${basic.copyright}
*/
@Service
public class ${name.upperCamel}Service {
@Resource
private ${name.upperCamel}Dao ${name.lowerCamel}Dao;
/**
* 分页查询
*/
public PageResult<${name.upperCamel}VO> queryPage(${name.upperCamel}QueryForm queryForm) {
Page<?> page = SmartPageUtil.convert2PageQuery(queryForm);
List<${name.upperCamel}VO> list = ${name.lowerCamel}Dao.queryPage(page, queryForm);
return SmartPageUtil.convert2PageResult(page, list);
}
#if($insertAndUpdate.isSupportInsertAndUpdate)
/**
* 添加
*/
public ResponseDTO<String> add(${name.upperCamel}AddForm addForm) {
${name.upperCamel}Entity ${name.lowerCamel}Entity = SmartBeanUtil.copy(addForm, ${name.upperCamel}Entity.class);
${name.lowerCamel}Dao.insert(${name.lowerCamel}Entity);
return ResponseDTO.ok();
}
/**
* 更新
*
*/
public ResponseDTO<String> update(${name.upperCamel}UpdateForm updateForm) {
${name.upperCamel}Entity ${name.lowerCamel}Entity = SmartBeanUtil.copy(updateForm, ${name.upperCamel}Entity.class);
${name.lowerCamel}Dao.updateById(${name.lowerCamel}Entity);
return ResponseDTO.ok();
}
#end
#if($deleteInfo.isSupportDelete)
#if($deleteInfo.deleteEnum == "Batch" || $deleteInfo.deleteEnum == "SingleAndBatch")
/**
* 批量删除
*/
public ResponseDTO<String> batchDelete(List<${primaryKeyJavaType}> idList) {
if (CollectionUtils.isEmpty(idList)){
return ResponseDTO.ok();
}
### 真删除 or 假删除
#if(!${deleteInfo.isPhysicallyDeleted})
${name.lowerCamel}Dao.batchUpdateDeleted(idList, true);
#else
${name.lowerCamel}Dao.deleteBatchIds(idList);
#end
return ResponseDTO.ok();
}
#end
#if($deleteInfo.deleteEnum == "Single" || $deleteInfo.deleteEnum == "SingleAndBatch")
/**
* 单个删除
*/
public ResponseDTO<String> delete(${primaryKeyJavaType} ${primaryKeyFieldName}) {
if (null == ${primaryKeyFieldName}){
return ResponseDTO.ok();
}
### 真删除 or 假删除
#if(!${deleteInfo.isPhysicallyDeleted})
${name.lowerCamel}Dao.updateDeleted(${primaryKeyFieldName}, true);
#end
#if(${deleteInfo.isPhysicallyDeleted})
${name.lowerCamel}Dao.deleteById(${primaryKeyFieldName});
#end
return ResponseDTO.ok();
}
#end
#end
}

View File

@@ -0,0 +1,22 @@
# 默认是按前端工程文件的 /views/business 文件夹的路径作为前端组件路径,如果你没把生成的 .vue 前端代码放在 /views/business 下,
# 那就根据自己实际情况修改下面 SQL 的 path,component 字段值,避免执行 SQL 后菜单无法访问。
# 如果你一切都是按照默认,那么下面的 SQL 基本不用改
INSERT INTO t_menu ( menu_name, menu_type, parent_id, path, component, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, create_user_id )
VALUES ( '${basic.description}', 2, 0, '/${name.lowerHyphenCamel}/list', '/business/${name.lowerHyphenCamel}/${name.lowerHyphenCamel}-list.vue', false, false, true, false, 1, 1 );
# 按菜单名称查询该菜单的 menu_id 作为按钮权限的 父菜单ID 与 功能点关联菜单ID
SET @parent_id = NULL;
SELECT t_menu.menu_id INTO @parent_id FROM t_menu WHERE t_menu.menu_name = '${basic.description}';
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, api_perms, web_perms, context_menu_id, create_user_id )
VALUES ( '查询', 3, @parent_id, false, false, true, false, 1, '${name.lowerCamel}:query', '${name.lowerCamel}:query', @parent_id, 1 );
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, api_perms, web_perms, context_menu_id, create_user_id )
VALUES ( '添加', 3, @parent_id, false, false, true, false, 1, '${name.lowerCamel}:add', '${name.lowerCamel}:add', @parent_id, 1 );
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, api_perms, web_perms, context_menu_id, create_user_id )
VALUES ( '更新', 3, @parent_id, false, false, true, false, 1, '${name.lowerCamel}:update', '${name.lowerCamel}:update', @parent_id, 1 );
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, api_perms, web_perms, context_menu_id, create_user_id )
VALUES ( '删除', 3, @parent_id, false, false, true, false, 1, '${name.lowerCamel}:delete', '${name.lowerCamel}:delete', @parent_id, 1 );

View File

@@ -0,0 +1,78 @@
/**
* ${basic.description} api 封装
*
* @Author: ${basic.frontAuthor}
* @Date: ${basic.frontDate}
* @Copyright ${basic.copyright}
*/
import { postRequest, getRequest } from '/@/lib/axios';
export const ${name.lowerCamel}Api = {
/**
* 分页查询 @author ${basic.frontAuthor}
*/
queryPage : (param) => {
return postRequest('/${name.lowerCamel}/queryPage', param);
},
/**
* 增加 @author ${basic.frontAuthor}
*/
add: (param) => {
return postRequest('/${name.lowerCamel}/add', param);
},
/**
* 修改 @author ${basic.frontAuthor}
*/
update: (param) => {
return postRequest('/${name.lowerCamel}/update', param);
},
## ------------------ 详情 ------------------
#if($deleteInfo.isSupportDetail)
/**
* 获取详情 @author ${basic.frontAuthor}
*/
getDetail: (id) => {
return getRequest(`/${name.lowerCamel}/getDetail/\${id}`);
},
#end
## ------------------ 删除 ------------------
#if($deleteInfo.isSupportDelete)
#if($deleteInfo.deleteEnum == 'Single')
/**
* 删除 @author ${basic.frontAuthor}
*/
delete: (id) => {
return getRequest(`/${name.lowerCamel}/delete/${id}`);
},
#end
#if($deleteInfo.deleteEnum == 'Batch')
/**
* 批量删除 @author ${basic.frontAuthor}
*/
batchDelete: (idList) => {
return postRequest('/${name.lowerCamel}/batchDelete', idList);
},
#end
#if($deleteInfo.deleteEnum == 'SingleAndBatch')
/**
* 删除 @author ${basic.frontAuthor}
*/
delete: (id) => {
return getRequest(`/${name.lowerCamel}/delete/${id}`);
},
/**
* 批量删除 @author ${basic.frontAuthor}
*/
batchDelete: (idList) => {
return postRequest('/${name.lowerCamel}/batchDelete', idList);
},
#end
#end
};

View File

@@ -0,0 +1,23 @@
/**
* ${basic.description} 枚举
*
* @Author: ${basic.frontAuthor}
* @Date: ${basic.frontDate}
* @Copyright ${basic.copyright}
*/
#foreach ($enum in $enumList)
/**
* $enum.columnComment
*/
export const $enum.upperUnderscoreEnum = {
}
#end
export default {
#foreach ($enum in $enumList)
$enum.upperUnderscoreEnum,
#end
};

View File

@@ -0,0 +1,239 @@
<!--
* ${basic.description}
*
* @Author: ${basic.frontAuthor}
* @Date: ${basic.frontDate}
* @Copyright ${basic.copyright}
-->
<template>
<a-$!{insertAndUpdate.pageType}
:title="form.$!{primaryKeyFieldName} ? '编辑' : '添加'"
:width="$!{insertAndUpdate.width}"
:open="visibleFlag"
#if($!{insertAndUpdate.pageType} == 'drawer')
@close="onClose"
#else
@cancel="onClose"
#end
:maskClosable="false"
:destroyOnClose="true"
>
<a-form ref="formRef" :model="form" :rules="rules" :label-col="{ span: 5 }" >
#if($insertAndUpdate.countPerLine == 1)
#foreach ($field in $formFields)
#if($field.frontComponent == "Input")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-input style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "InputNumber")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-input-number style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "Textarea")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-textarea style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "BooleanSelect")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<BooleanSelect v-model:value="form.${field.fieldName}" style="width: 100%" />
</a-form-item>
#end
#if($field.frontComponent == "SmartEnumSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<SmartEnumSelect width="100%" v-model:value="form.${field.fieldName}" enum-name="$!{field.upperUnderscoreEnum}" placeholder="$codeGeneratorTool.removeEnumDesc($!{field.label})"/>
</a-form-item>
#end
#if($field.frontComponent == "DictSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<DictSelect width="100%" v-model:value="form.${field.fieldName}" :dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" placeholder="$!{field.label}"/>
</a-form-item>
#end
#if($field.frontComponent == "Date")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-date-picker valueFormat="YYYY-MM-DD" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}"/>
</a-form-item>
#end
#if($field.frontComponent == "DateTime")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-date-picker show-time valueFormat="YYYY-MM-DD HH:mm:ss" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "FileUpload")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<FileUpload
:defaultFileList="form.$!{field.fieldName}"
:folder="FILE_FOLDER_TYPE_ENUM.COMMON.value"
buttonText="上传 $!{field.label}"
listType="text"
@change="e => form.$!{field.fieldName} = e"
/>
</a-form-item>
#end
#end
#end
#if($insertAndUpdate.countPerLine > 1)
<a-row>
#set($span=24 / $!insertAndUpdate.countPerLine )
#foreach ($field in $formFields)
<a-col :span="$!{span}">
#if($field.frontComponent == "Input")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-input style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "InputNumber")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-input-number style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "Textarea")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-textarea style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "BooleanSelect")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<BooleanSelect v-model:value="form.${field.fieldName}" style="width: 100%" />
</a-form-item>
#end
#if($field.frontComponent == "SmartEnumSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<SmartEnumSelect width="100%" v-model:value="form.${field.fieldName}" enum-name="$!{field.upperUnderscoreEnum}" placeholder="$codeGeneratorTool.removeEnumDesc($!{field.label})"/>
</a-form-item>
#end
#if($field.frontComponent == "DictSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<DictSelect width="100%" v-model:value="form.${field.fieldName}" :dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" placeholder="$!{field.label}"/>
</a-form-item>
#end
#if($field.frontComponent == "Date")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-date-picker valueFormat="YYYY-MM-DD" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}"/>
</a-form-item>
#end
#if($field.frontComponent == "DateTime")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-date-picker show-time valueFormat="YYYY-MM-DD HH:mm:ss" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "FileUpload")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<FileUpload
:defaultFileList="form.$!{field.fieldName}"
:folder="FILE_FOLDER_TYPE_ENUM.COMMON.value"
buttonText="上传 $!{field.label}"
listType="text"
@change="e => form.$!{field.fieldName} = e"
/>
</a-form-item>
#end
</a-col>
#end
</a-row>
#end
</a-form>
<template #footer>
<a-space>
<a-button @click="onClose">取消</a-button>
<a-button type="primary" @click="onSubmit">保存</a-button>
</a-space>
</template>
</a-$!{insertAndUpdate.pageType}>
</template>
<script setup>
import { reactive, ref, nextTick } from 'vue';
import _ from 'lodash';
import { message } from 'ant-design-vue';
import { SmartLoading } from '/@/components/framework/smart-loading';
import { $!{name.lowerCamel}Api } from '/@/api/business/$!{name.lowerHyphenCamel}/$!{name.lowerHyphenCamel}-api';
import { smartSentry } from '/@/lib/smart-sentry';
#foreach ($import in $frontImportList)
$!{import}
#end
// ------------------------ 事件 ------------------------
const emits = defineEmits(['reloadList']);
// ------------------------ 显示与隐藏 ------------------------
// 是否显示
const visibleFlag = ref(false);
function show(rowData) {
Object.assign(form, formDefault);
if (rowData && !_.isEmpty(rowData)) {
Object.assign(form, rowData);
}
// 使用字典时把下面这注释修改成自己的字典字段 有多个字典字段就复制多份同理修改 不然打开表单时不显示字典初始值
// if (form.status && form.status.length > 0) {
// form.status = form.status.map((e) => e.valueCode);
// }
visibleFlag.value = true;
nextTick(() => {
formRef.value.clearValidate();
});
}
function onClose() {
Object.assign(form, formDefault);
visibleFlag.value = false;
}
// ------------------------ 表单 ------------------------
// 组件ref
const formRef = ref();
const formDefault = {
#foreach ($field in $formFields)
$!{field.fieldName}: undefined, //$!{field.label}
#end
};
let form = reactive({ ...formDefault });
const rules = {
#foreach ($field in $formFields)
#if($field.requiredFlag)
$!{field.fieldName}: [{ required: true, message: '$!{field.label} 必填' }],
#end
#end
};
// 点击确定,验证表单
async function onSubmit() {
try {
await formRef.value.validateFields();
save();
} catch (err) {
message.error('参数验证错误,请仔细填写表单数据!');
}
}
// 新建、编辑API
async function save() {
SmartLoading.show();
try {
if (form.$!{primaryKeyFieldName}) {
await $!{name.lowerCamel}Api.update(form);
} else {
await $!{name.lowerCamel}Api.add(form);
}
message.success('操作成功');
emits('reloadList');
onClose();
} catch (err) {
smartSentry.captureError(err);
} finally {
SmartLoading.hide();
}
}
defineExpose({
show,
});
</script>

View File

@@ -0,0 +1,348 @@
<!--
* ${basic.description}
*
* @Author: ${basic.frontAuthor}
* @Date: ${basic.frontDate}
* @Copyright ${basic.copyright}
-->
<template>
<!---------- 查询表单form begin ----------->
<a-form class="smart-query-form">
<a-row class="smart-query-form-row">
#foreach ($field in $queryFields)
#if($field.queryTypeEnum == "Like")
<a-form-item label="${field.label}" class="smart-query-form-item">
<a-input style="width: ${field.width}" v-model:value="queryForm.${field.fieldName}" placeholder="${field.label}" />
</a-form-item>
#end
#if($field.queryTypeEnum == "Equal")
<a-form-item label="${field.label}" class="smart-query-form-item">
<a-input style="width: ${field.width}" v-model:value="queryForm.${field.fieldName}" placeholder="${field.label}" />
</a-form-item>
#end
#if($field.queryTypeEnum == "Dict")
<a-form-item label="${field.label}" class="smart-query-form-item">
<DictSelect :dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" placeholder="${field.label}" v-model:value="queryForm.${field.fieldName}" width="${field.width}" />
</a-form-item>
#end
#if($field.queryTypeEnum == "Enum")
<a-form-item label="$codeGeneratorTool.removeEnumDesc(${field.label})" class="smart-query-form-item">
<SmartEnumSelect width="${field.width}" v-model:value="queryForm.${field.fieldName}" enum-name="$!{field.frontEnumName}" placeholder="$codeGeneratorTool.removeEnumDesc(${field.label})"/>
</a-form-item>
#end
#if($field.queryTypeEnum == "Date")
<a-form-item label="${field.label}" class="smart-query-form-item">
<a-date-picker valueFormat="YYYY-MM-DD" v-model:value="queryForm.$!{field.fieldName}" style="width: ${field.width}" />
</a-form-item>
#end
#if($field.queryTypeEnum == "DateRange")
<a-form-item label="${field.label}" class="smart-query-form-item">
<a-range-picker v-model:value="queryForm.$!{field.fieldName}" :presets="defaultTimeRanges" style="width: ${field.width}" @change="onChange$codeGeneratorTool.lowerCamel2UpperCamel(${field.fieldName})" />
</a-form-item>
#end
#end
<a-form-item class="smart-query-form-item">
<a-button type="primary" @click="onSearch">
<template #icon>
<SearchOutlined />
</template>
查询
</a-button>
<a-button @click="resetQuery" class="smart-margin-left10">
<template #icon>
<ReloadOutlined />
</template>
重置
</a-button>
</a-form-item>
</a-row>
</a-form>
<!---------- 查询表单form end ----------->
<a-card size="small" :bordered="false" :hoverable="true">
<!---------- 表格操作行 begin ----------->
<a-row class="smart-table-btn-block">
<div class="smart-table-operate-block">
#if($insertAndUpdate.isSupportInsertAndUpdate)
<a-button @click="showForm" type="primary" size="small">
<template #icon>
<PlusOutlined />
</template>
新建
</a-button>
#end
#if($deleteInfo.isSupportDelete && ($deleteInfo.deleteEnum == "Batch"||$deleteInfo.deleteEnum == "SingleAndBatch"))
<a-button @click="confirmBatchDelete" type="primary" danger size="small" :disabled="selectedRowKeyList.length == 0">
<template #icon>
<DeleteOutlined />
</template>
批量删除
</a-button>
#end
</div>
<div class="smart-table-setting-block">
<TableOperator v-model="columns" :tableId="null" :refresh="queryData" />
</div>
</a-row>
<!---------- 表格操作行 end ----------->
<!---------- 表格 begin ----------->
<a-table
size="small"
:scroll="{ y: 800 }"
:dataSource="tableData"
:columns="columns"
rowKey="$!{primaryKeyFieldName}"
bordered
:loading="tableLoading"
:pagination="false"
#if($deleteInfo.isSupportDelete && ($deleteInfo.deleteEnum == "Batch"||$deleteInfo.deleteEnum == "SingleAndBatch"))
:row-selection="{ selectedRowKeys: selectedRowKeyList, onChange: onSelectChange }"
#end
>
<template #bodyCell="{ text, record, column }">
#foreach ($field in $listFields)
#if($field.frontComponent == "FileUpload")
<template v-if="column.dataIndex === '$field.fieldName'">
<FilePreview :file-list="text" type="picture" />
</template>
#end
#end
#foreach ($field in $listFields)
#if($field.frontEnumPlugin)
<template v-if="column.dataIndex === '$!{field.fieldName}'">
<span>{{ $!{field.frontEnumPlugin} }}</span>
</template>
#end
#end
#foreach ($field in $listFields)
#if($field.dict)
<template v-if="column.dataIndex === '$!{field.fieldName}'">
<DictLabel :dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" :data-value="text" />
</template>
#end
#end
<template v-if="column.dataIndex === 'action'">
<div class="smart-table-operate">
#if($insertAndUpdate.isSupportInsertAndUpdate)
<a-button @click="showForm(record)" type="link">编辑</a-button>
#end
#if($deleteInfo.isSupportDelete && ($deleteInfo.deleteEnum == "Single"||$deleteInfo.deleteEnum == "SingleAndBatch"))
<a-button @click="onDelete(record)" danger type="link">删除</a-button>
#end
</div>
</template>
</template>
</a-table>
<!---------- 表格 end ----------->
<div class="smart-query-table-page">
<a-pagination
showSizeChanger
showQuickJumper
show-less-items
:pageSizeOptions="PAGE_SIZE_OPTIONS"
:defaultPageSize="queryForm.pageSize"
v-model:current="queryForm.pageNum"
v-model:pageSize="queryForm.pageSize"
:total="total"
@change="queryData"
@showSizeChange="queryData"
:show-total="(total) => `共${total}条`"
/>
</div>
<$!{name.upperCamel}Form ref="formRef" @reloadList="queryData"/>
</a-card>
</template>
<script setup>
import { reactive, ref, onMounted } from 'vue';
import { message, Modal } from 'ant-design-vue';
import { SmartLoading } from '/@/components/framework/smart-loading';
import { $!{name.lowerCamel}Api } from '/@/api/business/$!{name.lowerHyphenCamel}/$!{name.lowerHyphenCamel}-api';
import { PAGE_SIZE_OPTIONS } from '/@/constants/common-const';
import { smartSentry } from '/@/lib/smart-sentry';
import TableOperator from '/@/components/support/table-operator/index.vue';
#foreach ($import in $frontImportList)
$!{import}
#end
// ---------------------------- 表格列 ----------------------------
const columns = ref([
#foreach ($field in $tableFields)
#if($field.showFlag)
{
title: '$!{field.label}',
dataIndex: '$!{field.fieldName}',
ellipsis: $!{field.ellipsisFlag},
#if(${field.width} > 0)
width: $!{field.width},
#end
},
#end
#end
#if($insertAndUpdate.isSupportInsertAndUpdate || $insertAndUpdate.isSupportInsertAndUpdate)
{
title: '操作',
dataIndex: 'action',
fixed: 'right',
width: 90,
},
#end
]);
// ---------------------------- 查询数据表单和方法 ----------------------------
const queryFormState = {
#foreach ($field in $queryFields)
#if($field.queryTypeEnum == "DateRange")
$!{field.fieldName}: [], //$!{field.label}
$!{field.fieldName}Begin: undefined, //$!{field.label} 开始
$!{field.fieldName}End: undefined, //$!{field.label} 结束
#end
#if($field.queryTypeEnum != "DateRange")
$!{field.fieldName}: undefined, //$!{field.label}
#end
#end
pageNum: 1,
pageSize: 10,
};
// 查询表单form
const queryForm = reactive({ ...queryFormState });
// 表格加载loading
const tableLoading = ref(false);
// 表格数据
const tableData = ref([]);
// 总数
const total = ref(0);
// 重置查询条件
function resetQuery() {
let pageSize = queryForm.pageSize;
Object.assign(queryForm, queryFormState);
queryForm.pageSize = pageSize;
queryData();
}
// 搜索
function onSearch(){
queryForm.pageNum = 1;
queryData();
}
// 查询数据
async function queryData() {
tableLoading.value = true;
try {
let queryResult = await $!{name.lowerCamel}Api.queryPage(queryForm);
tableData.value = queryResult.data.list;
total.value = queryResult.data.total;
} catch (e) {
smartSentry.captureError(e);
} finally {
tableLoading.value = false;
}
}
#foreach ($field in $queryFields)
#if($field.queryTypeEnum == "DateRange")
function onChange$codeGeneratorTool.lowerCamel2UpperCamel(${field.fieldName})(dates, dateStrings){
queryForm.$!{field.fieldName}Begin = dateStrings[0];
queryForm.$!{field.fieldName}End = dateStrings[1];
}
#end
#end
onMounted(queryData);
#if($insertAndUpdate.isSupportInsertAndUpdate)
// ---------------------------- 添加/修改 ----------------------------
const formRef = ref();
function showForm(data) {
formRef.value.show(data);
}
#end
#if($deleteInfo.isSupportDelete)
#if($deleteInfo.deleteEnum == "Batch" || $deleteInfo.deleteEnum == "SingleAndBatch")
// ---------------------------- 单个删除 ----------------------------
//确认删除
function onDelete(data){
Modal.confirm({
title: '提示',
content: '确定要删除选吗?',
okText: '删除',
okType: 'danger',
onOk() {
requestDelete(data);
},
cancelText: '取消',
onCancel() {},
});
}
//请求删除
async function requestDelete(data){
SmartLoading.show();
try {
let deleteForm = {
goodsIdList: selectedRowKeyList.value,
};
await $!{name.lowerCamel}Api.delete(data.$!{primaryKeyFieldName});
message.success('删除成功');
queryData();
} catch (e) {
smartSentry.captureError(e);
} finally {
SmartLoading.hide();
}
}
#end
#if($deleteInfo.deleteEnum == "Single" || $deleteInfo.deleteEnum == "SingleAndBatch")
// ---------------------------- 批量删除 ----------------------------
// 选择表格行
const selectedRowKeyList = ref([]);
function onSelectChange(selectedRowKeys) {
selectedRowKeyList.value = selectedRowKeys;
}
// 批量删除
function confirmBatchDelete() {
Modal.confirm({
title: '提示',
content: '确定要批量删除这些数据吗?',
okText: '删除',
okType: 'danger',
onOk() {
requestBatchDelete();
},
cancelText: '取消',
onCancel() {},
});
}
//请求批量删除
async function requestBatchDelete() {
try {
SmartLoading.show();
await $!{name.lowerCamel}Api.batchDelete(selectedRowKeyList.value);
message.success('删除成功');
queryData();
} catch (e) {
smartSentry.captureError(e);
} finally {
SmartLoading.hide();
}
}
#end
#end
</script>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<tools>
<toolbox scope="application">
<tool key="codeGeneratorTool" class="online.junmowen.blog.base.module.support.codegenerator.util.CodeGeneratorTool"></tool>
</toolbox>
</tools>

View File

@@ -0,0 +1,78 @@
/**
* ${basic.description} api 封装
*
* @Author: ${basic.frontAuthor}
* @Date: ${basic.frontDate}
* @Copyright ${basic.copyright}
*/
import { postRequest, getRequest } from '/@/lib/axios';
export const ${name.lowerCamel}Api = {
/**
* 分页查询 @author ${basic.frontAuthor}
*/
queryPage : (param) => {
return postRequest('/${name.lowerCamel}/queryPage', param);
},
/**
* 增加 @author ${basic.frontAuthor}
*/
add: (param) => {
return postRequest('/${name.lowerCamel}/add', param);
},
/**
* 修改 @author ${basic.frontAuthor}
*/
update: (param) => {
return postRequest('/${name.lowerCamel}/update', param);
},
## ------------------ 详情 ------------------
#if($deleteInfo.isSupportDetail)
/**
* 获取详情 @author ${basic.frontAuthor}
*/
getDetail: (id) => {
return getRequest(`/${name.lowerCamel}/getDetail/\${id}`);
},
#end
## ------------------ 删除 ------------------
#if($deleteInfo.isSupportDelete)
#if($deleteInfo.deleteEnum == 'Single')
/**
* 删除 @author ${basic.frontAuthor}
*/
delete: (id) => {
return getRequest(`/${name.lowerCamel}/delete/${id}`);
},
#end
#if($deleteInfo.deleteEnum == 'Batch')
/**
* 批量删除 @author ${basic.frontAuthor}
*/
batchDelete: (idList) => {
return postRequest('/${name.lowerCamel}/batchDelete', idList);
},
#end
#if($deleteInfo.deleteEnum == 'SingleAndBatch')
/**
* 删除 @author ${basic.frontAuthor}
*/
delete: (id) => {
return getRequest(`/${name.lowerCamel}/delete/${id}`);
},
/**
* 批量删除 @author ${basic.frontAuthor}
*/
batchDelete: (idList) => {
return postRequest('/${name.lowerCamel}/batchDelete', idList);
},
#end
#end
};

View File

@@ -0,0 +1,23 @@
/**
* ${basic.description} 枚举
*
* @Author: ${basic.frontAuthor}
* @Date: ${basic.frontDate}
* @Copyright ${basic.copyright}
*/
#foreach ($enum in $enumList)
/**
* $enum.columnComment
*/
export const $enum.upperUnderscoreEnum = {
}
#end
export default {
#foreach ($enum in $enumList)
$enum.upperUnderscoreEnum,
#end
};

View File

@@ -0,0 +1,239 @@
<!--
* ${basic.description}
*
* @Author: ${basic.frontAuthor}
* @Date: ${basic.frontDate}
* @Copyright ${basic.copyright}
-->
<template>
<a-$!{insertAndUpdate.pageType}
:title="form.$!{primaryKeyFieldName} ? '编辑' : '添加'"
:width="$!{insertAndUpdate.width}"
:open="visibleFlag"
#if($!{insertAndUpdate.pageType} == 'drawer')
@close="onClose"
#else
@cancel="onClose"
#end
:maskClosable="false"
:destroyOnClose="true"
>
<a-form ref="formRef" :model="form" :rules="rules" :label-col="{ span: 5 }" >
#if($insertAndUpdate.countPerLine == 1)
#foreach ($field in $formFields)
#if($field.frontComponent == "Input")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-input style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "InputNumber")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-input-number style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "Textarea")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-textarea style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "BooleanSelect")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<BooleanSelect v-model:value="form.${field.fieldName}" style="width: 100%" />
</a-form-item>
#end
#if($field.frontComponent == "SmartEnumSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<SmartEnumSelect width="100%" v-model:value="form.${field.fieldName}" enum-name="$!{field.upperUnderscoreEnum}" placeholder="$codeGeneratorTool.removeEnumDesc($!{field.label})"/>
</a-form-item>
#end
#if($field.frontComponent == "DictSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<DictSelect width="100%" v-model:value="form.${field.fieldName}" :dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" placeholder="$!{field.label}"/>
</a-form-item>
#end
#if($field.frontComponent == "Date")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-date-picker valueFormat="YYYY-MM-DD" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}"/>
</a-form-item>
#end
#if($field.frontComponent == "DateTime")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-date-picker show-time valueFormat="YYYY-MM-DD HH:mm:ss" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "FileUpload")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<FileUpload
:defaultFileList="form.$!{field.fieldName}"
:folder="FILE_FOLDER_TYPE_ENUM.COMMON.value"
buttonText="上传 $!{field.label}"
listType="text"
@change="e => form.$!{field.fieldName} = e"
/>
</a-form-item>
#end
#end
#end
#if($insertAndUpdate.countPerLine > 1)
<a-row>
#set($span=24 / $!insertAndUpdate.countPerLine )
#foreach ($field in $formFields)
<a-col :span="$!{span}">
#if($field.frontComponent == "Input")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-input style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "InputNumber")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-input-number style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "Textarea")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-textarea style="width: 100%" v-model:value="form.${field.fieldName}" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "BooleanSelect")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<BooleanSelect v-model:value="form.${field.fieldName}" style="width: 100%" />
</a-form-item>
#end
#if($field.frontComponent == "SmartEnumSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<SmartEnumSelect width="100%" v-model:value="form.${field.fieldName}" enum-name="$!{field.upperUnderscoreEnum}" placeholder="$codeGeneratorTool.removeEnumDesc($!{field.label})"/>
</a-form-item>
#end
#if($field.frontComponent == "DictSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<DictSelect width="100%" v-model:value="form.${field.fieldName}" :dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" placeholder="$!{field.label}"/>
</a-form-item>
#end
#if($field.frontComponent == "Date")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-date-picker valueFormat="YYYY-MM-DD" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}"/>
</a-form-item>
#end
#if($field.frontComponent == "DateTime")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<a-date-picker show-time valueFormat="YYYY-MM-DD HH:mm:ss" v-model:value="form.$!{field.fieldName}" style="width: 100%" placeholder="$!{field.label}" />
</a-form-item>
#end
#if($field.frontComponent == "FileUpload")
<a-form-item label="$!{field.label}" name="${field.fieldName}">
<FileUpload
:defaultFileList="form.$!{field.fieldName}"
:folder="FILE_FOLDER_TYPE_ENUM.COMMON.value"
buttonText="上传 $!{field.label}"
listType="text"
@change="e => form.$!{field.fieldName} = e"
/>
</a-form-item>
#end
</a-col>
#end
</a-row>
#end
</a-form>
<template #footer>
<a-space>
<a-button @click="onClose">取消</a-button>
<a-button type="primary" @click="onSubmit">保存</a-button>
</a-space>
</template>
</a-$!{insertAndUpdate.pageType}>
</template>
<script setup lang="ts">
import { reactive, ref, nextTick } from 'vue';
import _ from 'lodash';
import { message } from 'ant-design-vue';
import { SmartLoading } from '/@/components/framework/smart-loading';
import { $!{name.lowerCamel}Api } from '/@/api/business/$!{name.lowerHyphenCamel}/$!{name.lowerHyphenCamel}-api';
import { smartSentry } from '/@/lib/smart-sentry';
#foreach ($import in $frontImportList)
$!{import}
#end
// ------------------------ 事件 ------------------------
const emits = defineEmits(['reloadList']);
// ------------------------ 显示与隐藏 ------------------------
// 是否显示
const visibleFlag = ref(false);
function show(rowData) {
Object.assign(form, formDefault);
if (rowData && !_.isEmpty(rowData)) {
Object.assign(form, rowData);
}
// 使用字典时把下面这注释修改成自己的字典字段 有多个字典字段就复制多份同理修改 不然打开表单时不显示字典初始值
// if (form.status && form.status.length > 0) {
// form.status = form.status.map((e) => e.valueCode);
// }
visibleFlag.value = true;
nextTick(() => {
formRef.value.clearValidate();
});
}
function onClose() {
Object.assign(form, formDefault);
visibleFlag.value = false;
}
// ------------------------ 表单 ------------------------
// 组件ref
const formRef = ref();
const formDefault = {
#foreach ($field in $formFields)
$!{field.fieldName}: undefined, //$!{field.label}
#end
};
let form = reactive({ ...formDefault });
const rules = {
#foreach ($field in $formFields)
#if($field.requiredFlag)
$!{field.fieldName}: [{ required: true, message: '$!{field.label} 必填' }],
#end
#end
};
// 点击确定,验证表单
async function onSubmit() {
try {
await formRef.value.validateFields();
save();
} catch (err) {
message.error('参数验证错误,请仔细填写表单数据!');
}
}
// 新建、编辑API
async function save() {
SmartLoading.show();
try {
if (form.$!{primaryKeyFieldName}) {
await $!{name.lowerCamel}Api.update(form);
} else {
await $!{name.lowerCamel}Api.add(form);
}
message.success('操作成功');
emits('reloadList');
onClose();
} catch (err) {
smartSentry.captureError(err);
} finally {
SmartLoading.hide();
}
}
defineExpose({
show,
});
</script>

View File

@@ -0,0 +1,348 @@
<!--
* ${basic.description}
*
* @Author: ${basic.frontAuthor}
* @Date: ${basic.frontDate}
* @Copyright ${basic.copyright}
-->
<template>
<!---------- 查询表单form begin ----------->
<a-form class="smart-query-form">
<a-row class="smart-query-form-row">
#foreach ($field in $queryFields)
#if($field.queryTypeEnum == "Like")
<a-form-item label="${field.label}" class="smart-query-form-item">
<a-input style="width: ${field.width}" v-model:value="queryForm.${field.fieldName}" placeholder="${field.label}" />
</a-form-item>
#end
#if($field.queryTypeEnum == "Equal")
<a-form-item label="${field.label}" class="smart-query-form-item">
<a-input style="width: ${field.width}" v-model:value="queryForm.${field.fieldName}" placeholder="${field.label}" />
</a-form-item>
#end
#if($field.queryTypeEnum == "Dict")
<a-form-item label="${field.label}" class="smart-query-form-item">
<DictSelect :dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" placeholder="${field.label}" v-model:value="queryForm.${field.fieldName}" width="${field.width}" />
</a-form-item>
#end
#if($field.queryTypeEnum == "Enum")
<a-form-item label="$codeGeneratorTool.removeEnumDesc(${field.label})" class="smart-query-form-item">
<SmartEnumSelect width="${field.width}" v-model:value="queryForm.${field.fieldName}" enum-name="$!{field.frontEnumName}" placeholder="$codeGeneratorTool.removeEnumDesc(${field.label})"/>
</a-form-item>
#end
#if($field.queryTypeEnum == "Date")
<a-form-item label="${field.label}" class="smart-query-form-item">
<a-date-picker valueFormat="YYYY-MM-DD" v-model:value="queryForm.$!{field.fieldName}" style="width: ${field.width}" />
</a-form-item>
#end
#if($field.queryTypeEnum == "DateRange")
<a-form-item label="${field.label}" class="smart-query-form-item">
<a-range-picker v-model:value="queryForm.$!{field.fieldName}" :presets="defaultTimeRanges" style="width: ${field.width}" @change="onChange$codeGeneratorTool.lowerCamel2UpperCamel(${field.fieldName})" />
</a-form-item>
#end
#end
<a-form-item class="smart-query-form-item">
<a-button type="primary" @click="onSearch">
<template #icon>
<SearchOutlined />
</template>
查询
</a-button>
<a-button @click="resetQuery" class="smart-margin-left10">
<template #icon>
<ReloadOutlined />
</template>
重置
</a-button>
</a-form-item>
</a-row>
</a-form>
<!---------- 查询表单form end ----------->
<a-card size="small" :bordered="false" :hoverable="true">
<!---------- 表格操作行 begin ----------->
<a-row class="smart-table-btn-block">
<div class="smart-table-operate-block">
#if($insertAndUpdate.isSupportInsertAndUpdate)
<a-button @click="showForm" type="primary" size="small">
<template #icon>
<PlusOutlined />
</template>
新建
</a-button>
#end
#if($deleteInfo.isSupportDelete && ($deleteInfo.deleteEnum == "Batch"||$deleteInfo.deleteEnum == "SingleAndBatch"))
<a-button @click="confirmBatchDelete" type="primary" danger size="small" :disabled="selectedRowKeyList.length == 0">
<template #icon>
<DeleteOutlined />
</template>
批量删除
</a-button>
#end
</div>
<div class="smart-table-setting-block">
<TableOperator v-model="columns" :tableId="null" :refresh="queryData" />
</div>
</a-row>
<!---------- 表格操作行 end ----------->
<!---------- 表格 begin ----------->
<a-table
size="small"
:scroll="{ y: 800 }"
:dataSource="tableData"
:columns="columns"
rowKey="$!{primaryKeyFieldName}"
bordered
:loading="tableLoading"
:pagination="false"
#if($deleteInfo.isSupportDelete && ($deleteInfo.deleteEnum == "Batch"||$deleteInfo.deleteEnum == "SingleAndBatch"))
:row-selection="{ selectedRowKeys: selectedRowKeyList, onChange: onSelectChange }"
#end
>
<template #bodyCell="{ text, record, column }">
#foreach ($field in $listFields)
#if($field.frontComponent == "FileUpload")
<template v-if="column.dataIndex === '$field.fieldName'">
<FilePreview :file-list="text" type="picture" />
</template>
#end
#end
#foreach ($field in $listFields)
#if($field.frontEnumPlugin)
<template v-if="column.dataIndex === '$!{field.fieldName}'">
<span>{{ $!{field.frontEnumPlugin} }}</span>
</template>
#end
#end
#foreach ($field in $listFields)
#if($field.dict)
<template v-if="column.dataIndex === '$!{field.fieldName}'">
<DictLabel :dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" :data-value="text" />
</template>
#end
#end
<template v-if="column.dataIndex === 'action'">
<div class="smart-table-operate">
#if($insertAndUpdate.isSupportInsertAndUpdate)
<a-button @click="showForm(record)" type="link">编辑</a-button>
#end
#if($deleteInfo.isSupportDelete && ($deleteInfo.deleteEnum == "Single"||$deleteInfo.deleteEnum == "SingleAndBatch"))
<a-button @click="onDelete(record)" danger type="link">删除</a-button>
#end
</div>
</template>
</template>
</a-table>
<!---------- 表格 end ----------->
<div class="smart-query-table-page">
<a-pagination
showSizeChanger
showQuickJumper
show-less-items
:pageSizeOptions="PAGE_SIZE_OPTIONS"
:defaultPageSize="queryForm.pageSize"
v-model:current="queryForm.pageNum"
v-model:pageSize="queryForm.pageSize"
:total="total"
@change="queryData"
@showSizeChange="queryData"
:show-total="(total) => `共${total}条`"
/>
</div>
<$!{name.upperCamel}Form ref="formRef" @reloadList="queryData"/>
</a-card>
</template>
<script setup lang="ts">
import { reactive, ref, onMounted } from 'vue';
import { message, Modal } from 'ant-design-vue';
import { SmartLoading } from '/@/components/framework/smart-loading';
import { $!{name.lowerCamel}Api } from '/@/api/business/$!{name.lowerHyphenCamel}/$!{name.lowerHyphenCamel}-api';
import { PAGE_SIZE_OPTIONS } from '/@/constants/common-const';
import { smartSentry } from '/@/lib/smart-sentry';
import TableOperator from '/@/components/support/table-operator/index.vue';
#foreach ($import in $frontImportList)
$!{import}
#end
// ---------------------------- 表格列 ----------------------------
const columns = ref([
#foreach ($field in $tableFields)
#if($field.showFlag)
{
title: '$!{field.label}',
dataIndex: '$!{field.fieldName}',
ellipsis: $!{field.ellipsisFlag},
#if(${field.width} > 0)
width: $!{field.width},
#end
},
#end
#end
#if($insertAndUpdate.isSupportInsertAndUpdate || $insertAndUpdate.isSupportInsertAndUpdate)
{
title: '操作',
dataIndex: 'action',
fixed: 'right',
width: 90,
},
#end
]);
// ---------------------------- 查询数据表单和方法 ----------------------------
const queryFormState = {
#foreach ($field in $queryFields)
#if($field.queryTypeEnum == "DateRange")
$!{field.fieldName}: [], //$!{field.label}
$!{field.fieldName}Begin: undefined, //$!{field.label} 开始
$!{field.fieldName}End: undefined, //$!{field.label} 结束
#end
#if($field.queryTypeEnum != "DateRange")
$!{field.fieldName}: undefined, //$!{field.label}
#end
#end
pageNum: 1,
pageSize: 10,
};
// 查询表单form
const queryForm = reactive({ ...queryFormState });
// 表格加载loading
const tableLoading = ref(false);
// 表格数据
const tableData = ref([]);
// 总数
const total = ref(0);
// 重置查询条件
function resetQuery() {
let pageSize = queryForm.pageSize;
Object.assign(queryForm, queryFormState);
queryForm.pageSize = pageSize;
queryData();
}
// 搜索
function onSearch(){
queryForm.pageNum = 1;
queryData();
}
// 查询数据
async function queryData() {
tableLoading.value = true;
try {
let queryResult = await $!{name.lowerCamel}Api.queryPage(queryForm);
tableData.value = queryResult.data.list;
total.value = queryResult.data.total;
} catch (e) {
smartSentry.captureError(e);
} finally {
tableLoading.value = false;
}
}
#foreach ($field in $queryFields)
#if($field.queryTypeEnum == "DateRange")
function onChange$codeGeneratorTool.lowerCamel2UpperCamel(${field.fieldName})(dates, dateStrings){
queryForm.$!{field.fieldName}Begin = dateStrings[0];
queryForm.$!{field.fieldName}End = dateStrings[1];
}
#end
#end
onMounted(queryData);
#if($insertAndUpdate.isSupportInsertAndUpdate)
// ---------------------------- 添加/修改 ----------------------------
const formRef = ref();
function showForm(data) {
formRef.value.show(data);
}
#end
#if($deleteInfo.isSupportDelete)
#if($deleteInfo.deleteEnum == "Batch" || $deleteInfo.deleteEnum == "SingleAndBatch")
// ---------------------------- 单个删除 ----------------------------
//确认删除
function onDelete(data){
Modal.confirm({
title: '提示',
content: '确定要删除选吗?',
okText: '删除',
okType: 'danger',
onOk() {
requestDelete(data);
},
cancelText: '取消',
onCancel() {},
});
}
//请求删除
async function requestDelete(data){
SmartLoading.show();
try {
let deleteForm = {
goodsIdList: selectedRowKeyList.value,
};
await $!{name.lowerCamel}Api.delete(data.$!{primaryKeyFieldName});
message.success('删除成功');
queryData();
} catch (e) {
smartSentry.captureError(e);
} finally {
SmartLoading.hide();
}
}
#end
#if($deleteInfo.deleteEnum == "Single" || $deleteInfo.deleteEnum == "SingleAndBatch")
// ---------------------------- 批量删除 ----------------------------
// 选择表格行
const selectedRowKeyList = ref([]);
function onSelectChange(selectedRowKeys) {
selectedRowKeyList.value = selectedRowKeys;
}
// 批量删除
function confirmBatchDelete() {
Modal.confirm({
title: '提示',
content: '确定要批量删除这些数据吗?',
okText: '删除',
okType: 'danger',
onOk() {
requestBatchDelete();
},
cancelText: '取消',
onCancel() {},
});
}
//请求批量删除
async function requestBatchDelete() {
try {
SmartLoading.show();
await $!{name.lowerCamel}Api.batchDelete(selectedRowKeyList.value);
message.success('删除成功');
queryData();
} catch (e) {
smartSentry.captureError(e);
} finally {
SmartLoading.hide();
}
}
#end
#end
</script>

View File

@@ -0,0 +1,188 @@
spring:
# 数据库连接信息
datasource:
url: jdbc:p6spy:mysql://127.0.0.1:3306/mowen-blog?autoReconnect=true&useServerPreparedStmts=false&rewriteBatchedStatements=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username: junmowen
password: junmowen
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
initial-size: 2
min-idle: 2
max-active: 10
max-wait: 60000
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
filters: stat
druid:
username: druid
password: 1024
login:
enabled: false
method:
pointcut: online.junmowen.blog..*Service.*
# redis 连接池配置信息
data:
redis:
database: 2
host: 127.0.0.1
port: 6379
password: junmowen
timeout: 10000ms
lettuce:
pool:
max-active: 5
min-idle: 1
max-idle: 3
max-wait: 30000ms
# 邮件置以SSL的方式发送, 这个需要使用这种方式并且端口是465
mail:
host: smtp.163.com
port: 465
username: lab1024@163.com
password: LAB1024LAB
test-connection: false
properties:
mail:
smtp:
auth: true
ssl:
enable: true
socketFactory:
class: com.sun.mail.util.MailSSLSocketFactory
fallback: false
debug: false
# json序列化相关配置
jackson:
serialization:
write-enums-using-to-string: true
write-dates-as-timestamps: false
deserialization:
read-enums-using-to-string: true
fail-on-unknown-properties: false
default-property-inclusion: always
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
# 上传文件和请求大小
servlet:
multipart:
max-file-size: 20MB # 单个文件的最大大小
max-request-size: 10MB # 整个请求的最大大小
# 缓存实现类型
cache:
type: redis
# 健康检查
management:
endpoints:
web:
exposure:
include: health,info
health:
mail:
enabled: false
# tomcat 配置,主要用于 配置 访问日志(便于将来排查错误)
server:
tomcat:
basedir: ${project.log-directory}/tomcat-logs
accesslog:
enabled: true
max-days: 7
pattern: "%t %{X-Forwarded-For}i %a %r %s (%D ms) %I (%B byte)"
# 文件上传 配置
file:
storage:
mode: local
local:
upload-path: /home/mowen-blog/upload/ #文件上传目录
url-prefix:
cloud:
region: oss-cn-hangzhou
endpoint: https://oss-cn-hangzhou.aliyuncs.com
bucket-name: 1024lab-smart-admin
access-key:
secret-key:
private-url-expire-seconds: 3600
# 云计算厂商支持公开的文件访问模式minio默认是不支持的对于minio用户可以配置为空
public-url-prefix: https://1024lab-smart-admin.oss-cn-hangzhou.aliyuncs.com/
# open api配置
springdoc:
swagger-ui:
enabled: true # 开关
doc-expansion: none #关闭展开
tags-sorter: alpha
server-base-url:
api-docs:
enabled: true # 开关
knife4j:
enable: true
basic:
enable: false
username: api # Basic认证用户名
password: 1024 # Basic认证密码
# RestTemplate 请求配置 毫秒
http:
pool:
max-total: 20
connect-timeout: 50000
read-timeout: 50000
write-timeout: 50000
keep-alive: 300000
# 跨域配置
access-control-allow-origin: '*'
# 心跳配置
heart-beat:
interval-seconds: 300
# 热加载配置
reload:
interval-seconds: 300
# sa-token 配置
sa-token:
# token 名称(同时也是 cookie 名称)
token-name: Authorization
# token 前缀 例如:Bearer
token-prefix: Bearer
# token 有效期(单位:秒) 默认30天2592000秒-1 代表永久有效
timeout: -1
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
active-timeout: -1
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
is-concurrent: false
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token(jwt模式下恒false)
is-share: false
# token 风格默认可取值uuid、simple-uuid、random-32、random-64、random-128、tik(jwt模式下无用)
token-style: simple-uuid
# 是否打开自动续签 如果此值为true框架会在每次直接或间接调用 getLoginId() 时进行一次过期检查与续签操作)
auto-renew: true
# 是否输出操作日志
is-log: true
# 日志等级trace、debug、info、warn、error、fatal
log-level: debug
# 启动时的字符画打印
is-print: false
# 是否从cookie读取token
is-read-cookie: false
# SmartJob 定时任务配置(不需要可以直接删除以下配置详细文档请看https://www.xxxxxx.com)
smart:
job:
enabled: true
# 任务初始化延迟 默认30秒 可选
init-delay: 10
# 定时任务执行线程池数量 默认2 可选
core-pool-size: 2
# 数据库配置检测-开关 默认开启 可选(作用是固定间隔读取数据库配置更新任务,关闭后只能重启服务或通过接口修改定时任务,建议开启)
db-refresh-enabled: true
# 数据库配置检测-执行间隔 默认120秒 可选
db-refresh-interval: 60

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,47 @@
<?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="online.junmowen.blog.base.module.support.changelog.dao.ChangeLogDao">
<!-- 分页查询 -->
<select id="queryPage" resultType="online.junmowen.blog.base.module.support.changelog.domain.vo.ChangeLogVO">
SELECT
*
FROM t_change_log
<where>
<!--更新类型:[1:特大版本功能更新;2:功能更新;3:bug修复]-->
<if test="queryForm.type != null">
AND t_change_log.type = #{queryForm.type}
</if>
<!--关键字-->
<if test="queryForm.keyword != null and queryForm.keyword != ''">
AND ( INSTR(t_change_log.update_version,#{queryForm.keyword})
OR INSTR(t_change_log.publish_author,#{queryForm.keyword})
OR INSTR(t_change_log.content,#{queryForm.keyword})
)
</if>
<!--发布日期-->
<if test="queryForm.publicDateBegin != null">
AND DATE_FORMAT(t_change_log.public_date, '%Y-%m-%d') &gt;= #{queryForm.publicDateBegin}
</if>
<if test="queryForm.publicDateEnd != null">
AND DATE_FORMAT(t_change_log.public_date, '%Y-%m-%d') &lt;= #{queryForm.publicDateEnd}
</if>
<!--创建时间-->
<if test="queryForm.createTime != null">
AND DATE_FORMAT(t_change_log.create_time, '%Y-%m-%d') = #{queryForm.createTime}
</if>
<!--跳转链接-->
<if test="queryForm.link != null">
AND t_change_log.link = #{queryForm.link}
</if>
</where>
order by t_change_log.update_version desc
</select>
<select id="selectByVersion"
resultType="online.junmowen.blog.base.module.support.changelog.domain.entity.ChangeLogEntity">
select * from t_change_log where update_version = #{version}
</select>
</mapper>

View File

@@ -0,0 +1,32 @@
<?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="online.junmowen.blog.base.module.support.codegenerator.dao.CodeGeneratorDao">
<select id="countByTableName" resultType="Long">
select count(*)
from information_schema.tables
where table_schema = (select database())
and table_name = #{tableName}
</select>
<select id="selectTableColumn" resultType="online.junmowen.blog.base.module.support.codegenerator.domain.vo.TableColumnVO">
select *
from information_schema.columns
where table_schema = (select database())
and table_name = #{tableName}
order by ordinal_position
</select>
<select id="queryTableList" resultType="online.junmowen.blog.base.module.support.codegenerator.domain.vo.TableVO">
select
`tables`.table_name,
`tables`.table_comment,
t_code_generator_config.update_time configTime
from information_schema.tables `tables`
left join t_code_generator_config on `tables`.table_name = t_code_generator_config.table_name
where `tables`.table_schema = (select database())
<if test="queryForm.tableNameKeywords != null and queryForm.tableNameKeywords != ''">
AND INSTR(`tables`.table_name,#{queryForm.tableNameKeywords})
</if>
</select>
</mapper>

View File

@@ -0,0 +1,22 @@
<?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="online.junmowen.blog.base.module.support.config.ConfigDao">
<!-- 分页查询系统配置 -->
<select id="queryByPage" resultType="online.junmowen.blog.base.module.support.config.domain.ConfigEntity">
SELECT *
FROM t_config
<where>
<if test="query.configKey != null and query.configKey != ''">
AND INSTR(config_key,#{query.configKey})
</if>
</where>
</select>
<!-- 根据key查询获取数据 -->
<select id="selectByKey" resultType="online.junmowen.blog.base.module.support.config.domain.ConfigEntity">
SELECT *
FROM t_config
WHERE config_key = #{key}
</select>
</mapper>

View File

@@ -0,0 +1,31 @@
<?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="online.junmowen.blog.base.module.support.datatracer.dao.DataTracerDao">
<select id="selectRecord"
resultType="online.junmowen.blog.base.module.support.datatracer.domain.vo.DataTracerVO">
select *
from t_data_tracer
where data_type = #{dataType}
and data_id = #{dataId}
</select>
<select id="query" resultType="online.junmowen.blog.base.module.support.datatracer.domain.vo.DataTracerVO">
SELECT * FROM t_data_tracer
<where>
<if test="query.type != null">
AND type = #{query.type}
</if>
<if test="query.dataId != null">
AND data_id = #{query.dataId}
</if>
<if test="query.keywords != null and query.keywords != ''">
AND INSTR(content,#{query.keywords})
</if>
</where>
<if test="query.sortItemList == null or query.sortItemList.size == 0">
ORDER BY data_tracer_id DESC
</if>
</select>
</mapper>

View File

@@ -0,0 +1,47 @@
<?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="online.junmowen.blog.base.module.support.dict.dao.DictDataDao">
<select id="queryByDictId" resultType="online.junmowen.blog.base.module.support.dict.domain.vo.DictDataVO">
select *
from t_dict_data
where dict_id = #{dictId}
order by sort_order desc
</select>
<select id="getAll" resultType="online.junmowen.blog.base.module.support.dict.domain.vo.DictDataVO">
select t_dict_data.*,
t_dict.dict_code,
t_dict.dict_name,
t_dict.disabled_flag dictDisabledFlag
from t_dict_data
left join t_dict on t_dict_data.dict_id = t_dict.dict_id
order by t_dict_data.sort_order desc
</select>
<select id="selectByDictIdAndValue"
resultType="online.junmowen.blog.base.module.support.dict.domain.entity.DictDataEntity">
select *
from t_dict_data
where dict_id = #{dictId}
and data_value = #{dataValue}
</select>
<select id="selectByDictDataIds" resultType="online.junmowen.blog.base.module.support.dict.domain.vo.DictDataVO">
select
t_dict_data.*,
t_dict.dict_code
from t_dict_data
left join t_dict on t_dict_data.dict_id = t_dict.dict_id
<where>
<if test="dictDataIdList != null and dictDataIdList.size > 0">
and t_dict_data.dict_data_id in
<foreach collection="dictDataIdList" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,45 @@
<?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="online.junmowen.blog.base.module.support.dict.dao.DictDao">
<!-- 查询结果列 -->
<sql id="base_columns">
t_dict.dict_id,
t_dict.dict_name,
t_dict.dict_code,
t_dict.remark,
t_dict.disabled_flag,
t_dict.create_time,
t_dict.update_time
</sql>
<!-- 分页查询 -->
<select id="queryPage" resultType="online.junmowen.blog.base.module.support.dict.domain.vo.DictVO">
SELECT
<include refid="base_columns"/>
FROM t_dict
<where>
<!--关键字-->
<if test="queryForm.keywords != null and queryForm.keywords != ''">
AND (
INSTR(t_dict.dict_name,#{queryForm.keywords})
OR INSTR(t_dict.dict_code,#{queryForm.keywords})
OR INSTR(t_dict.remark,#{queryForm.keywords})
)
</if>
<!--禁用状态-->
<if test="queryForm.disabledFlag != null">
AND t_dict.disabled_flag = #{queryForm.disabledFlag}
</if>
</where>
<if test="queryForm.sortItemList == null or queryForm.sortItemList.size == 0">
order by create_time desc
</if>
</select>
<select id="selectByCode" resultType="online.junmowen.blog.base.module.support.dict.domain.entity.DictEntity">
select * from t_dict where dict_code = #{code}
</select>
</mapper>

View File

@@ -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="online.junmowen.blog.base.module.support.feedback.dao.FeedbackDao">
<select id="queryPage" resultType="online.junmowen.blog.base.module.support.feedback.domain.FeedbackVO">
select *
from t_feedback
<where>
<if test="query.searchWord != null and query.searchWord != '' ">
AND (
INSTR(feedback_content,#{query.searchWord})
OR INSTR(user_name,#{query.searchWord})
)
</if>
<if test="query.startDate != null">
AND DATE_FORMAT(create_time, '%Y-%m-%d') &gt;= #{query.startDate}
</if>
<if test="query.endDate != null">
AND DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{query.endDate}
</if>
</where>
<if test="query.sortItemList == null or query.sortItemList.size == 0">
order by create_time desc
</if>
</select>
</mapper>

View File

@@ -0,0 +1,57 @@
<?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="online.junmowen.blog.base.module.support.file.dao.FileDao">
<!-- 分页查询 -->
<select id="queryPage" resultType="online.junmowen.blog.base.module.support.file.domain.vo.FileVO">
SELECT
*
FROM t_file
<where>
<!--文件夹类型-->
<if test="queryForm.folderType != null">
AND t_file.folder_type = #{queryForm.folderType}
</if>
<!--文件名词-->
<if test="queryForm.fileName != null and queryForm.fileName != ''">
AND INSTR(t_file.file_name,#{queryForm.fileName})
</if>
<!--文件Key-->
<if test="queryForm.fileKey != null and queryForm.fileKey != ''">
AND INSTR(t_file.file_key,#{queryForm.fileKey})
</if>
<!--文件类型-->
<if test="queryForm.fileType != null">
AND t_file.file_type = #{queryForm.fileType}
</if>
<!--创建人-->
<if test="queryForm.creatorName != null and queryForm.creatorName != ''">
AND INSTR(t_file.creator_name,#{queryForm.creatorName})
</if>
<!--创建时间-->
<if test="queryForm.createTimeBegin != null">
AND DATE_FORMAT(t_file.create_time, '%Y-%m-%d') &gt;= #{queryForm.createTimeBegin}
</if>
<if test="queryForm.createTimeEnd != null">
AND DATE_FORMAT(t_file.create_time, '%Y-%m-%d') &lt;= #{queryForm.createTimeEnd}
</if>
</where>
<if test="queryForm.sortItemList == null or queryForm.sortItemList.size == 0">
ORDER BY t_file.create_time DESC
</if>
</select>
<select id="getByFileKey" resultType="online.junmowen.blog.base.module.support.file.domain.vo.FileVO">
SELECT * FROM t_file where file_key = #{fileKey}
</select>
<select id="selectByFileKeyList" resultType="online.junmowen.blog.base.module.support.file.domain.vo.FileVO">
select * from t_file where file_key in
<foreach collection="fileKeyList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</select>
</mapper>

View File

@@ -0,0 +1,37 @@
<?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="online.junmowen.blog.base.module.support.heartbeat.HeartBeatRecordDao">
<update id="updateHeartBeatTimeById">
update t_heart_beat_record
set heart_beat_time = #{heartBeatTime}
<where>
heart_beat_record_id = #{id}
</where>
</update>
<select id="query" resultType="online.junmowen.blog.base.module.support.heartbeat.domain.HeartBeatRecordEntity">
select * from t_heart_beat_record where project_path = #{projectPath} and server_ip = #{serverIp} and process_no =#{processNo}
</select>
<select id="pageQuery" resultType="online.junmowen.blog.base.module.support.heartbeat.domain.HeartBeatRecordVO">
SELECT
*
FROM
t_heart_beat_record
<where>
<if test="query.startDate != null ">
AND DATE_FORMAT(heart_beat_time, '%Y-%m-%d') &gt;= #{query.startDate}
</if>
<if test="query.endDate != null ">
AND DATE_FORMAT(heart_beat_time, '%Y-%m-%d') &lt;= #{query.endDate}
</if>
<if test="query.keywords != null and query.keywords != ''">
AND (INSTR(project_path,#{query.keywords}) or INSTR(server_ip,#{query.keywords}) or INSTR(process_no,#{query.keywords}))
</if>
</where>
order by heart_beat_time desc
</select>
</mapper>

View File

@@ -0,0 +1,130 @@
<?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="online.junmowen.blog.base.module.support.helpdoc.dao.HelpDocDao">
<!-- ================================== 帮助文档【主表 t_help_doc 】 ================================== -->
<select id="queryAllHelpDocList" resultType="online.junmowen.blog.base.module.support.helpdoc.domain.vo.HelpDocVO">
SELECT t_help_doc.*,
t_help_doc_catalog.name as helpDocCatalogName
FROM t_help_doc
left join t_help_doc_catalog on t_help_doc_catalog.help_doc_catalog_id = t_help_doc.help_doc_catalog_id
</select>
<select id="query" resultType="online.junmowen.blog.base.module.support.helpdoc.domain.vo.HelpDocVO">
SELECT
t_help_doc.* ,
t_help_doc_catalog.name as helpDocCatalogName
FROM t_help_doc
left join t_help_doc_catalog on t_help_doc_catalog.help_doc_catalog_id = t_help_doc.help_doc_catalog_id
<where>
<if test="query.helpDocCatalogId != null">
AND t_help_doc.help_doc_catalog_id = #{query.helpDocCatalogId}
</if>
<if test="query.keywords != null and query.keywords !=''">
AND ( INSTR(t_help_doc.title,#{query.keywords})
OR INSTR(t_help_doc.author,#{query.keywords})
)
</if>
<if test="query.createTimeBegin != null">
AND DATE_FORMAT(t_help_doc.create_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{query.createTimeBegin},
'%Y-%m-%d')
</if>
<if test="query.createTimeEnd != null">
AND DATE_FORMAT(t_help_doc.create_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{query.createTimeEnd},
'%Y-%m-%d')
</if>
</where>
<if test="query.sortItemList == null or query.sortItemList.size == 0">
ORDER BY t_help_doc.sort ASC, t_help_doc.create_time DESC
</if>
</select>
<update id="updateViewCount">
update t_help_doc
set page_view_count = page_view_count + #{pageViewCountIncrease},
user_view_count = user_view_count + #{userViewCountIncrease}
where help_doc_id = #{helpDocId}
</update>
<select id="queryHelpDocByCatalogId"
resultType="online.junmowen.blog.base.module.support.helpdoc.domain.vo.HelpDocVO">
select *
from t_help_doc
where help_doc_catalog_id = #{helpDocCatalogId}
</select>
<select id="queryHelpDocByRelationId"
resultType="online.junmowen.blog.base.module.support.helpdoc.domain.vo.HelpDocVO">
select t_help_doc.*
from t_help_doc_relation
left join t_help_doc on t_help_doc.help_doc_id = t_help_doc_relation.help_doc_id
where t_help_doc_relation.relation_id = #{relationId}
</select>
<!-- ================================== 关联项目 【子表 关联关系 t_help_doc_relation 】 ================================== -->
<insert id="insertRelation">
insert into t_help_doc_relation
(relation_id, relation_name, help_doc_id)
values
<foreach collection="relationList" separator="," item="item">
( #{item.relationId} ,#{item.relationName}, #{helpDocId} )
</foreach>
</insert>
<delete id="deleteRelation">
delete
from t_help_doc_relation
where help_doc_id = #{helpDocId}
</delete>
<select id="queryRelationByHelpDoc"
resultType="online.junmowen.blog.base.module.support.helpdoc.domain.vo.HelpDocRelationVO">
select *
from t_help_doc_relation
where help_doc_id = #{helpDocId}
</select>
<!-- ================================== 查看记录【子表 查看记录 t_help_doc_view_record】 ================================== -->
<select id="viewRecordCount" resultType="java.lang.Long">
select count(*)
from t_help_doc_view_record
where help_doc_id = #{helpDocId}
and user_id = #{userId}
</select>
<insert id="insertViewRecord">
insert into t_help_doc_view_record (help_doc_id, user_id,user_name, first_ip, first_user_agent, page_view_count)
values (#{helpDocId}, #{userId},#{userName}, #{ip}, #{userAgent}, #{pageViewCount})
</insert>
<update id="updateViewRecord">
update t_help_doc_view_record
set page_view_count = page_view_count + 1,
last_ip = #{ip},
last_user_agent = #{userAgent}
where help_doc_id = #{helpDocId}
and user_id = #{userId}
</update>
<select id="queryViewRecordList"
resultType="online.junmowen.blog.base.module.support.helpdoc.domain.vo.HelpDocViewRecordVO">
select *
from t_help_doc_view_record
where
help_doc_id = #{queryForm.helpDocId}
<if test="queryForm.keywords != null and queryForm.keywords !=''">
AND (
INSTR(user_name,#{queryForm.keywords})
OR INSTR(first_ip,#{queryForm.keywords})
OR INSTR(first_user_agent,#{queryForm.keywords})
OR INSTR(last_ip,#{queryForm.keywords})
OR INSTR(last_user_agent,#{queryForm.keywords})
)
</if>
<if test="queryForm.userId != null ">
and user_id = #{queryForm.userId}
</if>
order by update_time desc,create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,47 @@
<?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="online.junmowen.blog.base.module.support.securityprotect.dao.LoginFailDao">
<!-- 分页查询 -->
<select id="queryPage" resultType="online.junmowen.blog.base.module.support.securityprotect.domain.LoginFailVO">
SELECT
*
FROM t_login_fail
<where>
<!--登录名-->
<if test="queryForm.loginName != null and queryForm.loginName != ''">
AND INSTR(t_login_fail.login_name,#{queryForm.loginName})
</if>
<!--锁定状态-->
<if test="queryForm.lockFlag != null ">
AND t_login_fail.lock_flag = #{queryForm.lockFlag}
</if>
<!--登录失败锁定时间-->
<if test="queryForm.loginLockBeginTimeBegin != null">
AND DATE_FORMAT(t_login_fail.login_lock_begin_time, '%Y-%m-%d') &gt;= #{queryForm.loginLockBeginTimeBegin}
</if>
<if test="queryForm.loginLockBeginTimeEnd != null">
AND DATE_FORMAT(t_login_fail.login_lock_begin_time, '%Y-%m-%d') &lt;= #{queryForm.loginLockBeginTimeEnd}
</if>
</where>
order by t_login_fail.update_time desc
</select>
<select id="selectByUserIdAndUserType"
resultType="online.junmowen.blog.base.module.support.securityprotect.domain.LoginFailEntity">
select *
from t_login_fail
where user_id = #{userId}
and user_type = #{userType}
</select>
<delete id="deleteByUserIdAndUserType">
delete
from t_login_fail
where user_id = #{userId}
and user_type = #{userType}
</delete>
</mapper>

View File

@@ -0,0 +1,44 @@
<?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="online.junmowen.blog.base.module.support.loginlog.LoginLogDao">
<select id="queryByPage" resultType="online.junmowen.blog.base.module.support.loginlog.domain.LoginLogVO">
select
*
from t_login_log
<where>
<if test="query.userId != null">
AND user_id = #{query.userId}
</if>
<if test="query.userType != null">
AND user_type = #{query.userType}
</if>
<if test="query.ip != null and query.ip != ''">
AND INSTR(login_ip,#{query.ip})
</if>
<if test="query.startDate != null and query.startDate != ''">
AND DATE_FORMAT(create_time, '%Y-%m-%d') &gt;= #{query.startDate}
</if>
<if test="query.endDate != null and query.endDate != ''">
AND DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{query.endDate}
</if>
<if test="query.userName != null and query.userName != ''">
AND INSTR(user_name,#{query.userName})
</if>
</where>
order by create_time desc
</select>
<select id="queryLastByUserId" resultType="online.junmowen.blog.base.module.support.loginlog.domain.LoginLogVO">
select
*
from t_login_log
where
user_id = #{userId}
and user_type = #{userType}
and login_result = #{loginLogResult}
order by login_log_id desc
limit 1
</select>
</mapper>

View File

@@ -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="online.junmowen.blog.base.module.support.message.dao.MessageDao">
<!-- 更新已读状态 -->
<update id="updateReadFlag">
UPDATE t_message
SET read_flag = #{readFlag},
read_time = now()
WHERE message_id = #{messageId}
AND receiver_user_type = #{receiverUserType}
AND receiver_user_id = #{receiverUserId}
AND read_flag != #{readFlag}
</update>
<!-- 分页查询消息 -->
<select id="query" resultType="online.junmowen.blog.base.module.support.message.domain.MessageVO">
SELECT * FROM t_message
<where>
<if test="query.receiverUserType != null">
AND receiver_user_type = #{query.receiverUserType}
</if>
<if test="query.receiverUserId != null">
AND receiver_user_id = #{query.receiverUserId}
</if>
<if test="query.messageType != null">
AND message_type = #{query.messageType}
</if>
<if test="query.searchWord != null and query.searchWord !=''">
AND ( INSTR(title,#{query.searchWord})
OR INSTR(content,#{query.searchWord})
)
</if>
<if test="query.readFlag != null">
AND read_flag = #{query.readFlag}
</if>
<if test="query.startDate != null">
AND DATE_FORMAT(create_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{query.startDate}, '%Y-%m-%d')
</if>
<if test="query.endDate != null">
AND DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{query.endDate}, '%Y-%m-%d')
</if>
</where>
<if test="query.sortItemList == null or query.sortItemList.size == 0">
ORDER BY message_id DESC
</if>
</select>
<select id="getUnreadCount" resultType="java.lang.Long">
SELECT count(1)
FROM t_message
where receiver_user_type = #{receiverUserType}
AND receiver_user_id = #{receiverUserId}
AND read_flag = false
</select>
</mapper>

View File

@@ -0,0 +1,45 @@
<?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="online.junmowen.blog.base.module.support.operatelog.OperateLogDao">
<select id="queryByPage" resultType="online.junmowen.blog.base.module.support.operatelog.domain.OperateLogEntity">
select
*
from t_operate_log
<where>
<if test="query.operateUserId != null">
AND operate_user_id = #{query.operateUserId}
</if>
<if test="query.operateUserType != null">
AND operate_user_type = #{query.operateUserType}
</if>
<if test="query.startDate != null and query.startDate != ''">
AND DATE_FORMAT(create_time, '%Y-%m-%d') &gt;= #{query.startDate}
</if>
<if test="query.endDate != null and query.endDate != ''">
AND DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{query.endDate}
</if>
<if test="query.userName != null and query.userName != ''">
AND INSTR(operate_user_name,#{query.userName})
</if>
<if test="query.keywords != null and query.keywords != ''">
AND (INSTR(module,#{query.keywords}) OR INSTR(content,#{query.keywords}))
</if>
<if test="query.requestKeywords != null and query.requestKeywords != ''">
AND (INSTR(url,#{query.requestKeywords}) OR INSTR(method,#{query.requestKeywords}) OR INSTR(param,#{query.requestKeywords}) OR INSTR(response,#{query.requestKeywords}))
</if>
<if test="query.successFlag != null">
AND success_flag = #{query.successFlag}
</if>
</where>
order by create_time desc
</select>
<delete id="deleteByIds">
delete from t_operate_log where id in
<foreach collection="idList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,28 @@
<?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="online.junmowen.blog.base.module.support.securityprotect.dao.PasswordLogDao">
<select id="selectLastByUserTypeAndUserId"
resultType="online.junmowen.blog.base.module.support.securityprotect.domain.PasswordLogEntity">
select
*
from t_password_log
where
user_id = #{userId}
and user_type = #{userType}
order by id desc
limit 1
</select>
<select id="selectOldPassword" resultType="java.lang.String">
select
new_password
from t_password_log
where
user_id = #{userId}
and user_type = #{userType}
order by id desc
limit #{limit}
</select>
</mapper>

View File

@@ -0,0 +1,10 @@
<?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="online.junmowen.blog.base.module.support.reload.dao.ReloadItemDao">
<!-- 查询reload列表 -->
<select id="query" resultType="online.junmowen.blog.base.module.support.reload.domain.ReloadItemVO">
SELECT tag,args,identification,update_time,create_time FROM t_reload_item
</select>
</mapper>

View File

@@ -0,0 +1,10 @@
<?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="online.junmowen.blog.base.module.support.reload.dao.ReloadResultDao">
<!-- 查询reload列表 -->
<select id="query" resultType="online.junmowen.blog.base.module.support.reload.domain.ReloadResultVO">
SELECT tag, identification, args, result, exception, create_time FROM t_reload_result where tag = #{tag} order by create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="online.junmowen.blog.base.module.support.serialnumber.dao.SerialNumberDao">
<update id="updateLastNumberAndTime">
update t_serial_number
set
last_number = #{lastNumber},
last_time = #{lastTime}
where
serial_number_id = #{serialNumberId}
</update>
<!-- 查询最后生成记录 -->
<select id="selectForUpdate" resultType="online.junmowen.blog.base.module.support.serialnumber.domain.SerialNumberEntity">
select * from t_serial_number where serial_number_id = #{serialNumberId} for update
</select>
</mapper>

View File

@@ -0,0 +1,32 @@
<?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="online.junmowen.blog.base.module.support.serialnumber.dao.SerialNumberRecordDao">
<update id="updateRecord">
update t_serial_number_record
set last_number = #{lastNumber},
count = count + #{count}
where
serial_number_id = #{serialNumberId}
and
record_date = #{recordDate}
</update>
<select id="selectRecordIdBySerialNumberIdAndDate" resultType="java.lang.Long">
select serial_number_record_id
from t_serial_number_record
where
serial_number_id = #{serialNumberId}
and
record_date = #{recordDate}
</select>
<select id="query"
resultType="online.junmowen.blog.base.module.support.serialnumber.domain.SerialNumberRecordEntity">
select * from t_serial_number_record
where serial_number_id = #{queryForm.serialNumberId}
order by last_time desc
</select>
</mapper>

View File

@@ -0,0 +1,35 @@
<?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="online.junmowen.blog.base.module.support.job.repository.SmartJobLogDao">
<!-- 定时任务-执行记录-分页查询 -->
<select id="query" resultType="online.junmowen.blog.base.module.support.job.api.domain.SmartJobLogVO">
SELECT *
FROM t_smart_job_log
<where>
<if test="query.searchWord != null and query.searchWord != ''">
AND ( INSTR(job_name,#{query.searchWord})
OR INSTR(param,#{query.searchWord})
OR INSTR(execute_result,#{query.searchWord})
OR INSTR(create_name,#{query.searchWord})
)
</if>
<if test="query.jobId != null">
AND job_id = #{query.jobId}
</if>
<if test="query.successFlag != null">
AND success_flag = #{query.successFlag}
</if>
<if test="query.startTime != null">
AND DATE_FORMAT(execute_start_time, '%Y-%m-%d') &gt;= #{query.startTime}
</if>
<if test="query.endTime != null">
AND DATE_FORMAT(execute_start_time, '%Y-%m-%d') &lt;= #{query.endTime}
</if>
</where>
<if test="query.sortItemList == null or query.sortItemList.size == 0">
ORDER BY log_id DESC
</if>
</select>
</mapper>

View File

@@ -0,0 +1,43 @@
<?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="online.junmowen.blog.base.module.support.job.repository.SmartJobDao">
<update id="updateDeletedFlag">
update t_smart_job
set deleted_flag = #{deletedFlag}
where job_id = #{jobId}
</update>
<!-- 定时任务-分页查询 -->
<select id="query" resultType="online.junmowen.blog.base.module.support.job.api.domain.SmartJobVO">
SELECT *
FROM t_smart_job
<where>
<if test="query.searchWord != null and query.searchWord != ''">
AND ( INSTR(job_name,#{query.searchWord})
OR INSTR(job_class,#{query.searchWord})
OR INSTR(trigger_value,#{query.searchWord})
)
</if>
<if test="query.triggerType != null">
AND trigger_type = #{query.triggerType}
</if>
<if test="query.enabledFlag != null">
AND enabled_flag = #{query.enabledFlag}
</if>
<if test="query.deletedFlag != null">
AND deleted_flag = #{query.deletedFlag}
</if>
</where>
<if test="query.sortItemList == null or query.sortItemList.size == 0">
ORDER BY sort ASC,job_id DESC
</if>
</select>
<select id="selectByJobClass" resultType="online.junmowen.blog.base.module.support.job.repository.domain.SmartJobEntity">
SELECT *
FROM t_smart_job
WHERE job_class = #{jobClass}
</select>
</mapper>

View File

@@ -0,0 +1,18 @@
<?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="online.junmowen.blog.base.module.support.table.TableColumnDao">
<delete id="deleteTableColumn">
delete
from t_table_column
where user_id = #{userId}
and table_id = #{tableId}
</delete>
<select id="selectByUserIdAndTableId"
resultType="online.junmowen.blog.base.module.support.table.domain.TableColumnEntity">
select *
from t_table_column
where user_id = #{userId}
and table_id = #{tableId}
</select>
</mapper>

View File

@@ -0,0 +1,188 @@
spring:
# 数据库连接信息
datasource:
url: jdbc:p6spy:mysql://127.0.0.1:3306/mowen-blog?autoReconnect=true&useServerPreparedStmts=false&rewriteBatchedStatements=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username: root
password: SmartAdmin666
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
initial-size: 2
min-idle: 2
max-active: 10
max-wait: 60000
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
filters: stat
druid:
username: druid
password: 1024
login:
enabled: false
method:
pointcut: online.junmowen.blog..*Service.*
# redis 连接池配置信息
data:
redis:
database: 1
host: 127.0.0.1
port: 6379
password:
timeout: 10000ms
lettuce:
pool:
max-active: 5
min-idle: 1
max-idle: 3
max-wait: 30000ms
# 邮件置以SSL的方式发送, 这个需要使用这种方式并且端口是465
mail:
host: smtp.163.com
port: 465
username: lab1024@163.com
password: LAB1024LAB
test-connection: false
properties:
mail:
smtp:
auth: true
ssl:
enable: true
socketFactory:
class: com.sun.mail.util.MailSSLSocketFactory
fallback: false
debug: false
# json序列化相关配置
jackson:
serialization:
write-enums-using-to-string: true
write-dates-as-timestamps: false
deserialization:
read-enums-using-to-string: true
fail-on-unknown-properties: false
default-property-inclusion: always
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
# 上传文件和请求大小
servlet:
multipart:
max-file-size: 20MB # 单个文件的最大大小
max-request-size: 10MB # 整个请求的最大大小
# 缓存实现类型
cache:
type: redis
# 健康检查
management:
endpoints:
web:
exposure:
include: health,info
health:
mail:
enabled: false
# tomcat 配置,主要用于 配置 访问日志(便于将来排查错误)
server:
tomcat:
basedir: ${project.log-directory}/tomcat-logs
accesslog:
enabled: true
max-days: 7
pattern: "%t %{X-Forwarded-For}i %a %r %s (%D ms) %I (%B byte)"
# 文件上传 配置
file:
storage:
mode: local
local:
upload-path: /home/mowen-blog/upload/ #文件上传目录
url-prefix:
cloud:
region: oss-cn-hangzhou
endpoint: https://oss-cn-hangzhou.aliyuncs.com
bucket-name: 1024lab-smart-admin
access-key:
secret-key:
private-url-expire-seconds: 3600
# 云计算厂商支持公开的文件访问模式minio默认是不支持的对于minio用户可以配置为空
public-url-prefix: https://1024lab-smart-admin.oss-cn-hangzhou.aliyuncs.com/
# open api配置
springdoc:
swagger-ui:
enabled: true # 开关
doc-expansion: none #关闭展开
tags-sorter: alpha
server-base-url:
api-docs:
enabled: true # 开关
knife4j:
enable: true
basic:
enable: false
username: api # Basic认证用户名
password: 1024 # Basic认证密码
# RestTemplate 请求配置 毫秒
http:
pool:
max-total: 20
connect-timeout: 50000
read-timeout: 50000
write-timeout: 50000
keep-alive: 300000
# 跨域配置
access-control-allow-origin: '*'
# 心跳配置
heart-beat:
interval-seconds: 300
# 热加载配置
reload:
interval-seconds: 300
# sa-token 配置
sa-token:
# token 名称(同时也是 cookie 名称)
token-name: Authorization
# token 前缀 例如:Bearer
token-prefix: Bearer
# token 有效期(单位:秒) 默认30天2592000秒-1 代表永久有效
timeout: 2592000
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
active-timeout: -1
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
is-concurrent: false
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token(jwt模式下恒false)
is-share: false
# token 风格默认可取值uuid、simple-uuid、random-32、random-64、random-128、tik(jwt模式下无用)
token-style: simple-uuid
# 是否打开自动续签 如果此值为true框架会在每次直接或间接调用 getLoginId() 时进行一次过期检查与续签操作)
auto-renew: true
# 是否输出操作日志
is-log: true
# 日志等级trace、debug、info、warn、error、fatal
log-level: debug
# 启动时的字符画打印
is-print: false
# 是否从cookie读取token
is-read-cookie: false
# SmartJob 定时任务配置(不需要可以直接删除以下配置详细文档请看https://www.xxxxxx.com)
smart:
job:
enabled: true
# 任务初始化延迟 默认30秒 可选
init-delay: 10
# 定时任务执行线程池数量 默认2 可选
core-pool-size: 2
# 数据库配置检测-开关 默认开启 可选(作用是固定间隔读取数据库配置更新任务,关闭后只能重启服务或通过接口修改定时任务,建议开启)
db-refresh-enabled: true
# 数据库配置检测-执行间隔 默认120秒 可选
db-refresh-interval: 60

View File

@@ -0,0 +1,185 @@
spring:
# 数据库连接信息
datasource:
url: jdbc:mysql://127.0.0.1:3306/mowen-blog?autoReconnect=true&useServerPreparedStmts=false&rewriteBatchedStatements=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username: root
password: SmartAdmin666
driver-class-name: com.mysql.cj.jdbc.Driver
initial-size: 10
min-idle: 10
max-active: 200
max-wait: 60000
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
filters: stat
druid:
username: druid
password: 1024
login:
enabled: false
method:
pointcut: online.junmowen.blog..*Service.*
# redis 连接池配置信息
data:
redis:
database: 1
host: 127.0.0.1
port: 6379
password:
timeout: 10000ms
lettuce:
pool:
max-active: 100
min-idle: 10
max-idle: 50
max-wait: 30000ms
# 邮件置以SSL的方式发送, 这个需要使用这种方式并且端口是465
mail:
host: smtp.163.com
port: 465
username: lab1024@163.com
password: LAB1024LAB
test-connection: false
properties:
mail:
smtp:
auth: true
ssl:
enable: true
socketFactory:
class: com.sun.mail.util.MailSSLSocketFactory
fallback: false
debug: false
# json序列化相关配置
jackson:
serialization:
write-enums-using-to-string: true
write-dates-as-timestamps: false
deserialization:
read-enums-using-to-string: true
fail-on-unknown-properties: false
default-property-inclusion: always
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
# 上传文件和请求大小
servlet:
multipart:
max-file-size: 20MB # 单个文件的最大大小
max-request-size: 10MB # 整个请求的最大大小
# 缓存实现类型
cache:
type: redis
# 健康检查
management:
endpoints:
web:
exposure:
include: health,info
health:
mail:
enabled: false
# tomcat 配置,主要用于 配置 访问日志(便于将来排查错误)
server:
tomcat:
basedir: ${project.log-directory}/tomcat-logs
accesslog:
enabled: true
max-days: 30
pattern: "%t %{X-Forwarded-For}i %a %r %s (%D ms) %I (%B byte)"
# 文件上传 配置
file:
storage:
mode: local
local:
upload-path: /home/mowen-blog/upload/ #文件上传目录
url-prefix:
cloud:
region: oss-cn-hangzhou
endpoint: https://oss-cn-hangzhou.aliyuncs.com
bucket-name: 1024lab-smart-admin
access-key:
secret-key:
private-url-expire-seconds: 3600
# 云计算厂商支持公开的文件访问模式minio默认是不支持的对于minio用户可以配置为空
public-url-prefix: https://1024lab-smart-admin.oss-cn-hangzhou.aliyuncs.com/
# open api配置
springdoc:
swagger-ui:
enabled: true # 开关
doc-expansion: none #关闭展开
tags-sorter: alpha
server-base-url:
api-docs:
enabled: true # 开关
knife4j:
enable: true
basic:
enable: false
username: api # Basic认证用户名
password: 1024 # Basic认证密码
# RestTemplate 请求配置 毫秒
http:
pool:
max-total: 100
connect-timeout: 50000
read-timeout: 50000
write-timeout: 50000
keep-alive: 300000
# 心跳配置
heart-beat:
interval-seconds: 60
# 热加载配置
reload:
interval-seconds: 60
# sa-token 配置
sa-token:
# token 名称(同时也是 cookie 名称)
token-name: Authorization
# token 前缀 例如:Bearer
token-prefix: Bearer
# token 有效期(单位:秒) 默认30天2592000秒-1 代表永久有效
timeout: 2592000
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
active-timeout: -1
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
is-concurrent: false
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token(jwt模式下恒false)
is-share: false
# token 风格默认可取值uuid、simple-uuid、random-32、random-64、random-128、tik(jwt模式下无用)
token-style: simple-uuid
# 是否打开自动续签 如果此值为true框架会在每次直接或间接调用 getLoginId() 时进行一次过期检查与续签操作)
auto-renew: true
# 是否输出操作日志
is-log: false
# 日志等级trace、debug、info、warn、error、fatal
log-level: warn
# 启动时的字符画打印
is-print: false
# 是否从cookie读取token
is-read-cookie: false
# SmartJob 定时任务配置(不需要可以直接删除以下配置详细文档请看https://www.xxxxxx.com)
smart:
job:
enabled: true
# 任务初始化延迟 默认30秒 可选
init-delay: 10
# 定时任务执行线程池数量 默认2 可选
core-pool-size: 2
# 数据库配置检测-开关 默认开启 可选(作用是固定间隔读取数据库配置更新任务,关闭后只能重启服务或通过接口修改定时任务,建议开启)
db-refresh-enabled: true
# 数据库配置检测-执行间隔 默认120秒 可选
db-refresh-interval: 60

View File

@@ -0,0 +1,188 @@
spring:
# 数据库连接信息
datasource:
url: jdbc:p6spy:mysql://127.0.0.1:3306/mowen-blog?autoReconnect=true&useServerPreparedStmts=false&rewriteBatchedStatements=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username: root
password: SmartAdmin666
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
initial-size: 2
min-idle: 2
max-active: 10
max-wait: 60000
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
filters: stat
druid:
username: druid
password: 1024
login:
enabled: false
method:
pointcut: online.junmowen.blog..*Service.*
# redis 连接池配置信息
data:
redis:
database: 1
host: 127.0.0.1
port: 6379
password:
timeout: 10000ms
lettuce:
pool:
max-active: 5
min-idle: 1
max-idle: 3
max-wait: 30000ms
# 邮件置以SSL的方式发送, 这个需要使用这种方式并且端口是465
mail:
host: smtp.163.com
port: 465
username: lab1024@163.com
password: LAB1024LAB
test-connection: false
properties:
mail:
smtp:
auth: true
ssl:
enable: true
socketFactory:
class: com.sun.mail.util.MailSSLSocketFactory
fallback: false
debug: false
# json序列化相关配置
jackson:
serialization:
write-enums-using-to-string: true
write-dates-as-timestamps: false
deserialization:
read-enums-using-to-string: true
fail-on-unknown-properties: false
default-property-inclusion: always
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
# 上传文件和请求大小
servlet:
multipart:
max-file-size: 20MB # 单个文件的最大大小
max-request-size: 10MB # 整个请求的最大大小
# 缓存实现类型
cache:
type: redis
# 健康检查
management:
endpoints:
web:
exposure:
include: health,info
health:
mail:
enabled: false
# tomcat 配置,主要用于 配置 访问日志(便于将来排查错误)
server:
tomcat:
basedir: ${project.log-directory}/tomcat-logs
accesslog:
enabled: true
max-days: 7
pattern: "%t %{X-Forwarded-For}i %a %r %s (%D ms) %I (%B byte)"
# 文件上传 配置
file:
storage:
mode: local
local:
upload-path: /home/mowen-blog/upload/ #文件上传目录
url-prefix:
cloud:
region: oss-cn-hangzhou
endpoint: https://oss-cn-hangzhou.aliyuncs.com
bucket-name: 1024lab-smart-admin
access-key:
secret-key:
private-url-expire-seconds: 3600
# 云计算厂商支持公开的文件访问模式minio默认是不支持的对于minio用户可以配置为空
public-url-prefix: https://1024lab-smart-admin.oss-cn-hangzhou.aliyuncs.com/
# open api配置
springdoc:
swagger-ui:
enabled: true # 开关
doc-expansion: none #关闭展开
tags-sorter: alpha
server-base-url:
api-docs:
enabled: true # 开关
knife4j:
enable: true
basic:
enable: false
username: api # Basic认证用户名
password: 1024 # Basic认证密码
# RestTemplate 请求配置 毫秒
http:
pool:
max-total: 20
connect-timeout: 50000
read-timeout: 50000
write-timeout: 50000
keep-alive: 300000
# 跨域配置
access-control-allow-origin: '*'
# 心跳配置
heart-beat:
interval-seconds: 300
# 热加载配置
reload:
interval-seconds: 300
# sa-token 配置
sa-token:
# token 名称(同时也是 cookie 名称)
token-name: Authorization
# token 前缀 例如:Bearer
token-prefix: Bearer
# token 有效期(单位:秒) 默认30天2592000秒-1 代表永久有效
timeout: 2592000
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
active-timeout: -1
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
is-concurrent: false
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token(jwt模式下恒false)
is-share: false
# token 风格默认可取值uuid、simple-uuid、random-32、random-64、random-128、tik(jwt模式下无用)
token-style: simple-uuid
# 是否打开自动续签 如果此值为true框架会在每次直接或间接调用 getLoginId() 时进行一次过期检查与续签操作)
auto-renew: true
# 是否输出操作日志
is-log: true
# 日志等级trace、debug、info、warn、error、fatal
log-level: debug
# 启动时的字符画打印
is-print: false
# 是否从cookie读取token
is-read-cookie: false
# SmartJob 定时任务配置(不需要可以直接删除以下配置详细文档请看https://www.xxxxxx.com)
smart:
job:
enabled: true
# 任务初始化延迟 默认30秒 可选
init-delay: 10
# 定时任务执行线程池数量 默认2 可选
core-pool-size: 2
# 数据库配置检测-开关 默认开启 可选(作用是固定间隔读取数据库配置更新任务,关闭后只能重启服务或通过接口修改定时任务,建议开启)
db-refresh-enabled: true
# 数据库配置检测-执行间隔 默认120秒 可选
db-refresh-interval: 60