租户管理支持乐观锁

This commit is contained in:
dataprince 2024-01-19 21:34:11 +08:00
parent ee8f101807
commit b0204c224c
5 changed files with 15 additions and 22 deletions

View File

@ -58,9 +58,10 @@ server:
# 日志配置
logging:
level:
com.ruoyi: debug
com.ruoyi: @logging.level@
org.springframework: warn
tech.powerjob.worker.background: warn
org.mybatis.spring.mapper: error
config: classpath:logback.xml
# 用户配置

View File

@ -43,20 +43,20 @@ public interface ISysTenantPackageService extends IBaseService<SysTenantPackage>
/**
* 新增租户套餐
*/
Boolean insert(SysTenantPackageBo sysTenantPackageBo);
boolean insert(SysTenantPackageBo sysTenantPackageBo);
/**
* 修改租户套餐
*/
Boolean update(SysTenantPackageBo sysTenantPackageBo);
boolean update(SysTenantPackageBo sysTenantPackageBo);
/**
* 修改套餐状态
*/
Boolean updatePackageStatus(SysTenantPackageBo sysTenantPackageBo);
boolean updatePackageStatus(SysTenantPackageBo sysTenantPackageBo);
/**
* 校验并批量删除租户套餐信息
*/
Boolean deleteByIds(Long[] packageIds, Boolean isValid);
boolean deleteByIds(Long[] packageIds, Boolean isValid);
}

View File

@ -364,11 +364,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptMapper, SysDept>
*/
@Override
public boolean deleteDeptById(Long deptId) {
//update sys_dept set del_flag = '1' where dept_id = #{deptId}
SysDept sysDept = new SysDept();
sysDept.setDeptId(deptId);
sysDept.setDelFlag(1);
return this.updateById(sysDept);
return this.removeById(deptId);
}
/**

View File

@ -104,7 +104,7 @@ public class SysTenantPackageServiceImpl extends BaseServiceImpl<SysTenantPackag
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insert(SysTenantPackageBo sysTenantPackageBo) {
public boolean insert(SysTenantPackageBo sysTenantPackageBo) {
SysTenantPackage sysTenantPackage = MapstructUtils.convert(sysTenantPackageBo, SysTenantPackage.class);
if(ObjectUtil.isNull(sysTenantPackage)){
return true;
@ -132,7 +132,7 @@ public class SysTenantPackageServiceImpl extends BaseServiceImpl<SysTenantPackag
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean update(SysTenantPackageBo sysTenantPackageBo) {
public boolean update(SysTenantPackageBo sysTenantPackageBo) {
SysTenantPackage sysTenantPackage = MapstructUtils.convert(sysTenantPackageBo, SysTenantPackage.class);
if(ObjectUtil.isNull(sysTenantPackage)){
return true;
@ -160,16 +160,15 @@ public class SysTenantPackageServiceImpl extends BaseServiceImpl<SysTenantPackag
* @return 结果
*/
@Override
public Boolean updatePackageStatus(SysTenantPackageBo sysTenantPackageBo) {
SysTenantPackage sysTenantPackage = UpdateEntity.of(SysTenantPackage.class, sysTenantPackageBo.getPackageId());
public boolean updatePackageStatus(SysTenantPackageBo sysTenantPackageBo) {
SysTenantPackage sysTenantPackage = MapstructUtils.convert(sysTenantPackageBo,SysTenantPackage.class);
Long loginUserId = LoginHelper.getUserId();
Date createTime = new Date();
sysTenantPackage.setUpdateBy(loginUserId);
sysTenantPackage.setUpdateTime(createTime);
sysTenantPackage.setStatus(sysTenantPackageBo.getStatus());
return tenantPackageMapper.update(sysTenantPackage) > 0;
return this.updateById(sysTenantPackage);
}
/**
@ -177,7 +176,7 @@ public class SysTenantPackageServiceImpl extends BaseServiceImpl<SysTenantPackag
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteByIds(Long[] packageIds, Boolean isValid) {
public boolean deleteByIds(Long[] packageIds, Boolean isValid) {
if(isValid){
boolean exists = tenantMapper.selectCountByQuery(query().where(SYS_TENANT.PACKAGE_ID.in(List.of(packageIds)))) >0;
if (exists) {

View File

@ -335,16 +335,13 @@ public class SysTenantServiceImpl extends BaseServiceImpl<SysTenantMapper, SysTe
@Override
public boolean updateTenantStatus(SysTenantBo sysTenantBo) {
return TenantHelper.ignore(() -> {
SysTenant sysTenant = UpdateEntity.of(SysTenant.class, sysTenantBo.getTenantId());
SysTenant sysTenant = MapstructUtils.convert(sysTenantBo, SysTenant.class);
Long loginUserId = LoginHelper.getUserId();
Date createTime = new Date();
sysTenant.setUpdateBy(loginUserId);
sysTenant.setUpdateTime(createTime);
sysTenant.setStatus(sysTenantBo.getStatus());
return tenantMapper.update(sysTenant) > 0;
return this.updateById(sysTenant);
});
}