!118 为Transactional注解设置rollback属性
Merge pull request !118 from zendwang/dev
This commit is contained in:
commit
7aea32f48b
@ -125,7 +125,7 @@ public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTabl
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = { Exception.class })
|
||||||
public void updateGenTable(GenTable genTable) {
|
public void updateGenTable(GenTable genTable) {
|
||||||
String options = JsonUtils.toJsonString(genTable.getParams());
|
String options = JsonUtils.toJsonString(genTable.getParams());
|
||||||
genTable.setOptions(options);
|
genTable.setOptions(options);
|
||||||
@ -144,7 +144,7 @@ public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTabl
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = { Exception.class })
|
||||||
public void deleteGenTableByIds(Long[] tableIds) {
|
public void deleteGenTableByIds(Long[] tableIds) {
|
||||||
List<Long> ids = Arrays.asList(tableIds);
|
List<Long> ids = Arrays.asList(tableIds);
|
||||||
removeByIds(ids);
|
removeByIds(ids);
|
||||||
@ -157,7 +157,7 @@ public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTabl
|
|||||||
* @param tableList 导入表列表
|
* @param tableList 导入表列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = { Exception.class })
|
||||||
public void importGenTable(List<GenTable> tableList) {
|
public void importGenTable(List<GenTable> tableList) {
|
||||||
String operName = SecurityUtils.getUsername();
|
String operName = SecurityUtils.getUsername();
|
||||||
try {
|
try {
|
||||||
@ -271,7 +271,7 @@ public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTabl
|
|||||||
* @param tableName 表名称
|
* @param tableName 表名称
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = { Exception.class })
|
||||||
public void synchDb(String tableName) {
|
public void synchDb(String tableName) {
|
||||||
GenTable table = baseMapper.selectGenTableByName(tableName);
|
GenTable table = baseMapper.selectGenTableByName(tableName);
|
||||||
List<GenTableColumn> tableColumns = table.getColumns();
|
List<GenTableColumn> tableColumns = table.getColumns();
|
||||||
|
@ -189,7 +189,7 @@ public class SysDictTypeServiceImpl extends ServicePlusImpl<SysDictTypeMapper, S
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = { Exception.class })
|
||||||
public int updateDictType(SysDictType dict) {
|
public int updateDictType(SysDictType dict) {
|
||||||
SysDictType oldDict = getById(dict.getDictId());
|
SysDictType oldDict = getById(dict.getDictId());
|
||||||
dictDataMapper.update(null, new LambdaUpdateWrapper<SysDictData>()
|
dictDataMapper.update(null, new LambdaUpdateWrapper<SysDictData>()
|
||||||
|
@ -215,7 +215,7 @@ public class SysRoleServiceImpl extends ServicePlusImpl<SysRoleMapper, SysRole,
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = { Exception.class })
|
||||||
public int insertRole(SysRole role) {
|
public int insertRole(SysRole role) {
|
||||||
// 新增角色信息
|
// 新增角色信息
|
||||||
baseMapper.insert(role);
|
baseMapper.insert(role);
|
||||||
@ -229,7 +229,7 @@ public class SysRoleServiceImpl extends ServicePlusImpl<SysRoleMapper, SysRole,
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = { Exception.class })
|
||||||
public int updateRole(SysRole role) {
|
public int updateRole(SysRole role) {
|
||||||
// 修改角色信息
|
// 修改角色信息
|
||||||
baseMapper.updateById(role);
|
baseMapper.updateById(role);
|
||||||
@ -256,7 +256,7 @@ public class SysRoleServiceImpl extends ServicePlusImpl<SysRoleMapper, SysRole,
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = { Exception.class })
|
||||||
public int authDataScope(SysRole role) {
|
public int authDataScope(SysRole role) {
|
||||||
// 修改角色信息
|
// 修改角色信息
|
||||||
baseMapper.updateById(role);
|
baseMapper.updateById(role);
|
||||||
@ -315,7 +315,7 @@ public class SysRoleServiceImpl extends ServicePlusImpl<SysRoleMapper, SysRole,
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = { Exception.class })
|
||||||
public int deleteRoleById(Long roleId) {
|
public int deleteRoleById(Long roleId) {
|
||||||
// 删除角色与菜单关联
|
// 删除角色与菜单关联
|
||||||
roleMenuMapper.delete(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, roleId));
|
roleMenuMapper.delete(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, roleId));
|
||||||
@ -331,7 +331,7 @@ public class SysRoleServiceImpl extends ServicePlusImpl<SysRoleMapper, SysRole,
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = { Exception.class })
|
||||||
public int deleteRoleByIds(Long[] roleIds) {
|
public int deleteRoleByIds(Long[] roleIds) {
|
||||||
for (Long roleId : roleIds) {
|
for (Long roleId : roleIds) {
|
||||||
checkRoleAllowed(new SysRole(roleId));
|
checkRoleAllowed(new SysRole(roleId));
|
||||||
|
@ -242,7 +242,7 @@ public class SysUserServiceImpl extends ServicePlusImpl<SysUserMapper, SysUser,
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = { Exception.class })
|
||||||
public int insertUser(SysUser user) {
|
public int insertUser(SysUser user) {
|
||||||
// 新增用户信息
|
// 新增用户信息
|
||||||
int rows = baseMapper.insert(user);
|
int rows = baseMapper.insert(user);
|
||||||
@ -271,7 +271,7 @@ public class SysUserServiceImpl extends ServicePlusImpl<SysUserMapper, SysUser,
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = { Exception.class })
|
||||||
public int updateUser(SysUser user) {
|
public int updateUser(SysUser user) {
|
||||||
Long userId = user.getUserId();
|
Long userId = user.getUserId();
|
||||||
// 删除用户与角色关联
|
// 删除用户与角色关联
|
||||||
@ -292,7 +292,7 @@ public class SysUserServiceImpl extends ServicePlusImpl<SysUserMapper, SysUser,
|
|||||||
* @param roleIds 角色组
|
* @param roleIds 角色组
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = { Exception.class })
|
||||||
public void insertUserAuth(Long userId, Long[] roleIds) {
|
public void insertUserAuth(Long userId, Long[] roleIds) {
|
||||||
userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>()
|
userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>()
|
||||||
.eq(SysUserRole::getUserId, userId));
|
.eq(SysUserRole::getUserId, userId));
|
||||||
@ -435,7 +435,7 @@ public class SysUserServiceImpl extends ServicePlusImpl<SysUserMapper, SysUser,
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = { Exception.class })
|
||||||
public int deleteUserById(Long userId) {
|
public int deleteUserById(Long userId) {
|
||||||
// 删除用户与角色关联
|
// 删除用户与角色关联
|
||||||
userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId));
|
userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId));
|
||||||
@ -451,7 +451,7 @@ public class SysUserServiceImpl extends ServicePlusImpl<SysUserMapper, SysUser,
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(rollbackFor = { Exception.class })
|
||||||
public int deleteUserByIds(Long[] userIds) {
|
public int deleteUserByIds(Long[] userIds) {
|
||||||
for (Long userId : userIds) {
|
for (Long userId : userIds) {
|
||||||
checkUserAllowed(new SysUser(userId));
|
checkUserAllowed(new SysUser(userId));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user