From 32e2e212a7729a575a3885f82803987f4daff24a Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sat, 9 Mar 2019 22:21:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8B=E5=8A=A1=E7=94=B1Controller=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=E5=88=B0Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/web/controller/system/SysRoleController.java | 4 ---- .../ruoyi/web/controller/system/SysUserController.java | 3 --- .../com/ruoyi/quartz/service/impl/SysJobServiceImpl.java | 9 +++++++++ .../ruoyi/system/service/impl/SysDeptServiceImpl.java | 2 ++ .../system/service/impl/SysDictTypeServiceImpl.java | 2 ++ .../ruoyi/system/service/impl/SysRoleServiceImpl.java | 4 ++++ .../ruoyi/system/service/impl/SysUserServiceImpl.java | 3 +++ 7 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java index 1d6572851..90dbe548f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -4,7 +4,6 @@ import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -78,7 +77,6 @@ public class SysRoleController extends BaseController @RequiresPermissions("system:role:add") @Log(title = "角色管理", businessType = BusinessType.INSERT) @PostMapping("/add") - @Transactional(rollbackFor = Exception.class) @ResponseBody public AjaxResult addSave(SysRole role) { @@ -104,7 +102,6 @@ public class SysRoleController extends BaseController @RequiresPermissions("system:role:edit") @Log(title = "角色管理", businessType = BusinessType.UPDATE) @PostMapping("/edit") - @Transactional(rollbackFor = Exception.class) @ResponseBody public AjaxResult editSave(SysRole role) { @@ -129,7 +126,6 @@ public class SysRoleController extends BaseController @RequiresPermissions("system:role:edit") @Log(title = "角色管理", businessType = BusinessType.UPDATE) @PostMapping("/rule") - @Transactional(rollbackFor = Exception.class) @ResponseBody public AjaxResult ruleSave(SysRole role) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index 77298ffc7..14533c841 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -4,7 +4,6 @@ import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -116,7 +115,6 @@ public class SysUserController extends BaseController @RequiresPermissions("system:user:add") @Log(title = "用户管理", businessType = BusinessType.INSERT) @PostMapping("/add") - @Transactional(rollbackFor = Exception.class) @ResponseBody public AjaxResult addSave(SysUser user) { @@ -148,7 +146,6 @@ public class SysUserController extends BaseController @RequiresPermissions("system:user:edit") @Log(title = "用户管理", businessType = BusinessType.UPDATE) @PostMapping("/edit") - @Transactional(rollbackFor = Exception.class) @ResponseBody public AjaxResult editSave(SysUser user) { diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java index 9031872ef..8b1bc54e9 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java @@ -6,6 +6,7 @@ import org.quartz.CronTrigger; import org.quartz.Scheduler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.ruoyi.common.constant.ScheduleConstants; import com.ruoyi.common.core.text.Convert; import com.ruoyi.quartz.domain.SysJob; @@ -80,6 +81,7 @@ public class SysJobServiceImpl implements ISysJobService * @param job 调度信息 */ @Override + @Transactional public int pauseJob(SysJob job) { job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); @@ -97,6 +99,7 @@ public class SysJobServiceImpl implements ISysJobService * @param job 调度信息 */ @Override + @Transactional public int resumeJob(SysJob job) { job.setStatus(ScheduleConstants.Status.NORMAL.getValue()); @@ -114,6 +117,7 @@ public class SysJobServiceImpl implements ISysJobService * @param job 调度信息 */ @Override + @Transactional public int deleteJob(SysJob job) { int rows = jobMapper.deleteJobById(job.getJobId()); @@ -131,6 +135,7 @@ public class SysJobServiceImpl implements ISysJobService * @return 结果 */ @Override + @Transactional public void deleteJobByIds(String ids) { Long[] jobIds = Convert.toLongArray(ids); @@ -147,6 +152,7 @@ public class SysJobServiceImpl implements ISysJobService * @param job 调度信息 */ @Override + @Transactional public int changeStatus(SysJob job) { int rows = 0; @@ -168,6 +174,7 @@ public class SysJobServiceImpl implements ISysJobService * @param job 调度信息 */ @Override + @Transactional public int run(SysJob job) { return ScheduleUtils.run(scheduler, selectJobById(job.getJobId())); @@ -179,6 +186,7 @@ public class SysJobServiceImpl implements ISysJobService * @param job 调度信息 调度信息 */ @Override + @Transactional public int insertJobCron(SysJob job) { job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); @@ -196,6 +204,7 @@ public class SysJobServiceImpl implements ISysJobService * @param job 调度信息 */ @Override + @Transactional public int updateJobCron(SysJob job) { int rows = jobMapper.updateJob(job); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index ae226daa0..f623c3f3c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.Ztree; @@ -184,6 +185,7 @@ public class SysDeptServiceImpl implements ISysDeptService * @return 结果 */ @Override + @Transactional public int updateDept(SysDept dept) { SysDept info = deptMapper.selectDeptById(dept.getParentId()); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java index ace3d5488..7d205fc16 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java @@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.BusinessException; @@ -114,6 +115,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService * @return 结果 */ @Override + @Transactional public int updateDictType(SysDictType dictType) { SysDictType oldDict = dictTypeMapper.selectDictTypeById(dictType.getDictId()); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index 2523f5d3c..0f5726167 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.text.Convert; @@ -163,6 +164,7 @@ public class SysRoleServiceImpl implements ISysRoleService * @return 结果 */ @Override + @Transactional public int insertRole(SysRole role) { // 新增角色信息 @@ -177,6 +179,7 @@ public class SysRoleServiceImpl implements ISysRoleService * @return 结果 */ @Override + @Transactional public int updateRole(SysRole role) { // 修改角色信息 @@ -193,6 +196,7 @@ public class SysRoleServiceImpl implements ISysRoleService * @return 结果 */ @Override + @Transactional public int updateRule(SysRole role) { // 修改角色信息 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index 16884c7ac..91aa01fc2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -6,6 +6,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.text.Convert; @@ -158,6 +159,7 @@ public class SysUserServiceImpl implements ISysUserService * @return 结果 */ @Override + @Transactional public int insertUser(SysUser user) { // 新增用户信息 @@ -176,6 +178,7 @@ public class SysUserServiceImpl implements ISysUserService * @return 结果 */ @Override + @Transactional public int updateUser(SysUser user) { Long userId = user.getUserId();