Commit 6dc2f81f authored by 王晓倩's avatar 王晓倩

非admin账户,只能维护本部门交易项目

parent 9fb4acde
......@@ -3,9 +3,14 @@ package com.zehong.web.controller.transaction;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.core.domain.model.LoginUser;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.ServletUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.framework.web.service.TokenService;
import com.zehong.system.domain.TTransactionProject;
import com.zehong.system.service.ITTransactionProjectService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -26,6 +31,8 @@ public class TTransactionProjectController extends BaseController
{
@Autowired
private ITTransactionProjectService tTransactionProjectService;
@Autowired
private TokenService tokenService;
/**
* 查询交易项目列表
......@@ -35,8 +42,14 @@ public class TTransactionProjectController extends BaseController
public TableDataInfo list(TTransactionProject tTransactionProject)
{
startPage();
// 获取当前用户
SysUser user = tokenService.getLoginUser(ServletUtils.getRequest()).getUser();
if (StringUtils.isNotNull(user) && !user.isAdmin()) {
tTransactionProject.setDeptId(user.getDeptId());
}
List<TTransactionProject> list = tTransactionProjectService.selectTTransactionProjectList(tTransactionProject);
return getDataTable(list);
}
......@@ -82,6 +95,11 @@ public class TTransactionProjectController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody TTransactionProject tTransactionProject)
{
// 获取当前用户
SysUser user = tokenService.getLoginUser(ServletUtils.getRequest()).getUser();
if (StringUtils.isNotNull(user) && !user.isAdmin()) {
tTransactionProject.setDeptId(user.getDeptId());
}
return toAjax(tTransactionProjectService.insertTTransactionProject(tTransactionProject));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment