mirror of
https://gitcode.com/ageerle/ruoyi-ai.git
synced 2026-03-14 05:03:43 +08:00
Merge pull request #157 from MuSan-Li/feature_20250805_fix_data_model_del
feat: 优化删除数据模型也删除模型字段&添加mapper文件注解
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.ruoyi.common.core.manager;
|
||||
|
||||
import jakarta.annotation.PreDestroy;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.ruoyi.common.core.utils.Threads;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.ruoyi.common.sms.config.properties;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* SMS短信 配置属性
|
||||
@@ -10,6 +11,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @version 4.2.0
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "sms")
|
||||
public class SmsProperties {
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import lombok.Data;
|
||||
import org.ruoyi.common.web.enums.CaptchaCategory;
|
||||
import org.ruoyi.common.web.enums.CaptchaType;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 验证码 配置属性
|
||||
@@ -11,6 +12,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "captcha")
|
||||
public class CaptchaProperties {
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.ruoyi.mapper;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.ChatMessage;
|
||||
import org.ruoyi.domain.vo.ChatMessageVo;
|
||||
@@ -11,6 +12,7 @@ import org.ruoyi.domain.vo.ChatMessageVo;
|
||||
* @author ageerle
|
||||
* @date 2025-04-08
|
||||
*/
|
||||
@Mapper
|
||||
public interface ChatMessageMapper extends BaseMapperPlus<ChatMessage, ChatMessageVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.ChatModel;
|
||||
import org.ruoyi.domain.vo.ChatModelVo;
|
||||
@@ -10,6 +11,7 @@ import org.ruoyi.domain.vo.ChatModelVo;
|
||||
* @author ageerle
|
||||
* @date 2025-04-08
|
||||
*/
|
||||
@Mapper
|
||||
public interface ChatModelMapper extends BaseMapperPlus<ChatModel, ChatModelVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.ruoyi.mapper;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.ChatPayOrder;
|
||||
import org.ruoyi.domain.vo.ChatPayOrderVo;
|
||||
@@ -11,6 +12,7 @@ import org.ruoyi.domain.vo.ChatPayOrderVo;
|
||||
* @author ageerle
|
||||
* @date 2025-04-08
|
||||
*/
|
||||
@Mapper
|
||||
public interface ChatPayOrderMapper extends BaseMapperPlus<ChatPayOrder, ChatPayOrderVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.ChatSession;
|
||||
import org.ruoyi.domain.vo.ChatSessionVo;
|
||||
@@ -10,6 +11,7 @@ import org.ruoyi.domain.vo.ChatSessionVo;
|
||||
* @author ageerle
|
||||
* @date 2025-05-03
|
||||
*/
|
||||
@Mapper
|
||||
public interface ChatSessionMapper extends BaseMapperPlus<ChatSession, ChatSessionVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.ruoyi.mapper;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.ChatUsageToken;
|
||||
import org.ruoyi.domain.vo.ChatUsageTokenVo;
|
||||
@@ -11,6 +12,7 @@ import org.ruoyi.domain.vo.ChatUsageTokenVo;
|
||||
* @author ageerle
|
||||
* @date 2025-04-08
|
||||
*/
|
||||
@Mapper
|
||||
public interface ChatUsageTokenMapper extends BaseMapperPlus<ChatUsageToken, ChatUsageTokenVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.ruoyi.mapper;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.PromptTemplate;
|
||||
import org.ruoyi.domain.vo.PromptTemplateVo;
|
||||
@@ -11,6 +11,7 @@ import org.ruoyi.domain.vo.PromptTemplateVo;
|
||||
* @author evo
|
||||
* @date 2025-06-12
|
||||
*/
|
||||
@Mapper
|
||||
public interface PromptTemplateMapper extends BaseMapperPlus<PromptTemplate, PromptTemplateVo> {
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.ruoyi.mapper;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.KnowledgeAttach;
|
||||
import org.ruoyi.domain.vo.KnowledgeAttachVo;
|
||||
@@ -11,6 +12,7 @@ import org.ruoyi.domain.vo.KnowledgeAttachVo;
|
||||
* @author ageerle
|
||||
* @date 2025-04-08
|
||||
*/
|
||||
@Mapper
|
||||
public interface KnowledgeAttachMapper extends BaseMapperPlus<KnowledgeAttach, KnowledgeAttachVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.ruoyi.mapper;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.KnowledgeFragment;
|
||||
import org.ruoyi.domain.vo.KnowledgeFragmentVo;
|
||||
@@ -11,6 +12,7 @@ import org.ruoyi.domain.vo.KnowledgeFragmentVo;
|
||||
* @author ageerle
|
||||
* @date 2025-04-08
|
||||
*/
|
||||
@Mapper
|
||||
public interface KnowledgeFragmentMapper extends BaseMapperPlus<KnowledgeFragment, KnowledgeFragmentVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.ruoyi.mapper;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.KnowledgeInfo;
|
||||
import org.ruoyi.domain.vo.KnowledgeInfoVo;
|
||||
@@ -11,6 +12,7 @@ import org.ruoyi.domain.vo.KnowledgeInfoVo;
|
||||
* @author ageerle
|
||||
* @date 2025-04-08
|
||||
*/
|
||||
@Mapper
|
||||
public interface KnowledgeInfoMapper extends BaseMapperPlus<KnowledgeInfo, KnowledgeInfoVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.KnowledgeRoleGroup;
|
||||
import org.ruoyi.domain.vo.KnowledgeRoleGroupVo;
|
||||
@@ -10,6 +11,7 @@ import org.ruoyi.domain.vo.KnowledgeRoleGroupVo;
|
||||
* @author ageerle
|
||||
* @date 2025-07-19
|
||||
*/
|
||||
@Mapper
|
||||
public interface KnowledgeRoleGroupMapper extends BaseMapperPlus<KnowledgeRoleGroup, KnowledgeRoleGroupVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.domain.KnowledgeRole;
|
||||
import org.ruoyi.domain.vo.KnowledgeRoleVo;
|
||||
@@ -10,6 +11,7 @@ import org.ruoyi.domain.vo.KnowledgeRoleVo;
|
||||
* @author ageerle
|
||||
* @date 2025-07-19
|
||||
*/
|
||||
@Mapper
|
||||
public interface KnowledgeRoleMapper extends BaseMapperPlus<KnowledgeRole, KnowledgeRoleVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.ruoyi.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
@@ -15,6 +16,7 @@ import java.util.List;
|
||||
* @author ageerle
|
||||
* @date 2025-07-19
|
||||
*/
|
||||
@Mapper
|
||||
public interface KnowledgeRoleRelationMapper extends BaseMapperPlus<KnowledgeRoleRelation, KnowledgeRoleRelationVo> {
|
||||
@Select("SELECT knowledge_id FROM knowledge_role_relation WHERE knowledge_role_id = #{knowledgeRoleId}")
|
||||
List<Long> selectKnowledgeIdsByRoleId(@Param("knowledgeRoleId") Long knowledgeRoleId);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.ruoyi.system.mapper;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.system.domain.ChatConfig;
|
||||
import org.ruoyi.system.domain.vo.ChatConfigVo;
|
||||
@@ -11,6 +12,7 @@ import org.ruoyi.system.domain.vo.ChatConfigVo;
|
||||
* @author ageerle
|
||||
* @date 2025-04-08
|
||||
*/
|
||||
@Mapper
|
||||
public interface ChatConfigMapper extends BaseMapperPlus<ChatConfig, ChatConfigVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.system.domain.SysConfig;
|
||||
import org.ruoyi.system.domain.vo.SysConfigVo;
|
||||
@@ -9,6 +10,7 @@ import org.ruoyi.system.domain.vo.SysConfigVo;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysConfigMapper extends BaseMapperPlus<SysConfig, SysConfigVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.ruoyi.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.ruoyi.annotation.DataColumn;
|
||||
import org.ruoyi.annotation.DataPermission;
|
||||
@@ -16,6 +17,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.ruoyi.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.common.core.constant.UserConstants;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.system.domain.SysDictData;
|
||||
@@ -13,6 +14,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysDictDataMapper extends BaseMapperPlus<SysDictData, SysDictDataVo> {
|
||||
|
||||
default List<SysDictDataVo> selectDictDataByType(String dictType) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.system.domain.SysDictType;
|
||||
import org.ruoyi.system.domain.vo.SysDictTypeVo;
|
||||
@@ -9,6 +10,7 @@ import org.ruoyi.system.domain.vo.SysDictTypeVo;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysDictTypeMapper extends BaseMapperPlus<SysDictType, SysDictTypeVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.system.domain.SysLogininfor;
|
||||
import org.ruoyi.system.domain.vo.SysLogininforVo;
|
||||
@@ -9,6 +10,7 @@ import org.ruoyi.system.domain.vo.SysLogininforVo;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysLogininforMapper extends BaseMapperPlus<SysLogininfor, SysLogininforVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.ruoyi.system.mapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.ruoyi.common.core.constant.UserConstants;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
@@ -16,6 +17,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysMenuMapper extends BaseMapperPlus<SysMenu, SysMenuVo> {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.system.domain.SysNotice;
|
||||
import org.ruoyi.system.domain.vo.SysNoticeVo;
|
||||
@@ -9,6 +10,7 @@ import org.ruoyi.system.domain.vo.SysNoticeVo;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysNoticeMapper extends BaseMapperPlus<SysNotice, SysNoticeVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.system.domain.SysNoticeState;
|
||||
import org.ruoyi.system.domain.vo.SysNoticeStateVo;
|
||||
@@ -10,6 +11,7 @@ import org.ruoyi.system.domain.vo.SysNoticeStateVo;
|
||||
* @author Lion Li
|
||||
* @date 2024-05-11
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysNoticeStateMapper extends BaseMapperPlus<SysNoticeState, SysNoticeStateVo> {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.system.domain.SysOperLog;
|
||||
import org.ruoyi.system.domain.vo.SysOperLogVo;
|
||||
@@ -9,6 +10,7 @@ import org.ruoyi.system.domain.vo.SysOperLogVo;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysOperLogMapper extends BaseMapperPlus<SysOperLog, SysOperLogVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.system.domain.SysOssConfig;
|
||||
import org.ruoyi.system.domain.vo.SysOssConfigVo;
|
||||
@@ -11,6 +12,7 @@ import org.ruoyi.system.domain.vo.SysOssConfigVo;
|
||||
* @author 孤舟烟雨
|
||||
* @date 2021-08-13
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysOssConfigMapper extends BaseMapperPlus<SysOssConfig, SysOssConfigVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.system.domain.SysOss;
|
||||
import org.ruoyi.system.domain.vo.SysOssVo;
|
||||
@@ -9,5 +10,6 @@ import org.ruoyi.system.domain.vo.SysOssVo;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysOssMapper extends BaseMapperPlus<SysOss, SysOssVo> {
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.system.domain.SysPost;
|
||||
import org.ruoyi.system.domain.vo.SysPostVo;
|
||||
@@ -11,6 +12,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysPostMapper extends BaseMapperPlus<SysPost, SysPostVo> {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.system.domain.SysRoleDept;
|
||||
|
||||
@@ -8,6 +9,7 @@ import org.ruoyi.system.domain.SysRoleDept;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysRoleDeptMapper extends BaseMapperPlus<SysRoleDept, SysRoleDept> {
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.ruoyi.system.mapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.ruoyi.annotation.DataColumn;
|
||||
import org.ruoyi.annotation.DataPermission;
|
||||
@@ -17,6 +18,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysRoleMapper extends BaseMapperPlus<SysRole, SysRoleVo> {
|
||||
|
||||
@DataPermission({
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.system.domain.SysRoleMenu;
|
||||
|
||||
@@ -8,6 +9,7 @@ import org.ruoyi.system.domain.SysRoleMenu;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysRoleMenuMapper extends BaseMapperPlus<SysRoleMenu, SysRoleMenu> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.system.domain.SysTenant;
|
||||
import org.ruoyi.system.domain.vo.SysTenantVo;
|
||||
@@ -9,6 +10,7 @@ import org.ruoyi.system.domain.vo.SysTenantVo;
|
||||
*
|
||||
* @author Michelle.Chung
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysTenantMapper extends BaseMapperPlus<SysTenant, SysTenantVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.system.domain.SysTenantPackage;
|
||||
import org.ruoyi.system.domain.vo.SysTenantPackageVo;
|
||||
@@ -9,6 +10,7 @@ import org.ruoyi.system.domain.vo.SysTenantPackageVo;
|
||||
*
|
||||
* @author Michelle.Chung
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysTenantPackageMapper extends BaseMapperPlus<SysTenantPackage, SysTenantPackageVo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.ruoyi.annotation.DataColumn;
|
||||
import org.ruoyi.annotation.DataPermission;
|
||||
@@ -19,6 +20,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysUserMapper extends BaseMapperPlus<SysUser, SysUserVo> {
|
||||
|
||||
@DataPermission({
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.system.domain.SysUserPost;
|
||||
|
||||
@@ -8,6 +9,7 @@ import org.ruoyi.system.domain.SysUserPost;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysUserPostMapper extends BaseMapperPlus<SysUserPost, SysUserPost> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.system.domain.SysUserRole;
|
||||
|
||||
@@ -10,6 +11,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysUserRoleMapper extends BaseMapperPlus<SysUserRole, SysUserRole> {
|
||||
|
||||
List<Long> selectUserIdsByRoleId(Long roleId);
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.ruoyi.generator.event;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 数据模型添加事件
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Getter
|
||||
public class SchemaDeletedEvent extends ApplicationEvent {
|
||||
|
||||
private final Collection<Long> schemaIds;
|
||||
|
||||
public SchemaDeletedEvent(Object source, Collection<Long> schemaIds) {
|
||||
super(source);
|
||||
this.schemaIds = schemaIds;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import org.springframework.context.event.EventListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 数据模型事件监听器
|
||||
*
|
||||
@@ -28,15 +30,36 @@ public class SchemaEventListener {
|
||||
try {
|
||||
Long schemaId = event.getSchemaId();
|
||||
String tableName = event.getTableName();
|
||||
log.info("开始为数据模型 {} 自动插入字段数据,表名: {}", schemaId, tableName);
|
||||
log.info("开始为数据模型字段 {} 自动插入字段数据,表名: {}", schemaId, tableName);
|
||||
boolean success = schemaFieldService.batchInsertFieldsByTableName(schemaId, tableName);
|
||||
if (success) {
|
||||
log.info("数据模型 {} 字段数据插入成功", schemaId);
|
||||
log.info("数据模型字段 {} 字段数据插入成功", schemaId);
|
||||
} else {
|
||||
log.warn("数据模型 {} 字段数据插入失败", schemaId);
|
||||
log.warn("数据模型字段 {} 字段数据插入失败", schemaId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("自动插入字段数据失败: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 监听数据模型添加事件,自动插入字段数据
|
||||
*/
|
||||
@Async
|
||||
@EventListener
|
||||
public void handleSchemaDeletedEvent(SchemaDeletedEvent event) {
|
||||
try {
|
||||
Collection<Long> schemaIds = event.getSchemaIds();
|
||||
log.info("开始为数据模型字段 {} 自动删除字段数据", schemaIds);
|
||||
boolean success = schemaFieldService.deleteWithValidBySchemaIds(schemaIds, true);
|
||||
if (success) {
|
||||
log.info("数据模型字段 {} 字段数据删除成功", schemaIds);
|
||||
} else {
|
||||
log.warn("数据模型字段 {} 字段数据删除失败", schemaIds);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("自动删除字段数据失败: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.ruoyi.generator.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.velocity.Template;
|
||||
@@ -10,11 +10,11 @@ import org.apache.velocity.VelocityContext;
|
||||
import org.apache.velocity.app.Velocity;
|
||||
import org.ruoyi.common.core.constant.Constants;
|
||||
import org.ruoyi.generator.config.GenConfig;
|
||||
import org.ruoyi.generator.domain.vo.SchemaFieldVo;
|
||||
import org.ruoyi.generator.domain.vo.SchemaVo;
|
||||
import org.ruoyi.generator.service.IGenTableService;
|
||||
import org.ruoyi.generator.service.SchemaFieldService;
|
||||
import org.ruoyi.generator.service.SchemaService;
|
||||
import org.ruoyi.generator.domain.vo.SchemaFieldVo;
|
||||
import org.ruoyi.generator.domain.vo.SchemaVo;
|
||||
import org.ruoyi.generator.util.VelocityInitializer;
|
||||
import org.ruoyi.generator.util.VelocityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -42,7 +42,6 @@ import java.util.Set;
|
||||
@Service
|
||||
public class GenTableServiceImpl implements IGenTableService {
|
||||
|
||||
private final IdentifierGenerator identifierGenerator;
|
||||
private final SchemaService schemaService;
|
||||
private final SchemaFieldService schemaFieldService;
|
||||
|
||||
@@ -177,7 +176,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
||||
// 生成菜单ID
|
||||
List<Long> menuIds = new ArrayList<>();
|
||||
for (int i = 0; i < 6; i++) {
|
||||
menuIds.add(identifierGenerator.nextId(null).longValue());
|
||||
menuIds.add(IdUtil.getSnowflakeNextId());
|
||||
}
|
||||
context.put("menuIds", menuIds);
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 数据模型字段Service业务层处理
|
||||
@@ -168,6 +169,21 @@ public class SchemaFieldServiceImpl implements SchemaFieldService {
|
||||
return queryListBySchemaId(schema.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteWithValidBySchemaIds(Collection<Long> schemaIds, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
// 先根据Schema ID查询字段列表
|
||||
List<SchemaField> fields = baseMapper.selectList(Wrappers.lambdaQuery(SchemaField.class)
|
||||
.eq(SchemaField::getSchemaId, schemaIds));
|
||||
if (CollUtil.isEmpty(fields)) {
|
||||
return false;
|
||||
}
|
||||
// 再根据字段ID删除
|
||||
return deleteWithValidByIds(fields.stream().map(SchemaField::getId).collect(Collectors.toList()), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据表名获取代码生成元数据
|
||||
*/
|
||||
@@ -371,8 +387,8 @@ public class SchemaFieldServiceImpl implements SchemaFieldService {
|
||||
}
|
||||
|
||||
// 如果是范围查询且为日期时间类型,使用 RangePicker
|
||||
if ("BETWEEN".equals(queryType) &&
|
||||
("datetime".equals(htmlType) || "date".equals(htmlType) || "time".equals(htmlType))) {
|
||||
if ("BETWEEN".equals(queryType) &&
|
||||
("datetime".equals(htmlType) || "date".equals(htmlType) || "time".equals(htmlType))) {
|
||||
return "RangePicker";
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.ruoyi.common.core.utils.MapstructUtils;
|
||||
import org.ruoyi.common.core.utils.StringUtils;
|
||||
import org.ruoyi.core.page.PageQuery;
|
||||
import org.ruoyi.core.page.TableDataInfo;
|
||||
import org.ruoyi.generator.event.SchemaDeletedEvent;
|
||||
import org.ruoyi.generator.service.SchemaService;
|
||||
import org.ruoyi.generator.domain.Schema;
|
||||
import org.ruoyi.generator.domain.bo.SchemaBo;
|
||||
@@ -114,7 +115,9 @@ public class SchemaServiceImpl implements SchemaService {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
baseMapper.deleteBatchIds(ids);
|
||||
eventPublisher.publishEvent(new SchemaDeletedEvent(this, ids));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.ruoyi.generator.mapper;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.generator.domain.SchemaField;
|
||||
import org.ruoyi.generator.domain.vo.SchemaFieldVo;
|
||||
@@ -11,6 +12,7 @@ import org.ruoyi.generator.domain.vo.SchemaFieldVo;
|
||||
* @author ruoyi
|
||||
* @date 2024-01-01
|
||||
*/
|
||||
@Mapper
|
||||
public interface SchemaFieldMapper extends BaseMapperPlus<SchemaField, SchemaFieldVo> {
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.generator.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.generator.domain.SchemaGroup;
|
||||
import org.ruoyi.generator.domain.vo.SchemaGroupVo;
|
||||
@@ -10,6 +11,7 @@ import org.ruoyi.generator.domain.vo.SchemaGroupVo;
|
||||
* @author ruoyi
|
||||
* @date 2024-01-01
|
||||
*/
|
||||
@Mapper
|
||||
public interface SchemaGroupMapper extends BaseMapperPlus<SchemaGroup, SchemaGroupVo> {
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.ruoyi.generator.mapper;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.ruoyi.core.mapper.BaseMapperPlus;
|
||||
import org.ruoyi.generator.domain.Schema;
|
||||
import org.ruoyi.generator.domain.vo.SchemaVo;
|
||||
@@ -11,6 +12,7 @@ import org.ruoyi.generator.domain.vo.SchemaVo;
|
||||
* @author ruoyi
|
||||
* @date 2024-01-01
|
||||
*/
|
||||
@Mapper
|
||||
public interface SchemaMapper extends BaseMapperPlus<Schema, SchemaVo> {
|
||||
|
||||
}
|
||||
@@ -71,4 +71,14 @@ public interface SchemaFieldService {
|
||||
* @return 字段列表
|
||||
*/
|
||||
List<SchemaFieldVo> queryListByTableName(String tableName);
|
||||
|
||||
|
||||
/**
|
||||
* 校验并根据数据模型ID批量删除数据模型字段信息
|
||||
*
|
||||
* @param schemaIds 数据模型ID列表
|
||||
* @param isValid 是否校验
|
||||
* @return 结果
|
||||
*/
|
||||
Boolean deleteWithValidBySchemaIds(Collection<Long> schemaIds, Boolean isValid);
|
||||
}
|
||||
Reference in New Issue
Block a user