mirror of https://gitee.com/stylefeng/roses
【7.2.5】【框架】修复升级mp带来的count()类型转化问题
parent
b3b8948531
commit
1a5eac80ee
|
@ -24,6 +24,7 @@
|
||||||
*/
|
*/
|
||||||
package cn.stylefeng.roses.kernel.db.mp.dboperator;
|
package cn.stylefeng.roses.kernel.db.mp.dboperator;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.stylefeng.roses.kernel.db.api.DbOperatorApi;
|
import cn.stylefeng.roses.kernel.db.api.DbOperatorApi;
|
||||||
import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
|
import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
|
||||||
|
@ -44,7 +45,8 @@ public class DbOperatorImpl implements DbOperatorApi {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int selectCount(String sql, Object... args) {
|
public int selectCount(String sql, Object... args) {
|
||||||
return SqlRunner.db().selectCount(sql, args);
|
long selectCount = SqlRunner.db().selectCount(sql, args);
|
||||||
|
return Convert.toInt(selectCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -377,7 +377,7 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
|
||||||
LambdaQueryWrapper<SysFileInfo> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysFileInfo> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(SysFileInfo::getFileObjectName, sysFileInfoRequest.getFileObjectName());
|
wrapper.eq(SysFileInfo::getFileObjectName, sysFileInfoRequest.getFileObjectName());
|
||||||
wrapper.eq(SysFileInfo::getSecretFlag, YesOrNotEnum.Y.getCode());
|
wrapper.eq(SysFileInfo::getSecretFlag, YesOrNotEnum.Y.getCode());
|
||||||
int count = this.count(wrapper);
|
long count = this.count(wrapper);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
if (!LoginContext.me().hasLogin()) {
|
if (!LoginContext.me().hasLogin()) {
|
||||||
throw new FileException(FileExceptionEnum.FILE_PERMISSION_DENIED);
|
throw new FileException(FileExceptionEnum.FILE_PERMISSION_DENIED);
|
||||||
|
|
|
@ -553,14 +553,14 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||||
|
|
||||||
LambdaQueryWrapper<Customer> accountWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Customer> accountWrapper = new LambdaQueryWrapper<>();
|
||||||
accountWrapper.eq(Customer::getAccount, customerRequest.getAccount());
|
accountWrapper.eq(Customer::getAccount, customerRequest.getAccount());
|
||||||
int count = this.count(accountWrapper);
|
long count = this.count(accountWrapper);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
throw new CustomerException(CustomerExceptionEnum.ACCOUNT_REPEAT);
|
throw new CustomerException(CustomerExceptionEnum.ACCOUNT_REPEAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
LambdaQueryWrapper<Customer> emailWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Customer> emailWrapper = new LambdaQueryWrapper<>();
|
||||||
emailWrapper.eq(Customer::getEmail, customerRequest.getEmail());
|
emailWrapper.eq(Customer::getEmail, customerRequest.getEmail());
|
||||||
int emailCount = this.count(emailWrapper);
|
long emailCount = this.count(emailWrapper);
|
||||||
if (emailCount > 0) {
|
if (emailCount > 0) {
|
||||||
throw new CustomerException(CustomerExceptionEnum.EMAIL_REPEAT);
|
throw new CustomerException(CustomerExceptionEnum.EMAIL_REPEAT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,7 +281,7 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, SysDict> implements
|
||||||
sysDictLambdaQueryWrapper.ne(SysDict::getDictId, dictRequest.getDictId());
|
sysDictLambdaQueryWrapper.ne(SysDict::getDictId, dictRequest.getDictId());
|
||||||
}
|
}
|
||||||
sysDictLambdaQueryWrapper.ne(SysDict::getDelFlag, YesOrNotEnum.Y.getCode());
|
sysDictLambdaQueryWrapper.ne(SysDict::getDelFlag, YesOrNotEnum.Y.getCode());
|
||||||
int count = this.count(sysDictLambdaQueryWrapper);
|
long count = this.count(sysDictLambdaQueryWrapper);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
throw new DictException(DictExceptionEnum.DICT_CODE_REPEAT, dictRequest.getDictTypeCode(), dictRequest.getDictCode());
|
throw new DictException(DictExceptionEnum.DICT_CODE_REPEAT, dictRequest.getDictTypeCode(), dictRequest.getDictCode());
|
||||||
}
|
}
|
||||||
|
@ -294,7 +294,7 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, SysDict> implements
|
||||||
dictNameWrapper.ne(SysDict::getDictId, dictRequest.getDictId());
|
dictNameWrapper.ne(SysDict::getDictId, dictRequest.getDictId());
|
||||||
}
|
}
|
||||||
dictNameWrapper.ne(SysDict::getDelFlag, YesOrNotEnum.Y.getCode());
|
dictNameWrapper.ne(SysDict::getDelFlag, YesOrNotEnum.Y.getCode());
|
||||||
int dictNameCount = this.count(dictNameWrapper);
|
long dictNameCount = this.count(dictNameWrapper);
|
||||||
if (dictNameCount > 0) {
|
if (dictNameCount > 0) {
|
||||||
throw new DictException(DictExceptionEnum.DICT_NAME_REPEAT, dictRequest.getDictTypeCode(), dictRequest.getDictCode());
|
throw new DictException(DictExceptionEnum.DICT_NAME_REPEAT, dictRequest.getDictTypeCode(), dictRequest.getDictCode());
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
package cn.stylefeng.roses.kernel.message.db.service.impl;
|
package cn.stylefeng.roses.kernel.message.db.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
||||||
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
||||||
|
@ -96,7 +97,8 @@ public class SysMessageServiceImpl extends ServiceImpl<SysMessageMapper, SysMess
|
||||||
@Override
|
@Override
|
||||||
public Integer findCount(MessageRequest messageRequest) {
|
public Integer findCount(MessageRequest messageRequest) {
|
||||||
LambdaQueryWrapper<SysMessage> wrapper = createWrapper(messageRequest, false);
|
LambdaQueryWrapper<SysMessage> wrapper = createWrapper(messageRequest, false);
|
||||||
return this.count(wrapper);
|
long count = this.count(wrapper);
|
||||||
|
return Convert.toInt(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.home.service.impl;
|
package cn.stylefeng.roses.kernel.system.modular.home.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
|
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
|
||||||
|
@ -121,7 +122,8 @@ public class HomePageServiceImpl implements HomePageService, HomePageServiceApi
|
||||||
HomeCompanyInfo homeCompanyInfo = new HomeCompanyInfo();
|
HomeCompanyInfo homeCompanyInfo = new HomeCompanyInfo();
|
||||||
|
|
||||||
// 获取组织机构总数量
|
// 获取组织机构总数量
|
||||||
homeCompanyInfo.setOrganizationNum(hrOrganizationService.count());
|
long count = hrOrganizationService.count();
|
||||||
|
homeCompanyInfo.setOrganizationNum(Convert.toInt(count));
|
||||||
|
|
||||||
// 获取企业人员总数量
|
// 获取企业人员总数量
|
||||||
SysUserRequest sysUserRequest = new SysUserRequest();
|
SysUserRequest sysUserRequest = new SysUserRequest();
|
||||||
|
@ -147,8 +149,8 @@ public class HomePageServiceImpl implements HomePageService, HomePageServiceApi
|
||||||
|
|
||||||
// 设置当前所属机构和所有子机构的人数
|
// 设置当前所属机构和所有子机构的人数
|
||||||
List<Long> orgIds = organizations.stream().map(HrOrganization::getOrgId).collect(Collectors.toList());
|
List<Long> orgIds = organizations.stream().map(HrOrganization::getOrgId).collect(Collectors.toList());
|
||||||
int currentOrgPersonNum = sysUserOrgService.count(Wrappers.lambdaQuery(SysUserOrg.class).in(SysUserOrg::getOrgId, orgIds));
|
Long currentOrgPersonNum = sysUserOrgService.count(Wrappers.lambdaQuery(SysUserOrg.class).in(SysUserOrg::getOrgId, orgIds));
|
||||||
homeCompanyInfo.setCurrentCompanyPersonNum(currentOrgPersonNum);
|
homeCompanyInfo.setCurrentCompanyPersonNum(Convert.toInt(currentOrgPersonNum));
|
||||||
|
|
||||||
return homeCompanyInfo;
|
return homeCompanyInfo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ package cn.stylefeng.roses.kernel.system.modular.organization.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.bean.copier.CopyOptions;
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
||||||
|
@ -131,7 +132,7 @@ public class HrPositionServiceImpl extends ServiceImpl<HrPositionMapper, HrPosit
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer positionNum() {
|
public Integer positionNum() {
|
||||||
return this.count();
|
return Convert.toInt(this.count());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.resource.service.impl;
|
package cn.stylefeng.roses.kernel.system.modular.resource.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.stylefeng.roses.kernel.auth.api.LoginUserApi;
|
import cn.stylefeng.roses.kernel.auth.api.LoginUserApi;
|
||||||
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
|
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
|
||||||
|
@ -229,10 +230,7 @@ public class SysResourceServiceImpl extends ServiceImpl<SysResourceMapper, SysRe
|
||||||
|
|
||||||
// 查询条件
|
// 查询条件
|
||||||
if (ObjectUtil.isNotEmpty(resourceRequest.getResourceName())) {
|
if (ObjectUtil.isNotEmpty(resourceRequest.getResourceName())) {
|
||||||
sysResourceLambdaQueryWrapper
|
sysResourceLambdaQueryWrapper.like(SysResource::getUrl, resourceRequest.getResourceName()).or().like(SysResource::getResourceName, resourceRequest.getResourceName());
|
||||||
.like(SysResource::getUrl, resourceRequest.getResourceName())
|
|
||||||
.or()
|
|
||||||
.like(SysResource::getResourceName, resourceRequest.getResourceName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SysResource> allResource = this.list(sysResourceLambdaQueryWrapper);
|
List<SysResource> allResource = this.list(sysResourceLambdaQueryWrapper);
|
||||||
|
@ -380,7 +378,8 @@ public class SysResourceServiceImpl extends ServiceImpl<SysResourceMapper, SysRe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getResourceCount() {
|
public Integer getResourceCount() {
|
||||||
return this.count();
|
long count = this.count();
|
||||||
|
return Convert.toInt(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class SysThemeTemplateServiceImpl extends ServiceImpl<SysThemeTemplateMap
|
||||||
// 系统主题模板被使用,不允许禁用
|
// 系统主题模板被使用,不允许禁用
|
||||||
LambdaQueryWrapper<SysTheme> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysTheme> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(SysTheme::getTemplateId, sysThemeTemplate.getTemplateId());
|
queryWrapper.eq(SysTheme::getTemplateId, sysThemeTemplate.getTemplateId());
|
||||||
int sysThemeNum = sysThemeService.count(queryWrapper);
|
long sysThemeNum = sysThemeService.count(queryWrapper);
|
||||||
if (sysThemeNum > 0) {
|
if (sysThemeNum > 0) {
|
||||||
throw new SystemModularException(SysThemeTemplateExceptionEnum.TEMPLATE_IS_USED);
|
throw new SystemModularException(SysThemeTemplateExceptionEnum.TEMPLATE_IS_USED);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue