mirror of https://gitee.com/y_project/RuoYi.git
事务由Controller迁移到Service
parent
aa478f2bd6
commit
32e2e212a7
|
@ -4,7 +4,6 @@ import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
@ -78,7 +77,6 @@ public class SysRoleController extends BaseController
|
||||||
@RequiresPermissions("system:role:add")
|
@RequiresPermissions("system:role:add")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(SysRole role)
|
public AjaxResult addSave(SysRole role)
|
||||||
{
|
{
|
||||||
|
@ -104,7 +102,6 @@ public class SysRoleController extends BaseController
|
||||||
@RequiresPermissions("system:role:edit")
|
@RequiresPermissions("system:role:edit")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(SysRole role)
|
public AjaxResult editSave(SysRole role)
|
||||||
{
|
{
|
||||||
|
@ -129,7 +126,6 @@ public class SysRoleController extends BaseController
|
||||||
@RequiresPermissions("system:role:edit")
|
@RequiresPermissions("system:role:edit")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/rule")
|
@PostMapping("/rule")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult ruleSave(SysRole role)
|
public AjaxResult ruleSave(SysRole role)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,6 @@ import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
@ -116,7 +115,6 @@ public class SysUserController extends BaseController
|
||||||
@RequiresPermissions("system:user:add")
|
@RequiresPermissions("system:user:add")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(SysUser user)
|
public AjaxResult addSave(SysUser user)
|
||||||
{
|
{
|
||||||
|
@ -148,7 +146,6 @@ public class SysUserController extends BaseController
|
||||||
@RequiresPermissions("system:user:edit")
|
@RequiresPermissions("system:user:edit")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(SysUser user)
|
public AjaxResult editSave(SysUser user)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.quartz.CronTrigger;
|
||||||
import org.quartz.Scheduler;
|
import org.quartz.Scheduler;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.ruoyi.common.constant.ScheduleConstants;
|
import com.ruoyi.common.constant.ScheduleConstants;
|
||||||
import com.ruoyi.common.core.text.Convert;
|
import com.ruoyi.common.core.text.Convert;
|
||||||
import com.ruoyi.quartz.domain.SysJob;
|
import com.ruoyi.quartz.domain.SysJob;
|
||||||
|
@ -80,6 +81,7 @@ public class SysJobServiceImpl implements ISysJobService
|
||||||
* @param job 调度信息
|
* @param job 调度信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int pauseJob(SysJob job)
|
public int pauseJob(SysJob job)
|
||||||
{
|
{
|
||||||
job.setStatus(ScheduleConstants.Status.PAUSE.getValue());
|
job.setStatus(ScheduleConstants.Status.PAUSE.getValue());
|
||||||
|
@ -97,6 +99,7 @@ public class SysJobServiceImpl implements ISysJobService
|
||||||
* @param job 调度信息
|
* @param job 调度信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int resumeJob(SysJob job)
|
public int resumeJob(SysJob job)
|
||||||
{
|
{
|
||||||
job.setStatus(ScheduleConstants.Status.NORMAL.getValue());
|
job.setStatus(ScheduleConstants.Status.NORMAL.getValue());
|
||||||
|
@ -114,6 +117,7 @@ public class SysJobServiceImpl implements ISysJobService
|
||||||
* @param job 调度信息
|
* @param job 调度信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int deleteJob(SysJob job)
|
public int deleteJob(SysJob job)
|
||||||
{
|
{
|
||||||
int rows = jobMapper.deleteJobById(job.getJobId());
|
int rows = jobMapper.deleteJobById(job.getJobId());
|
||||||
|
@ -131,6 +135,7 @@ public class SysJobServiceImpl implements ISysJobService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public void deleteJobByIds(String ids)
|
public void deleteJobByIds(String ids)
|
||||||
{
|
{
|
||||||
Long[] jobIds = Convert.toLongArray(ids);
|
Long[] jobIds = Convert.toLongArray(ids);
|
||||||
|
@ -147,6 +152,7 @@ public class SysJobServiceImpl implements ISysJobService
|
||||||
* @param job 调度信息
|
* @param job 调度信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int changeStatus(SysJob job)
|
public int changeStatus(SysJob job)
|
||||||
{
|
{
|
||||||
int rows = 0;
|
int rows = 0;
|
||||||
|
@ -168,6 +174,7 @@ public class SysJobServiceImpl implements ISysJobService
|
||||||
* @param job 调度信息
|
* @param job 调度信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int run(SysJob job)
|
public int run(SysJob job)
|
||||||
{
|
{
|
||||||
return ScheduleUtils.run(scheduler, selectJobById(job.getJobId()));
|
return ScheduleUtils.run(scheduler, selectJobById(job.getJobId()));
|
||||||
|
@ -179,6 +186,7 @@ public class SysJobServiceImpl implements ISysJobService
|
||||||
* @param job 调度信息 调度信息
|
* @param job 调度信息 调度信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int insertJobCron(SysJob job)
|
public int insertJobCron(SysJob job)
|
||||||
{
|
{
|
||||||
job.setStatus(ScheduleConstants.Status.PAUSE.getValue());
|
job.setStatus(ScheduleConstants.Status.PAUSE.getValue());
|
||||||
|
@ -196,6 +204,7 @@ public class SysJobServiceImpl implements ISysJobService
|
||||||
* @param job 调度信息
|
* @param job 调度信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int updateJobCron(SysJob job)
|
public int updateJobCron(SysJob job)
|
||||||
{
|
{
|
||||||
int rows = jobMapper.updateJob(job);
|
int rows = jobMapper.updateJob(job);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.domain.Ztree;
|
import com.ruoyi.common.core.domain.Ztree;
|
||||||
|
@ -184,6 +185,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int updateDept(SysDept dept)
|
public int updateDept(SysDept dept)
|
||||||
{
|
{
|
||||||
SysDept info = deptMapper.selectDeptById(dept.getParentId());
|
SysDept info = deptMapper.selectDeptById(dept.getParentId());
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.text.Convert;
|
import com.ruoyi.common.core.text.Convert;
|
||||||
import com.ruoyi.common.exception.BusinessException;
|
import com.ruoyi.common.exception.BusinessException;
|
||||||
|
@ -114,6 +115,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int updateDictType(SysDictType dictType)
|
public int updateDictType(SysDictType dictType)
|
||||||
{
|
{
|
||||||
SysDictType oldDict = dictTypeMapper.selectDictTypeById(dictType.getDictId());
|
SysDictType oldDict = dictTypeMapper.selectDictTypeById(dictType.getDictId());
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.text.Convert;
|
import com.ruoyi.common.core.text.Convert;
|
||||||
|
@ -163,6 +164,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int insertRole(SysRole role)
|
public int insertRole(SysRole role)
|
||||||
{
|
{
|
||||||
// 新增角色信息
|
// 新增角色信息
|
||||||
|
@ -177,6 +179,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int updateRole(SysRole role)
|
public int updateRole(SysRole role)
|
||||||
{
|
{
|
||||||
// 修改角色信息
|
// 修改角色信息
|
||||||
|
@ -193,6 +196,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int updateRule(SysRole role)
|
public int updateRule(SysRole role)
|
||||||
{
|
{
|
||||||
// 修改角色信息
|
// 修改角色信息
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.text.Convert;
|
import com.ruoyi.common.core.text.Convert;
|
||||||
|
@ -158,6 +159,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int insertUser(SysUser user)
|
public int insertUser(SysUser user)
|
||||||
{
|
{
|
||||||
// 新增用户信息
|
// 新增用户信息
|
||||||
|
@ -176,6 +178,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int updateUser(SysUser user)
|
public int updateUser(SysUser user)
|
||||||
{
|
{
|
||||||
Long userId = user.getUserId();
|
Long userId = user.getUserId();
|
||||||
|
|
Loading…
Reference in New Issue