Commit 314db5be4424feca5486bbe07fa025290f1196b0

Authored by yiming
1 parent e45187ed

bf

Showing 17 changed files with 213 additions and 53 deletions
bsthLineProfiles/src/main/java/com/ruoyi/project/monitor/job/task/RyTask.java
@@ -7,6 +7,11 @@ import java.util.HashMap; @@ -7,6 +7,11 @@ import java.util.HashMap;
7 import java.util.List; 7 import java.util.List;
8 import java.util.Map; 8 import java.util.Map;
9 9
  10 +import com.ruoyi.common.utils.security.ShiroUtils;
  11 +import com.ruoyi.project.system.dept.service.DeptServiceImpl;
  12 +import com.ruoyi.project.system.user.domain.User;
  13 +import org.apache.shiro.util.ThreadContext;
  14 +import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
10 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Component; 16 import org.springframework.stereotype.Component;
12 17
@@ -28,6 +33,9 @@ public class RyTask { @@ -28,6 +33,9 @@ public class RyTask {
28 @Autowired 33 @Autowired
29 IBsthTLineService lineService; 34 IBsthTLineService lineService;
30 35
  36 + @Autowired
  37 + DeptServiceImpl deptService;
  38 +
31 public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) { 39 public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
32 System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); 40 System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
33 } 41 }
@@ -111,6 +119,14 @@ public class RyTask { @@ -111,6 +119,14 @@ public class RyTask {
111 119
112 public void getCarPlate() { 120 public void getCarPlate() {
113 System.out.println("获取车辆自编号"); 121 System.out.println("获取车辆自编号");
  122 + DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
  123 + ThreadContext.bind(manager);
114 lineService.getCarPlate(); 124 lineService.getCarPlate();
115 } 125 }
  126 +
  127 + public void updateSysDept(){
  128 + DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
  129 + ThreadContext.bind(manager);
  130 + deptService.updateSysDept();
  131 + }
116 } 132 }
bsthLineProfiles/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java
1 package com.ruoyi.project.system.dept.controller; 1 package com.ruoyi.project.system.dept.controller;
2 2
3 import java.util.List; 3 import java.util.List;
  4 +
  5 +import cn.hutool.http.Header;
  6 +import cn.hutool.http.HttpRequest;
  7 +import com.alibaba.fastjson.JSON;
  8 +import com.alibaba.fastjson.JSONArray;
  9 +import com.alibaba.fastjson.JSONObject;
4 import org.apache.shiro.authz.annotation.RequiresPermissions; 10 import org.apache.shiro.authz.annotation.RequiresPermissions;
5 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.stereotype.Controller; 12 import org.springframework.stereotype.Controller;
@@ -197,4 +203,8 @@ public class DeptController extends BaseController @@ -197,4 +203,8 @@ public class DeptController extends BaseController
197 List<Ztree> ztrees = deptService.roleDeptTreeData(role); 203 List<Ztree> ztrees = deptService.roleDeptTreeData(role);
198 return ztrees; 204 return ztrees;
199 } 205 }
  206 +
  207 +
  208 +
  209 +
200 } 210 }
bsthLineProfiles/src/main/java/com/ruoyi/project/system/dept/domain/Dept.java
@@ -47,6 +47,9 @@ public class Dept extends BaseEntity @@ -47,6 +47,9 @@ public class Dept extends BaseEntity
47 /** 父部门名称 */ 47 /** 父部门名称 */
48 private String parentName; 48 private String parentName;
49 49
  50 + private String code;
  51 +
  52 + private String id;
50 public Long getDeptId() 53 public Long getDeptId()
51 { 54 {
52 return deptId; 55 return deptId;
@@ -163,6 +166,22 @@ public class Dept extends BaseEntity @@ -163,6 +166,22 @@ public class Dept extends BaseEntity
163 this.parentName = parentName; 166 this.parentName = parentName;
164 } 167 }
165 168
  169 + public String getCode() {
  170 + return code;
  171 + }
  172 +
  173 + public void setCode(String code) {
  174 + this.code = code;
  175 + }
  176 +
  177 + public String getId() {
  178 + return id;
  179 + }
  180 +
  181 + public void setId(String id) {
  182 + this.id = id;
  183 + }
  184 +
166 @Override 185 @Override
167 public String toString() { 186 public String toString() {
168 return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 187 return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
bsthLineProfiles/src/main/java/com/ruoyi/project/system/dept/mapper/DeptMapper.java
@@ -114,4 +114,6 @@ public interface DeptMapper @@ -114,4 +114,6 @@ public interface DeptMapper
114 * @return 子部门数 114 * @return 子部门数
115 */ 115 */
116 public int selectNormalChildrenDeptById(Long deptId); 116 public int selectNormalChildrenDeptById(Long deptId);
  117 +
  118 + public Dept selectDeptByCode(@Param("code") String code);
117 } 119 }
bsthLineProfiles/src/main/java/com/ruoyi/project/system/dept/service/DeptServiceImpl.java
@@ -3,6 +3,13 @@ package com.ruoyi.project.system.dept.service; @@ -3,6 +3,13 @@ package com.ruoyi.project.system.dept.service;
3 import java.util.ArrayList; 3 import java.util.ArrayList;
4 import java.util.Iterator; 4 import java.util.Iterator;
5 import java.util.List; 5 import java.util.List;
  6 +
  7 +import cn.hutool.http.Header;
  8 +import cn.hutool.http.HttpRequest;
  9 +import com.alibaba.fastjson.JSON;
  10 +import com.alibaba.fastjson.JSONArray;
  11 +import com.alibaba.fastjson.JSONObject;
  12 +import com.ruoyi.project.system.user.domain.User;
6 import org.apache.commons.lang3.ArrayUtils; 13 import org.apache.commons.lang3.ArrayUtils;
7 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.stereotype.Service; 15 import org.springframework.stereotype.Service;
@@ -58,8 +65,7 @@ public class DeptServiceImpl implements IDeptService @@ -58,8 +65,7 @@ public class DeptServiceImpl implements IDeptService
58 65
59 /** 66 /**
60 * 查询部门管理树(排除下级) 67 * 查询部门管理树(排除下级)
61 - *  
62 - * @param deptId 部门ID 68 + *
63 * @return 所有部门信息 69 * @return 所有部门信息
64 */ 70 */
65 @Override 71 @Override
@@ -201,7 +207,8 @@ public class DeptServiceImpl implements IDeptService @@ -201,7 +207,8 @@ public class DeptServiceImpl implements IDeptService
201 { 207 {
202 throw new BusinessException("部门停用,不允许新增"); 208 throw new BusinessException("部门停用,不允许新增");
203 } 209 }
204 - dept.setCreateBy(ShiroUtils.getLoginName()); 210 + String name=ShiroUtils.getSysUser()==null?"admin":ShiroUtils.getLoginName();
  211 + dept.setCreateBy(name);
205 dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); 212 dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
206 return deptMapper.insertDept(dept); 213 return deptMapper.insertDept(dept);
207 } 214 }
@@ -225,7 +232,8 @@ public class DeptServiceImpl implements IDeptService @@ -225,7 +232,8 @@ public class DeptServiceImpl implements IDeptService
225 dept.setAncestors(newAncestors); 232 dept.setAncestors(newAncestors);
226 updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors); 233 updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
227 } 234 }
228 - dept.setUpdateBy(ShiroUtils.getLoginName()); 235 + String name=ShiroUtils.getSysUser()==null?"admin":ShiroUtils.getLoginName();
  236 + dept.setCreateBy(name);
229 int result = deptMapper.updateDept(dept); 237 int result = deptMapper.updateDept(dept);
230 if (UserConstants.DEPT_NORMAL.equals(dept.getStatus())) 238 if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()))
231 { 239 {
@@ -330,4 +338,77 @@ public class DeptServiceImpl implements IDeptService @@ -330,4 +338,77 @@ public class DeptServiceImpl implements IDeptService
330 } 338 }
331 return UserConstants.DEPT_NAME_UNIQUE; 339 return UserConstants.DEPT_NAME_UNIQUE;
332 } 340 }
  341 +
  342 + @Override
  343 + public Dept selectDeptByCode(String code) {
  344 + return deptMapper.selectDeptByCode(code);
  345 + }
  346 +
  347 + public void updateSysDept() {
  348 + //获取所有部门信息
  349 + JSONObject para = new JSONObject();
  350 + para.put("organizationId", "");
  351 + String deptStr = HttpRequest.post("http://180.169.154.251:8082/businessCenter/organizationInfo/queryOrgUserTreeList")
  352 + .header(Header.ACCEPT, "application/json").header("userName", "tuohua00001").
  353 + header("password", "8602daa59fdd3dcc648c206e334fc268").form(para)
  354 + .execute().body();
  355 + JSONObject jsonObject = JSON.parseObject(deptStr);
  356 + JSONArray dataArr = jsonObject.getJSONArray("data");
  357 + for (int i = 0; i < dataArr.size(); i++) {
  358 + Dept sysDept = this.selectDeptByCode(dataArr.getJSONObject(i).getString("code"));
  359 + this.updateDept(getSysDept(sysDept, dataArr.getJSONObject(i), dataArr.getJSONObject(i).getString("code"), 0, 0));
  360 + if (dataArr.getJSONObject(i).containsKey("children")) {
  361 + synchronousDeptData(dataArr.getJSONObject(i).getJSONArray("children"), 100);
  362 + }
  363 + }
  364 + }
  365 +
  366 + /**
  367 + * 同步部门数据
  368 + *
  369 + * @param parentId 父级id
  370 + * @param jsonArray
  371 + */
  372 + public void synchronousDeptData(JSONArray jsonArray, long parentId) {
  373 + for (int i = 0; i < jsonArray.size(); i++) {
  374 + JSONObject jsonObject = jsonArray.getJSONObject(i);
  375 + if (jsonObject.getString("code") == null) {
  376 + continue;
  377 + }
  378 + Dept sysDept = this.selectDeptByCode(jsonObject.getString("code"));
  379 + if (sysDept != null && sysDept.getDeptId() != null) {
  380 + this.updateDept(getSysDept(sysDept, jsonObject, jsonObject.getString("code"), i, parentId));
  381 + }
  382 + if (sysDept == null) {
  383 + sysDept = getSysDept(new Dept(), jsonObject, jsonObject.getString("code"), i, parentId);
  384 + this.insertDept(sysDept);
  385 + }
  386 + if (jsonObject.containsKey("children") && "1".equals(jsonObject.getString("type"))) {
  387 + synchronousDeptData(jsonObject.getJSONArray("children"), sysDept.getDeptId());
  388 + }
  389 + }
  390 + }
  391 +
  392 +
  393 + /**
  394 + * 获取新对象
  395 + *
  396 + * @param sysDept
  397 + * @param jsonObject
  398 + * @param order
  399 + * @param parentId
  400 + * @return
  401 + */
  402 + public Dept getSysDept(Dept sysDept, JSONObject jsonObject, String code, int order, long parentId) {
  403 + sysDept.setCode(code);
  404 + sysDept.setDeptName(jsonObject.getString("label"));
  405 + sysDept.setOrderNum(String.valueOf(order));
  406 + sysDept.setStatus("0");
  407 + sysDept.setDelFlag("0");
  408 + sysDept.setParentId(parentId);
  409 + sysDept.setUpdateBy(" ");
  410 + sysDept.setId(jsonObject.getString("id"));
  411 + return sysDept;
  412 + }
  413 +
333 } 414 }
bsthLineProfiles/src/main/java/com/ruoyi/project/system/dept/service/IDeptService.java
@@ -107,4 +107,13 @@ public interface IDeptService @@ -107,4 +107,13 @@ public interface IDeptService
107 * @return 结果 107 * @return 结果
108 */ 108 */
109 public String checkDeptNameUnique(Dept dept); 109 public String checkDeptNameUnique(Dept dept);
  110 +
  111 + /**
  112 + * 根据Code查询
  113 + * @param code
  114 + * @return
  115 + */
  116 + public Dept selectDeptByCode(String code);
  117 +
  118 + void updateSysDept();
110 } 119 }
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/controller/BsthTLineAddController.java
@@ -10,6 +10,7 @@ import com.ruoyi.framework.web.page.TableDataInfo; @@ -10,6 +10,7 @@ import com.ruoyi.framework.web.page.TableDataInfo;
10 import com.ruoyi.project.system.dict.domain.DictData; 10 import com.ruoyi.project.system.dict.domain.DictData;
11 import com.ruoyi.project.system.dict.service.IDictDataService; 11 import com.ruoyi.project.system.dict.service.IDictDataService;
12 import com.ruoyi.project.system.line.domain.BsthTLine; 12 import com.ruoyi.project.system.line.domain.BsthTLine;
  13 +import com.ruoyi.project.system.line.domain.Company;
13 import com.ruoyi.project.system.line.service.IBsthTLineService; 14 import com.ruoyi.project.system.line.service.IBsthTLineService;
14 import com.ruoyi.project.system.user.domain.User; 15 import com.ruoyi.project.system.user.domain.User;
15 import com.ruoyi.project.system.user.service.IUserService; 16 import com.ruoyi.project.system.user.service.IUserService;
@@ -59,7 +60,7 @@ public class BsthTLineAddController extends BaseController @@ -59,7 +60,7 @@ public class BsthTLineAddController extends BaseController
59 { 60 {
60 61
61 ModelAndView mv=new ModelAndView(prefix + "/line"); 62 ModelAndView mv=new ModelAndView(prefix + "/line");
62 - List<Map> companyList=bsthTLineService.selectCompany(); 63 + List<Company> companyList=bsthTLineService.selectCompany(new Company());
63 mv.addObject("companyList",companyList); 64 mv.addObject("companyList",companyList);
64 return mv; 65 return mv;
65 } 66 }
@@ -84,7 +85,7 @@ public class BsthTLineAddController extends BaseController @@ -84,7 +85,7 @@ public class BsthTLineAddController extends BaseController
84 public ModelAndView add() 85 public ModelAndView add()
85 { 86 {
86 ModelAndView mv=new ModelAndView(prefix + "/add"); 87 ModelAndView mv=new ModelAndView(prefix + "/add");
87 - List<Map> companyList=bsthTLineService.selectCompany(); 88 + List<Company> companyList=bsthTLineService.selectCompany(new Company());
88 mv.addObject("companyList",companyList); 89 mv.addObject("companyList",companyList);
89 return mv; 90 return mv;
90 } 91 }
@@ -129,7 +130,7 @@ public class BsthTLineAddController extends BaseController @@ -129,7 +130,7 @@ public class BsthTLineAddController extends BaseController
129 public String edit(@PathVariable("id") Long id, ModelMap mmap) 130 public String edit(@PathVariable("id") Long id, ModelMap mmap)
130 { 131 {
131 BsthTLine bsthTLine = bsthTLineService.selectBsthTLineExamineById(id); 132 BsthTLine bsthTLine = bsthTLineService.selectBsthTLineExamineById(id);
132 - List<Map> companyList=bsthTLineService.selectCompany(); 133 + List<Company> companyList=bsthTLineService.selectCompany(new Company());
133 mmap.put("companyList",companyList); 134 mmap.put("companyList",companyList);
134 mmap.put("bsthTLine", bsthTLine); 135 mmap.put("bsthTLine", bsthTLine);
135 return prefix + "/edit"; 136 return prefix + "/edit";
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/controller/BsthTLineController.java
@@ -11,6 +11,7 @@ import com.ruoyi.project.system.dict.domain.DictData; @@ -11,6 +11,7 @@ import com.ruoyi.project.system.dict.domain.DictData;
11 import com.ruoyi.project.system.dict.service.IDictDataService; 11 import com.ruoyi.project.system.dict.service.IDictDataService;
12 import com.ruoyi.project.system.line.domain.BsthTLine; 12 import com.ruoyi.project.system.line.domain.BsthTLine;
13 import com.ruoyi.project.system.line.domain.BsthTLineKFK; 13 import com.ruoyi.project.system.line.domain.BsthTLineKFK;
  14 +import com.ruoyi.project.system.line.domain.Company;
14 import com.ruoyi.project.system.line.service.IBsthTLineService; 15 import com.ruoyi.project.system.line.service.IBsthTLineService;
15 import com.ruoyi.project.system.user.domain.User; 16 import com.ruoyi.project.system.user.domain.User;
16 import com.ruoyi.project.system.user.service.IUserService; 17 import com.ruoyi.project.system.user.service.IUserService;
@@ -58,7 +59,7 @@ public class BsthTLineController extends BaseController @@ -58,7 +59,7 @@ public class BsthTLineController extends BaseController
58 public ModelAndView line() 59 public ModelAndView line()
59 { 60 {
60 ModelAndView mv=new ModelAndView(prefix + "/line"); 61 ModelAndView mv=new ModelAndView(prefix + "/line");
61 - List<Map> companyList=bsthTLineService.selectCompany(); 62 + List<Company> companyList=bsthTLineService.selectCompany(new Company());
62 mv.addObject("companyList",companyList); 63 mv.addObject("companyList",companyList);
63 return mv; 64 return mv;
64 } 65 }
@@ -298,7 +299,7 @@ public class BsthTLineController extends BaseController @@ -298,7 +299,7 @@ public class BsthTLineController extends BaseController
298 { 299 {
299 BsthTLine bsthTLine=new BsthTLine(); 300 BsthTLine bsthTLine=new BsthTLine();
300 List<BsthTLine> list = bsthTLineService.selectBsthTLineList(bsthTLine); 301 List<BsthTLine> list = bsthTLineService.selectBsthTLineList(bsthTLine);
301 - List<Map> companyList = bsthTLineService.selectCompany(); 302 + List<Company> companyList=bsthTLineService.selectCompany(new Company());
302 List<BsthTLineKFK> bsthTLineKFKS=new ArrayList<>(); 303 List<BsthTLineKFK> bsthTLineKFKS=new ArrayList<>();
303 for (BsthTLine tLine : list) { 304 for (BsthTLine tLine : list) {
304 BsthTLineKFK bsthTLineKFK=new BsthTLineKFK(tLine,companyList); 305 BsthTLineKFK bsthTLineKFK=new BsthTLineKFK(tLine,companyList);
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/controller/BsthTLineExamineController.java
@@ -9,6 +9,7 @@ import com.ruoyi.framework.web.page.TableDataInfo; @@ -9,6 +9,7 @@ import com.ruoyi.framework.web.page.TableDataInfo;
9 9
10 import com.ruoyi.project.system.dict.service.IDictDataService; 10 import com.ruoyi.project.system.dict.service.IDictDataService;
11 import com.ruoyi.project.system.line.domain.BsthTLine; 11 import com.ruoyi.project.system.line.domain.BsthTLine;
  12 +import com.ruoyi.project.system.line.domain.Company;
12 import com.ruoyi.project.system.line.service.IBsthTLineService; 13 import com.ruoyi.project.system.line.service.IBsthTLineService;
13 14
14 import com.ruoyi.project.system.user.service.IUserService; 15 import com.ruoyi.project.system.user.service.IUserService;
@@ -51,7 +52,7 @@ public class BsthTLineExamineController extends BaseController @@ -51,7 +52,7 @@ public class BsthTLineExamineController extends BaseController
51 { 52 {
52 53
53 ModelAndView mv=new ModelAndView(prefix + "/line"); 54 ModelAndView mv=new ModelAndView(prefix + "/line");
54 - List<Map> companyList=bsthTLineService.selectCompany(); 55 + List<Company> companyList=bsthTLineService.selectCompany(new Company());
55 mv.addObject("companyList",companyList); 56 mv.addObject("companyList",companyList);
56 return mv; 57 return mv;
57 } 58 }
@@ -76,7 +77,7 @@ public class BsthTLineExamineController extends BaseController @@ -76,7 +77,7 @@ public class BsthTLineExamineController extends BaseController
76 { 77 {
77 BsthTLine bsthTLine = bsthTLineService.selectBsthTLineExamineById(id); 78 BsthTLine bsthTLine = bsthTLineService.selectBsthTLineExamineById(id);
78 mmap.put("bsthTLine", bsthTLine); 79 mmap.put("bsthTLine", bsthTLine);
79 - List<Map> companyList=bsthTLineService.selectCompany(); 80 + List<Company> companyList=bsthTLineService.selectCompany(new Company());
80 mmap.put("companyList",companyList); 81 mmap.put("companyList",companyList);
81 return prefix + "/detail"; 82 return prefix + "/detail";
82 } 83 }
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/controller/BsthTLineHistoryController.java
@@ -4,6 +4,7 @@ package com.ruoyi.project.system.line.controller; @@ -4,6 +4,7 @@ package com.ruoyi.project.system.line.controller;
4 import java.util.List; 4 import java.util.List;
5 import java.util.Map; 5 import java.util.Map;
6 6
  7 +import com.ruoyi.project.system.line.domain.Company;
7 import org.apache.shiro.authz.annotation.RequiresPermissions; 8 import org.apache.shiro.authz.annotation.RequiresPermissions;
8 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.stereotype.Controller; 10 import org.springframework.stereotype.Controller;
@@ -55,7 +56,7 @@ public class BsthTLineHistoryController extends BaseController @@ -55,7 +56,7 @@ public class BsthTLineHistoryController extends BaseController
55 { 56 {
56 57
57 ModelAndView mv=new ModelAndView(prefix + "/line"); 58 ModelAndView mv=new ModelAndView(prefix + "/line");
58 - List<Map> companyList=bsthTLineService.selectCompany(); 59 + List<Company> companyList=bsthTLineService.selectCompany(new Company());
59 mv.addObject("companyList",companyList); 60 mv.addObject("companyList",companyList);
60 return mv; 61 return mv;
61 } 62 }
@@ -89,7 +90,7 @@ public class BsthTLineHistoryController extends BaseController @@ -89,7 +90,7 @@ public class BsthTLineHistoryController extends BaseController
89 boolean flag=bsthTLineService.selectHistoryByLineNameAndUpdateStatus(bsthTLine)!=null?true:false; 90 boolean flag=bsthTLineService.selectHistoryByLineNameAndUpdateStatus(bsthTLine)!=null?true:false;
90 mmap.put("flag",flag); 91 mmap.put("flag",flag);
91 mmap.put("bsthTLine", bsthTLine); 92 mmap.put("bsthTLine", bsthTLine);
92 - List<Map> companyList=bsthTLineService.selectCompany(); 93 + List<Company> companyList=bsthTLineService.selectCompany(new Company());
93 mmap.put("companyList",companyList); 94 mmap.put("companyList",companyList);
94 return prefix + "/edit"; 95 return prefix + "/edit";
95 } 96 }
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/domain/BsthTLineKFK.java
@@ -193,7 +193,7 @@ public class BsthTLineKFK @@ -193,7 +193,7 @@ public class BsthTLineKFK
193 public BsthTLineKFK(){ 193 public BsthTLineKFK(){
194 194
195 } 195 }
196 - public BsthTLineKFK(BsthTLine bsthTLine, List<Map> companyList) { 196 + public BsthTLineKFK(BsthTLine bsthTLine, List<Company> companyList) {
197 try { 197 try {
198 Field[] fields=BsthTLineKFK.class.getDeclaredFields(); 198 Field[] fields=BsthTLineKFK.class.getDeclaredFields();
199 for(Field f : fields) { 199 for(Field f : fields) {
@@ -207,9 +207,9 @@ public class BsthTLineKFK @@ -207,9 +207,9 @@ public class BsthTLineKFK
207 } 207 }
208 } 208 }
209 this.fCompany=bsthTLine.getfCompany(); 209 this.fCompany=bsthTLine.getfCompany();
210 - for (Map map : companyList) {  
211 - String fc=map.get("fCompany").toString();  
212 - String id=map.get("companyID").toString(); 210 + for (Company company : companyList) {
  211 + String fc=company.getfCompany();
  212 + String id=company.getCompanyID();
213 if (fc.equals(this.company+"本部")){ 213 if (fc.equals(this.company+"本部")){
214 this.companyID=id; 214 this.companyID=id;
215 }if(fc.equals(this.fCompany)){ 215 }if(fc.equals(this.fCompany)){
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/mapper/BsthTLineMapper.java
@@ -4,6 +4,7 @@ import java.util.List; @@ -4,6 +4,7 @@ import java.util.List;
4 import java.util.Map; 4 import java.util.Map;
5 5
6 import com.ruoyi.project.system.line.domain.BsthTLine; 6 import com.ruoyi.project.system.line.domain.BsthTLine;
  7 +import com.ruoyi.project.system.line.domain.Company;
7 import com.ruoyi.project.system.line.domain.LineHistoryReport; 8 import com.ruoyi.project.system.line.domain.LineHistoryReport;
8 import org.apache.ibatis.annotations.Mapper; 9 import org.apache.ibatis.annotations.Mapper;
9 10
@@ -68,7 +69,7 @@ public interface BsthTLineMapper @@ -68,7 +69,7 @@ public interface BsthTLineMapper
68 int deleteBsthTLineHistoryById(Long id); 69 int deleteBsthTLineHistoryById(Long id);
69 70
70 71
71 - List<Map> selectCompany(); 72 + List<Company> selectCompany(Company company);
72 73
73 List<BsthTLine> selectBsthTLineListAndExamine(BsthTLine bsthTLine); 74 List<BsthTLine> selectBsthTLineListAndExamine(BsthTLine bsthTLine);
74 75
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/service/IBsthTLineService.java
@@ -5,6 +5,7 @@ import java.util.Map; @@ -5,6 +5,7 @@ import java.util.Map;
5 5
6 import com.ruoyi.project.system.line.domain.BsthTLine; 6 import com.ruoyi.project.system.line.domain.BsthTLine;
7 import com.ruoyi.project.system.line.domain.BsthTLineKFK; 7 import com.ruoyi.project.system.line.domain.BsthTLineKFK;
  8 +import com.ruoyi.project.system.line.domain.Company;
8 import com.ruoyi.project.system.line.domain.LineHistoryReport; 9 import com.ruoyi.project.system.line.domain.LineHistoryReport;
9 10
10 /** 11 /**
@@ -58,7 +59,7 @@ public interface IBsthTLineService @@ -58,7 +59,7 @@ public interface IBsthTLineService
58 59
59 int deleteBsthTLineHistoryById(Long id); 60 int deleteBsthTLineHistoryById(Long id);
60 61
61 - List<Map> selectCompany(); 62 + List<Company> selectCompany(Company company);
62 63
63 boolean lineNameIsExistInBsthTLine(String lineName); 64 boolean lineNameIsExistInBsthTLine(String lineName);
64 65
bsthLineProfiles/src/main/java/com/ruoyi/project/system/line/service/impl/BsthTLineServiceImpl.java
@@ -10,9 +10,11 @@ import cn.hutool.json.JSON; @@ -10,9 +10,11 @@ import cn.hutool.json.JSON;
10 import com.alibaba.fastjson.JSONArray; 10 import com.alibaba.fastjson.JSONArray;
11 import com.alibaba.fastjson.JSONObject; 11 import com.alibaba.fastjson.JSONObject;
12 import com.ruoyi.common.utils.security.ShiroUtils; 12 import com.ruoyi.common.utils.security.ShiroUtils;
  13 +import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
13 import com.ruoyi.project.system.dict.domain.DictData; 14 import com.ruoyi.project.system.dict.domain.DictData;
14 import com.ruoyi.project.system.dict.service.IDictDataService; 15 import com.ruoyi.project.system.dict.service.IDictDataService;
15 import com.ruoyi.project.system.line.domain.BsthTLineKFK; 16 import com.ruoyi.project.system.line.domain.BsthTLineKFK;
  17 +import com.ruoyi.project.system.line.domain.Company;
16 import com.ruoyi.project.system.line.domain.LineHistoryReport; 18 import com.ruoyi.project.system.line.domain.LineHistoryReport;
17 import com.ruoyi.project.system.user.domain.User; 19 import com.ruoyi.project.system.user.domain.User;
18 import org.slf4j.Logger; 20 import org.slf4j.Logger;
@@ -69,6 +71,7 @@ public class BsthTLineServiceImpl implements IBsthTLineService @@ -69,6 +71,7 @@ public class BsthTLineServiceImpl implements IBsthTLineService
69 * @return 【请填写功能名称】 71 * @return 【请填写功能名称】
70 */ 72 */
71 @Override 73 @Override
  74 + @DataScope(deptAlias = "b")
72 public List<BsthTLine> selectBsthTLineList(BsthTLine bsthTLine) 75 public List<BsthTLine> selectBsthTLineList(BsthTLine bsthTLine)
73 { 76 {
74 return bsthTLineMapper.selectBsthTLineList(bsthTLine); 77 return bsthTLineMapper.selectBsthTLineList(bsthTLine);
@@ -91,6 +94,7 @@ public class BsthTLineServiceImpl implements IBsthTLineService @@ -91,6 +94,7 @@ public class BsthTLineServiceImpl implements IBsthTLineService
91 94
92 95
93 @Override 96 @Override
  97 + @DataScope(deptAlias = "b")
94 public List<BsthTLine> selectBsthTLineHistoryList(BsthTLine bsthTLine) { 98 public List<BsthTLine> selectBsthTLineHistoryList(BsthTLine bsthTLine) {
95 return bsthTLineMapper.selectBsthTLineHistoryList(bsthTLine); 99 return bsthTLineMapper.selectBsthTLineHistoryList(bsthTLine);
96 } 100 }
@@ -135,6 +139,7 @@ public class BsthTLineServiceImpl implements IBsthTLineService @@ -135,6 +139,7 @@ public class BsthTLineServiceImpl implements IBsthTLineService
135 139
136 140
137 @Override 141 @Override
  142 + @DataScope(deptAlias = "b")
138 public List<BsthTLine> selectBsthTLineExamineList(BsthTLine bsthTLine) 143 public List<BsthTLine> selectBsthTLineExamineList(BsthTLine bsthTLine)
139 { 144 {
140 return bsthTLineMapper.selectBsthTLineExamineList(bsthTLine); 145 return bsthTLineMapper.selectBsthTLineExamineList(bsthTLine);
@@ -186,7 +191,7 @@ public class BsthTLineServiceImpl implements IBsthTLineService @@ -186,7 +191,7 @@ public class BsthTLineServiceImpl implements IBsthTLineService
186 bsthTLineMapper.deleteBsthTLineExamineById(new String[]{bsthTLine.getId().toString()}); 191 bsthTLineMapper.deleteBsthTLineExamineById(new String[]{bsthTLine.getId().toString()});
187 192
188 //kafka 193 //kafka
189 - List<Map> companyList=this.selectCompany(); 194 + List<Company> companyList=this.selectCompany(new Company());
190 BsthTLineKFK bsthTLineKFK=new BsthTLineKFK(bl,companyList); 195 BsthTLineKFK bsthTLineKFK=new BsthTLineKFK(bl,companyList);
191 bsthTLineKFK.setOperationType("insert"); 196 bsthTLineKFK.setOperationType("insert");
192 this.sendKFK(bsthTLineKFK); 197 this.sendKFK(bsthTLineKFK);
@@ -228,7 +233,7 @@ public class BsthTLineServiceImpl implements IBsthTLineService @@ -228,7 +233,7 @@ public class BsthTLineServiceImpl implements IBsthTLineService
228 //删除审核表记录 233 //删除审核表记录
229 bsthTLineMapper.deleteBsthTLineExamineById(new String[]{String.valueOf(id)}); 234 bsthTLineMapper.deleteBsthTLineExamineById(new String[]{String.valueOf(id)});
230 //kafka 235 //kafka
231 - List<Map> companyList=this.selectCompany(); 236 + List<Company> companyList=this.selectCompany(new Company());
232 BsthTLineKFK bsthTLineKFK=new BsthTLineKFK(bl,companyList); 237 BsthTLineKFK bsthTLineKFK=new BsthTLineKFK(bl,companyList);
233 bsthTLineKFK.setOperationType("update"); 238 bsthTLineKFK.setOperationType("update");
234 this.sendKFK(bsthTLineKFK); 239 this.sendKFK(bsthTLineKFK);
@@ -272,8 +277,9 @@ public class BsthTLineServiceImpl implements IBsthTLineService @@ -272,8 +277,9 @@ public class BsthTLineServiceImpl implements IBsthTLineService
272 } 277 }
273 278
274 @Override 279 @Override
275 - public List<Map> selectCompany(){  
276 - return bsthTLineMapper.selectCompany(); 280 + @DataScope(deptAlias = "c")
  281 + public List<Company> selectCompany(Company company){
  282 + return bsthTLineMapper.selectCompany(company);
277 } 283 }
278 284
279 public static Date initDateByDay(){ 285 public static Date initDateByDay(){
bsthLineProfiles/src/main/java/com/ruoyi/project/system/user/controller/LoginController.java
@@ -5,6 +5,8 @@ import java.util.*; @@ -5,6 +5,8 @@ import java.util.*;
5 import javax.servlet.http.HttpServletRequest; 5 import javax.servlet.http.HttpServletRequest;
6 import javax.servlet.http.HttpServletResponse; 6 import javax.servlet.http.HttpServletResponse;
7 7
  8 +import cn.hutool.http.Header;
  9 +import cn.hutool.http.HttpRequest;
8 import com.ruoyi.common.utils.security.ShiroUtils; 10 import com.ruoyi.common.utils.security.ShiroUtils;
9 import com.ruoyi.project.system.user.service.IUserService; 11 import com.ruoyi.project.system.user.service.IUserService;
10 import com.ruoyi.project.system.user.service.UserServiceImpl; 12 import com.ruoyi.project.system.user.service.UserServiceImpl;
@@ -100,7 +102,7 @@ public class LoginController extends BaseController @@ -100,7 +102,7 @@ public class LoginController extends BaseController
100 102
101 103
102 JSONObject dataJson = jsonObject.getJSONObject("data"); 104 JSONObject dataJson = jsonObject.getJSONObject("data");
103 - 105 + System.out.println(dataJson);
104 Assert.notNull(dataJson, "获取用户信息异常"); 106 Assert.notNull(dataJson, "获取用户信息异常");
105 107
106 108
@@ -127,7 +129,7 @@ public class LoginController extends BaseController @@ -127,7 +129,7 @@ public class LoginController extends BaseController
127 129
128 130
129 131
130 - login("bus123","bus123",false); 132 + login("admin","admin123",false);
131 user = getSysUser(); 133 user = getSysUser();
132 user.setToken(token); 134 user.setToken(token);
133 // user.setPermissions(permissionService.getMenuPermission()); 135 // user.setPermissions(permissionService.getMenuPermission());
@@ -270,4 +272,7 @@ public class LoginController extends BaseController @@ -270,4 +272,7 @@ public class LoginController extends BaseController
270 { 272 {
271 return "error/unauth"; 273 return "error/unauth";
272 } 274 }
  275 +
  276 +
  277 +
273 } 278 }
bsthLineProfiles/src/main/resources/mybatis/mybatis/system/BsthTLineMapper.xml
@@ -78,32 +78,16 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -78,32 +78,16 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
78 </resultMap> 78 </resultMap>
79 79
80 80
81 - <!--<resultMap type="LineEditReport" id="LineEditReportResult">  
82 - <result property="id" column="id" />  
83 - <result property="lineName" column="line_name" />  
84 - <result property="company" column="company" />  
85 - <result property="lineDistance" column="line_distance" />  
86 - <result property="vehiclesNumber" column="vehicles_number" />  
87 - <result property="numberPerson" column="number_person" />  
88 - <result property="lineDistanceBefore" column="line_distance_before" />  
89 - <result property="vehiclesNumberBefore" column="vehicles_number_before" />  
90 - <result property="numberPersonBefore" column="number_person_before" />  
91 - <result property="createTime" column="create_time" />  
92 - <result property="lineUpdateType" column="line_update_type" />  
93 - <result property="files" column="files" />  
94 - </resultMap>  
95 --->  
96 -  
97 <sql id="selectBsthTLineVo"> 81 <sql id="selectBsthTLineVo">
98 - select * from bsth_t_line 82 + select * from bsth_t_line b
99 </sql> 83 </sql>
100 84
101 <sql id="selectBsthTLineExamineVo"> 85 <sql id="selectBsthTLineExamineVo">
102 - select * from bsth_t_line_examine 86 + select * from bsth_t_line_examine b
103 </sql> 87 </sql>
104 88
105 <sql id="selectBsthTLineHistoryVo"> 89 <sql id="selectBsthTLineHistoryVo">
106 - select * from bsth_t_line_history 90 + select * from bsth_t_line_history b
107 </sql> 91 </sql>
108 92
109 <select id="selectBsthTLineList" parameterType="BsthTLine" resultMap="BsthTLineResult"> 93 <select id="selectBsthTLineList" parameterType="BsthTLine" resultMap="BsthTLineResult">
@@ -171,7 +155,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -171,7 +155,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
171 <if test="lineUpdateType != null and lineUpdateType != ''"> and line_update_type= #{lineUpdateType}</if> 155 <if test="lineUpdateType != null and lineUpdateType != ''"> and line_update_type= #{lineUpdateType}</if>
172 <if test="revenueType != null and revenueType != ''"> and revenue_type= #{revenueType}</if> 156 <if test="revenueType != null and revenueType != ''"> and revenue_type= #{revenueType}</if>
173 <if test="createTimeEnd != null and createTimeEnd != ''"> and create_time &lt;= #{createTimeEnd}</if> 157 <if test="createTimeEnd != null and createTimeEnd != ''"> and create_time &lt;= #{createTimeEnd}</if>
174 - 158 + ${params.dataScope}
175 </where> 159 </where>
176 order by id desc 160 order by id desc
177 </select> 161 </select>
@@ -547,6 +531,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -547,6 +531,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
547 <if test="examineType != null and examineType != ''"> and examine_type = #{examineType}</if> 531 <if test="examineType != null and examineType != ''"> and examine_type = #{examineType}</if>
548 <if test="createTimeStr != null and createTimeStr != ''"> and create_time >= #{createTimeStr}</if> 532 <if test="createTimeStr != null and createTimeStr != ''"> and create_time >= #{createTimeStr}</if>
549 <if test="createTimeEnd != null and createTimeEnd != ''"> and create_time &lt;= #{createTimeEnd}</if> 533 <if test="createTimeEnd != null and createTimeEnd != ''"> and create_time &lt;= #{createTimeEnd}</if>
  534 + ${params.dataScope}
550 </where> 535 </where>
551 order by id desc 536 order by id desc
552 </select> 537 </select>
@@ -861,6 +846,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -861,6 +846,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
861 <if test="historyId != null and historyId != ''"> and history_id is not null</if> 846 <if test="historyId != null and historyId != ''"> and history_id is not null</if>
862 <if test="updateStatus != null and updateStatus != ''"> and update_status #{updateStatus}</if> 847 <if test="updateStatus != null and updateStatus != ''"> and update_status #{updateStatus}</if>
863 <if test="lineUpdateType != null and lineUpdateType != ''"> and line_update_type =#{lineUpdateType}</if> 848 <if test="lineUpdateType != null and lineUpdateType != ''"> and line_update_type =#{lineUpdateType}</if>
  849 + ${params.dataScope}
864 </where> 850 </where>
865 order by id desc 851 order by id desc
866 </select> 852 </select>
@@ -1312,8 +1298,11 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -1312,8 +1298,11 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
1312 delete from bsth_t_line_history where id=#{id} 1298 delete from bsth_t_line_history where id=#{id}
1313 </delete> 1299 </delete>
1314 1300
1315 - <select id="selectCompany" resultType="map">  
1316 - select * from bsth_company 1301 + <select id="selectCompany" parameterType="com.ruoyi.project.system.line.domain.Company" resultType="com.ruoyi.project.system.line.domain.Company">
  1302 + select * from bsth_company c
  1303 + <where>
  1304 + ${params.dataScope}
  1305 + </where>
1317 </select> 1306 </select>
1318 1307
1319 1308
bsthLineProfiles/src/main/resources/mybatis/system/DeptMapper.xml
@@ -6,6 +6,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -6,6 +6,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
6 6
7 <resultMap type="Dept" id="DeptResult"> 7 <resultMap type="Dept" id="DeptResult">
8 <id property="deptId" column="dept_id" /> 8 <id property="deptId" column="dept_id" />
  9 + <result property="code" column="code" />
  10 + <result property="id" column="id" />
9 <result property="parentId" column="parent_id" /> 11 <result property="parentId" column="parent_id" />
10 <result property="ancestors" column="ancestors" /> 12 <result property="ancestors" column="ancestors" />
11 <result property="deptName" column="dept_name" /> 13 <result property="deptName" column="dept_name" />
@@ -23,7 +25,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -23,7 +25,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
23 </resultMap> 25 </resultMap>
24 26
25 <sql id="selectDeptVo"> 27 <sql id="selectDeptVo">
26 - select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time 28 + select d.dept_id,d.code,d.id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
27 from sys_dept d 29 from sys_dept d
28 </sql> 30 </sql>
29 31
@@ -41,6 +43,12 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -41,6 +43,12 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
41 <if test="parentId != null and parentId != 0"> 43 <if test="parentId != null and parentId != 0">
42 AND parent_id = #{parentId} 44 AND parent_id = #{parentId}
43 </if> 45 </if>
  46 + <if test="code != null and code != ''">
  47 + AND code = #{code}
  48 + </if>
  49 + <if test="id != null and id != ''">
  50 + AND id = #{id}
  51 + </if>
44 <if test="deptName != null and deptName != ''"> 52 <if test="deptName != null and deptName != ''">
45 AND dept_name like concat('%', #{deptName}, '%') 53 AND dept_name like concat('%', #{deptName}, '%')
46 </if> 54 </if>
@@ -69,10 +77,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -69,10 +77,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
69 </select> 77 </select>
70 78
71 <select id="selectDeptById" parameterType="Long" resultMap="DeptResult"> 79 <select id="selectDeptById" parameterType="Long" resultMap="DeptResult">
72 - select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,  
73 - (select dept_name from sys_dept where dept_id = d.parent_id) parent_name  
74 - from sys_dept d  
75 - where d.dept_id = #{deptId} 80 + <include refid="selectDeptVo"/>
  81 + where dept_id = #{deptId}
76 </select> 82 </select>
77 83
78 <select id="selectChildrenDeptById" parameterType="Long" resultMap="DeptResult"> 84 <select id="selectChildrenDeptById" parameterType="Long" resultMap="DeptResult">
@@ -83,7 +89,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -83,7 +89,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
83 select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors) 89 select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
84 </select> 90 </select>
85 91
86 - <insert id="insertDept" parameterType="Dept"> 92 + <insert id="insertDept" parameterType="Dept" useGeneratedKeys="true" keyProperty="deptId">
87 insert into sys_dept( 93 insert into sys_dept(
88 <if test="deptId != null and deptId != 0">dept_id,</if> 94 <if test="deptId != null and deptId != 0">dept_id,</if>
89 <if test="parentId != null and parentId != 0">parent_id,</if> 95 <if test="parentId != null and parentId != 0">parent_id,</if>
@@ -95,6 +101,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -95,6 +101,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
95 <if test="email != null and email != ''">email,</if> 101 <if test="email != null and email != ''">email,</if>
96 <if test="status != null">status,</if> 102 <if test="status != null">status,</if>
97 <if test="createBy != null and createBy != ''">create_by,</if> 103 <if test="createBy != null and createBy != ''">create_by,</if>
  104 + <if test="code != null and code != ''">code,</if>
  105 + <if test="id != null and id != ''">id,</if>
98 create_time 106 create_time
99 )values( 107 )values(
100 <if test="deptId != null and deptId != 0">#{deptId},</if> 108 <if test="deptId != null and deptId != 0">#{deptId},</if>
@@ -107,6 +115,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -107,6 +115,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
107 <if test="email != null and email != ''">#{email},</if> 115 <if test="email != null and email != ''">#{email},</if>
108 <if test="status != null">#{status},</if> 116 <if test="status != null">#{status},</if>
109 <if test="createBy != null and createBy != ''">#{createBy},</if> 117 <if test="createBy != null and createBy != ''">#{createBy},</if>
  118 + <if test="code != null and code != ''">#{code},</if>
  119 + <if test="id != null and id != ''">#{id},</if>
110 sysdate() 120 sysdate()
111 ) 121 )
112 </insert> 122 </insert>
@@ -123,6 +133,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -123,6 +133,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
123 <if test="email != null">email = #{email},</if> 133 <if test="email != null">email = #{email},</if>
124 <if test="status != null and status != ''">status = #{status},</if> 134 <if test="status != null and status != ''">status = #{status},</if>
125 <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> 135 <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  136 + <if test="code != null and code != ''">code = #{code},</if>
  137 + <if test="id != null and id != ''">id = #{id},</if>
126 update_time = sysdate() 138 update_time = sysdate()
127 </set> 139 </set>
128 where dept_id = #{deptId} 140 where dept_id = #{deptId}
@@ -155,4 +167,9 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -155,4 +167,9 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
155 where dept_id in (${ancestors}) 167 where dept_id in (${ancestors})
156 </update> 168 </update>
157 169
  170 + <select id="selectDeptByCode" parameterType="String" resultMap="DeptResult">
  171 + <include refid="selectDeptVo"/>
  172 + where d.code = #{code}
  173 + </select>
  174 +
158 </mapper> 175 </mapper>
159 \ No newline at end of file 176 \ No newline at end of file