|
@@ -2,6 +2,7 @@ package com.qmth.exam.reserve.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -216,16 +217,36 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
|
|
|
save(category);
|
|
|
} else {
|
|
|
updateById(category);
|
|
|
+
|
|
|
//清空教学点缓存
|
|
|
categoryCacheService.clearCategoryByIdCache(category.getId());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
@Override
|
|
|
public void enable(Long id, Boolean enable) {
|
|
|
- CategoryEntity category = getById(id);
|
|
|
- category.setEnable(enable);
|
|
|
- updateById(category);
|
|
|
+ LambdaUpdateWrapper<CategoryEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper.set(CategoryEntity::getEnable, enable);
|
|
|
+ updateWrapper.set(CategoryEntity::getUpdateTime, System.currentTimeMillis());
|
|
|
+ updateWrapper.eq(CategoryEntity::getId, id);
|
|
|
+ this.update(updateWrapper);
|
|
|
+
|
|
|
+ //清空教学点缓存
|
|
|
+ categoryCacheService.clearCategoryByIdCache(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public void selfApplyEnable(Long id, Boolean enable) {
|
|
|
+ LambdaUpdateWrapper<CategoryEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper.set(CategoryEntity::getSelfApplyEnable, enable);
|
|
|
+ updateWrapper.set(CategoryEntity::getUpdateTime, System.currentTimeMillis());
|
|
|
+ updateWrapper.eq(CategoryEntity::getId, id);
|
|
|
+ this.update(updateWrapper);
|
|
|
+
|
|
|
+ //清空教学点缓存
|
|
|
+ categoryCacheService.clearCategoryByIdCache(id);
|
|
|
}
|
|
|
|
|
|
private void checkTeaching(Long orgId, TeachingSaveReq req) {
|
|
@@ -396,6 +417,9 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
|
|
|
existCategory.setName(category.getName());
|
|
|
existCategory.setEnable(Boolean.TRUE);
|
|
|
baseMapper.updateById(existCategory);
|
|
|
+
|
|
|
+ //清空教学点缓存
|
|
|
+ categoryCacheService.clearCategoryByIdCache(existCategory.getId());
|
|
|
} else {
|
|
|
baseMapper.insert(category);
|
|
|
}
|