Skip to content

Commit

Permalink
style: 移除部分方法中仅有单个非读操作的事务处理
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles7c committed Dec 25, 2023
1 parent 55effa3 commit b85d692
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes
private UserService userService;

@Override
@Transactional(rollbackFor = Exception.class)
public Long add(DeptReq req) {
String name = req.getName();
boolean isExists = this.isNameExists(name, req.getParentId(), null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import top.charles7c.continew.admin.common.constant.CacheConstants;
import top.charles7c.continew.admin.common.model.resp.LabelValueResp;
Expand Down Expand Up @@ -53,7 +52,6 @@ public class DictItemServiceImpl

@Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class)
public Long add(DictItemReq req) {
String value = req.getValue();
CheckUtils.throwIf(this.isValueExists(value, null, req.getDictId()), "新增失败,字典值 [{}] 已存在", value);
Expand All @@ -62,7 +60,6 @@ public Long add(DictItemReq req) {

@Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class)
public void update(DictItemReq req, Long id) {
String value = req.getValue();
CheckUtils.throwIf(this.isValueExists(value, id, req.getDictId()), "修改失败,字典值 [{}] 已存在", value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public class DictServiceImpl extends BaseServiceImpl<DictMapper, DictDO, DictRes
private final DictItemService dictItemService;

@Override
@Transactional(rollbackFor = Exception.class)
public Long add(DictReq req) {
String name = req.getName();
CheckUtils.throwIf(this.isNameExists(name, null), "新增失败,[{}] 已存在", name);
Expand All @@ -65,7 +64,6 @@ public Long add(DictReq req) {
}

@Override
@Transactional(rollbackFor = Exception.class)
public void update(DictReq req, Long id) {
String name = req.getName();
CheckUtils.throwIf(this.isNameExists(name, id), "修改失败,[{}] 已存在", name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public class MenuServiceImpl extends BaseServiceImpl<MenuMapper, MenuDO, MenuRes

@Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class)
public Long add(MenuReq req) {
String title = req.getTitle();
CheckUtils.throwIf(this.isNameExists(title, req.getParentId(), null), "新增失败,[{}] 已存在", title);
Expand All @@ -63,7 +62,6 @@ public Long add(MenuReq req) {

@Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class)
public void update(MenuReq req, Long id) {
String title = req.getTitle();
CheckUtils.throwIf(this.isNameExists(title, req.getParentId(), id), "修改失败,[{}] 已存在", title);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,13 @@ public String uploadAvatar(MultipartFile avatarFile, Long id) {
}

@Override
@Transactional(rollbackFor = Exception.class)
public void updateBasicInfo(UserBasicInfoUpdateReq updateReq, Long id) {
super.getById(id);
baseMapper.lambdaUpdate().set(UserDO::getNickname, updateReq.getNickname())
.set(UserDO::getGender, updateReq.getGender()).eq(UserDO::getId, id).update();
}

@Override
@Transactional(rollbackFor = Exception.class)
public void updatePassword(String oldPassword, String newPassword, Long id) {
CheckUtils.throwIfEqual(newPassword, oldPassword, "新密码不能与当前密码相同");
UserDO user = super.getById(id);
Expand All @@ -223,7 +221,6 @@ public void updatePhone(String newPhone, String currentPassword, Long id) {
}

@Override
@Transactional(rollbackFor = Exception.class)
public void updateEmail(String newEmail, String currentPassword, Long id) {
UserDO user = super.getById(id);
CheckUtils.throwIfNotEqual(SecureUtils.md5Salt(currentPassword, id.toString()), user.getPassword(), "当前密码错误");
Expand All @@ -235,7 +232,6 @@ public void updateEmail(String newEmail, String currentPassword, Long id) {
}

@Override
@Transactional(rollbackFor = Exception.class)
public void resetPassword(Long id) {
UserDO user = super.getById(id);
user.setPassword(SecureUtils.md5Salt(SysConstants.DEFAULT_PASSWORD, id.toString()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import lombok.RequiredArgsConstructor;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.hutool.json.JSONUtil;

Expand Down Expand Up @@ -54,7 +53,6 @@ public UserSocialDO getBySourceAndOpenId(String source, String openId) {
}

@Override
@Transactional(rollbackFor = Exception.class)
public void saveOrUpdate(UserSocialDO userSocial) {
if (null == userSocial.getCreateTime()) {
baseMapper.insert(userSocial);
Expand Down

0 comments on commit b85d692

Please sign in to comment.