mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-24 16:05:08 +08:00
适配 Oracle 数据库
1. 去除关键字,避免数据库的查询冲突
This commit is contained in:
@ -35,7 +35,6 @@ public class DictTypeDO extends BaseDO {
|
||||
/**
|
||||
* 字典类型
|
||||
*/
|
||||
@TableField("\"type\"")
|
||||
private String type;
|
||||
/**
|
||||
* 状态
|
||||
|
@ -72,7 +72,6 @@ public class OperateLogDO extends BaseDO {
|
||||
*
|
||||
* 枚举 {@link OperateTypeEnum}
|
||||
*/
|
||||
@TableField("operate_type")
|
||||
private Integer type;
|
||||
/**
|
||||
* 操作内容,记录整个操作的明细
|
||||
|
@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.system.enums.notice.NoticeTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@ -33,7 +32,6 @@ public class NoticeDO extends BaseDO {
|
||||
*
|
||||
* 枚举 {@link NoticeTypeEnum}
|
||||
*/
|
||||
@TableField("\"type\"")
|
||||
private Integer type;
|
||||
/**
|
||||
* 公告内容
|
||||
|
@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.system.enums.permission.MenuTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
@ -46,7 +45,6 @@ public class MenuDO extends BaseDO {
|
||||
*
|
||||
* 枚举 {@link MenuTypeEnum}
|
||||
*/
|
||||
@TableField("menu_type")
|
||||
private Integer type;
|
||||
/**
|
||||
* 显示顺序
|
||||
|
@ -30,7 +30,7 @@ public interface DeptMapper extends BaseMapperX<DeptDO> {
|
||||
return selectCount(DeptDO::getParentId, parentId);
|
||||
}
|
||||
|
||||
@Select("SELECT id FROM system_dept WHERE update_time > #{maxUpdateTime} LIMIT 1")
|
||||
Long selectExistsByUpdateTimeAfter(Date maxUpdateTime);
|
||||
@Select("SELECT COUNT(*) FROM system_dept WHERE update_time > #{maxUpdateTime}")
|
||||
Long selectCountByUpdateTimeGt(Date maxUpdateTime);
|
||||
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public interface DictDataMapper extends BaseMapperX<DictDataDO> {
|
||||
.eqIfPresent(DictDataDO::getStatus, reqVO.getStatus()));
|
||||
}
|
||||
|
||||
@Select("SELECT id FROM system_dict_data WHERE update_time > #{maxUpdateTime} LIMIT 1")
|
||||
Long selectExistsByUpdateTimeAfter(Date maxUpdateTime);
|
||||
@Select("SELECT COUNT(*) FROM system_dict_data WHERE update_time > #{maxUpdateTime}")
|
||||
Long selectCountByUpdateTimeGt(Date maxUpdateTime);
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public interface MenuMapper extends BaseMapperX<MenuDO> {
|
||||
.eqIfPresent(MenuDO::getStatus, reqVO.getStatus()));
|
||||
}
|
||||
|
||||
@Select("SELECT id FROM system_menu WHERE update_time > #{maxUpdateTime} LIMIT 1")
|
||||
MenuDO selectExistsByUpdateTimeAfter(Date maxUpdateTime);
|
||||
@Select("SELECT COUNT(*) FROM system_menu WHERE update_time > #{maxUpdateTime}")
|
||||
Long selectCountByUpdateTimeGt(Date maxUpdateTime);
|
||||
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public interface RoleMapper extends BaseMapperX<RoleDO> {
|
||||
return selectList(RoleDO::getStatus, statuses);
|
||||
}
|
||||
|
||||
@Select("SELECT id FROM system_role WHERE update_time > #{maxUpdateTime} LIMIT 1")
|
||||
RoleDO selectExistsByUpdateTimeAfter(Date maxUpdateTime);
|
||||
@Select("SELECT COUNT(*) FROM system_role WHERE update_time > #{maxUpdateTime}")
|
||||
Long selectCountByUpdateTimeGt(Date maxUpdateTime);
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import org.springframework.stereotype.Repository;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Mapper
|
||||
public interface RoleMenuMapper extends BaseMapperX<RoleMenuDO> {
|
||||
@ -37,7 +36,7 @@ public interface RoleMenuMapper extends BaseMapperX<RoleMenuDO> {
|
||||
delete(new QueryWrapper<RoleMenuDO>().eq("role_id", roleId));
|
||||
}
|
||||
|
||||
@Select("SELECT id FROM system_role_menu WHERE update_time > #{maxUpdateTime} LIMIT 1")
|
||||
Long selectExistsByUpdateTimeAfter(Date maxUpdateTime);
|
||||
@Select("SELECT COUNT(*) FROM system_role_menu WHERE update_time > #{maxUpdateTime}")
|
||||
Long selectCountByUpdateTimeGt(Date maxUpdateTime);
|
||||
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public interface SensitiveWordMapper extends BaseMapperX<SensitiveWordDO> {
|
||||
return selectOne(SensitiveWordDO::getName, name);
|
||||
}
|
||||
|
||||
@Select("SELECT id FROM system_sensitive_word WHERE update_time > #{maxUpdateTime} LIMIT 1")
|
||||
SensitiveWordDO selectExistsByUpdateTimeAfter(Date maxUpdateTime);
|
||||
@Select("SELECT COUNT(*) FROM system_sensitive_word WHERE update_time > #{maxUpdateTime}")
|
||||
Long selectCountByUpdateTimeGt(Date maxUpdateTime);
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public interface SmsChannelMapper extends BaseMapperX<SmsChannelDO> {
|
||||
.orderByDesc(SmsChannelDO::getId));
|
||||
}
|
||||
|
||||
@Select("SELECT id FROM system_sms_channel WHERE update_time > #{maxUpdateTime} LIMIT 1")
|
||||
Long selectExistsByUpdateTimeAfter(Date maxUpdateTime);
|
||||
@Select("SELECT COUNT(*) FROM system_sms_channel WHERE update_time > #{maxUpdateTime}")
|
||||
Long selectCountByUpdateTimeGt(Date maxUpdateTime);
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.dal.mysql.sms;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.enums.SqlConstants;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsCodeDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@ -18,9 +18,12 @@ public interface SmsCodeMapper extends BaseMapperX<SmsCodeDO> {
|
||||
* @return 手机验证码
|
||||
*/
|
||||
default SmsCodeDO selectLastByMobile(String mobile, String code, Integer scene) {
|
||||
return selectOne(new QueryWrapperX<SmsCodeDO>()
|
||||
.eq("mobile", mobile).eqIfPresent("scene", scene).eqIfPresent("code", code)
|
||||
.orderByDesc("id").last(SqlConstants.LIMIT1));
|
||||
return selectOne(new LambdaQueryWrapperX<SmsCodeDO>()
|
||||
.eq(SmsCodeDO::getCode, mobile)
|
||||
.eqIfPresent(SmsCodeDO::getScene, scene)
|
||||
.eqIfPresent(SmsCodeDO::getCode, code)
|
||||
.orderByDesc(SmsCodeDO::getId)
|
||||
.last(SqlConstants.LIMIT1));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface SmsTemplateMapper extends BaseMapperX<SmsTemplateDO> {
|
||||
|
||||
@Select("SELECT id FROM system_sms_template WHERE update_time > #{maxUpdateTime} LIMIT 1")
|
||||
Long selectExistsByUpdateTimeAfter(Date maxUpdateTime);
|
||||
@Select("SELECT COUNT(*) FROM system_sms_template WHERE update_time > #{maxUpdateTime}")
|
||||
Long selectCountByUpdateTimeGt(Date maxUpdateTime);
|
||||
|
||||
default SmsTemplateDO selectByCode(String code) {
|
||||
return selectOne(SmsTemplateDO::getCode, code);
|
||||
|
@ -52,7 +52,7 @@ public interface TenantMapper extends BaseMapperX<TenantDO> {
|
||||
return selectList(TenantDO::getPackageId, packageId);
|
||||
}
|
||||
|
||||
@Select("SELECT id FROM system_tenant WHERE update_time > #{maxUpdateTime} LIMIT 1")
|
||||
Long selectExistsByUpdateTimeAfter(Date maxUpdateTime);
|
||||
@Select("SELECT COUNT(*) FROM system_tenant WHERE update_time > #{maxUpdateTime}")
|
||||
Long selectCountByUpdateTimeGt(Date maxUpdateTime);
|
||||
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public class DeptServiceImpl implements DeptService {
|
||||
if (maxUpdateTime == null) { // 如果更新时间为空,说明 DB 一定有新数据
|
||||
log.info("[loadMenuIfUpdate][首次加载全量部门]");
|
||||
} else { // 判断数据库中是否有更新的部门
|
||||
if (deptMapper.selectExistsByUpdateTimeAfter(maxUpdateTime) == null) {
|
||||
if (deptMapper.selectCountByUpdateTimeGt(maxUpdateTime) == 0) {
|
||||
return null;
|
||||
}
|
||||
log.info("[loadMenuIfUpdate][增量加载全量部门]");
|
||||
|
@ -115,7 +115,7 @@ public class DictDataServiceImpl implements DictDataService {
|
||||
if (maxUpdateTime == null) { // 如果更新时间为空,说明 DB 一定有新数据
|
||||
log.info("[loadDictDataIfUpdate][首次加载全量字典数据]");
|
||||
} else { // 判断数据库中是否有更新的字典数据
|
||||
if (dictDataMapper.selectExistsByUpdateTimeAfter(maxUpdateTime) == null) {
|
||||
if (dictDataMapper.selectCountByUpdateTimeGt(maxUpdateTime) == 0) {
|
||||
return null;
|
||||
}
|
||||
log.info("[loadDictDataIfUpdate][增量加载全量字典数据]");
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.system.service.dict;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dict.vo.type.DictTypeCreateReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dict.vo.type.DictTypeExportReqVO;
|
||||
@ -113,6 +114,9 @@ public class DictTypeServiceImpl implements DictTypeService {
|
||||
|
||||
@VisibleForTesting
|
||||
public void checkDictTypeUnique(Long id, String type) {
|
||||
if (StrUtil.isEmpty(type)) {
|
||||
return;
|
||||
}
|
||||
DictTypeDO dictType = dictTypeMapper.selectByType(type);
|
||||
if (dictType == null) {
|
||||
return;
|
||||
|
@ -123,7 +123,7 @@ public class MenuServiceImpl implements MenuService {
|
||||
if (maxUpdateTime == null) { // 如果更新时间为空,说明 DB 一定有新数据
|
||||
log.info("[loadMenuIfUpdate][首次加载全量菜单]");
|
||||
} else { // 判断数据库中是否有更新的菜单
|
||||
if (menuMapper.selectExistsByUpdateTimeAfter(maxUpdateTime) == null) {
|
||||
if (menuMapper.selectCountByUpdateTimeGt(maxUpdateTime) == 0) {
|
||||
return null;
|
||||
}
|
||||
log.info("[loadMenuIfUpdate][增量加载全量菜单]");
|
||||
|
@ -144,7 +144,7 @@ public class PermissionServiceImpl implements PermissionService {
|
||||
if (maxUpdateTime == null) { // 如果更新时间为空,说明 DB 一定有新数据
|
||||
log.info("[loadRoleMenuIfUpdate][首次加载全量角色与菜单的关联]");
|
||||
} else { // 判断数据库中是否有更新的角色与菜单的关联
|
||||
if (Objects.isNull(roleMenuMapper.selectExistsByUpdateTimeAfter(maxUpdateTime))) {
|
||||
if (roleMenuMapper.selectCountByUpdateTimeGt(maxUpdateTime) == 0) {
|
||||
return null;
|
||||
}
|
||||
log.info("[loadRoleMenuIfUpdate][增量加载全量角色与菜单的关联]");
|
||||
|
@ -116,7 +116,7 @@ public class RoleServiceImpl implements RoleService {
|
||||
if (maxUpdateTime == null) { // 如果更新时间为空,说明 DB 一定有新数据
|
||||
log.info("[loadRoleIfUpdate][首次加载全量角色]");
|
||||
} else { // 判断数据库中是否有更新的角色
|
||||
if (roleMapper.selectExistsByUpdateTimeAfter(maxUpdateTime) == null) {
|
||||
if (roleMapper.selectCountByUpdateTimeGt(maxUpdateTime) == 0) {
|
||||
return null;
|
||||
}
|
||||
log.info("[loadRoleIfUpdate][增量加载全量角色]");
|
||||
|
@ -139,7 +139,7 @@ public class SensitiveWordServiceImpl implements SensitiveWordService {
|
||||
if (maxUpdateTime == null) {
|
||||
log.info("[loadSensitiveWordIfUpdate][首次加载全量敏感词]");
|
||||
} else { // 判断数据库中是否有更新的敏感词
|
||||
if (sensitiveWordMapper.selectExistsByUpdateTimeAfter(maxUpdateTime) == null) {
|
||||
if (sensitiveWordMapper.selectCountByUpdateTimeGt(maxUpdateTime) == 0) {
|
||||
return null;
|
||||
}
|
||||
log.info("[loadSensitiveWordIfUpdate][增量加载全量敏感词]");
|
||||
|
@ -94,7 +94,7 @@ public class SmsChannelServiceImpl implements SmsChannelService {
|
||||
if (maxUpdateTime == null) { // 如果更新时间为空,说明 DB 一定有新数据
|
||||
log.info("[loadSmsChannelIfUpdate][首次加载全量短信渠道]");
|
||||
} else { // 判断数据库中是否有更新的短信渠道
|
||||
if (smsChannelMapper.selectExistsByUpdateTimeAfter(maxUpdateTime) == null) {
|
||||
if (smsChannelMapper.selectCountByUpdateTimeGt(maxUpdateTime) == 0) {
|
||||
return null;
|
||||
}
|
||||
log.info("[loadSmsChannelIfUpdate][增量加载全量短信渠道]");
|
||||
|
@ -105,7 +105,7 @@ public class SmsTemplateServiceImpl implements SmsTemplateService {
|
||||
if (maxUpdateTime == null) { // 如果更新时间为空,说明 DB 一定有新数据
|
||||
log.info("[loadSmsTemplateIfUpdate][首次加载全量短信模板]");
|
||||
} else { // 判断数据库中是否有更新的短信模板
|
||||
if (smsTemplateMapper.selectExistsByUpdateTimeAfter(maxUpdateTime) == null) {
|
||||
if (smsTemplateMapper.selectCountByUpdateTimeGt(maxUpdateTime) == 0) {
|
||||
return null;
|
||||
}
|
||||
log.info("[loadSmsTemplateIfUpdate][增量加载全量短信模板]");
|
||||
|
@ -137,7 +137,7 @@ public class TenantServiceImpl implements TenantService {
|
||||
if (maxUpdateTime == null) { // 如果更新时间为空,说明 DB 一定有新数据
|
||||
log.info("[loadTenantIfUpdate][首次加载全量租户]");
|
||||
} else { // 判断数据库中是否有更新的租户
|
||||
if (tenantMapper.selectExistsByUpdateTimeAfter(maxUpdateTime) == null) {
|
||||
if (tenantMapper.selectCountByUpdateTimeGt(maxUpdateTime) == 0) {
|
||||
return null;
|
||||
}
|
||||
log.info("[loadTenantIfUpdate][增量加载全量租户]");
|
||||
|
Reference in New Issue
Block a user