Commit 5e8d9026b50aa2bc73f21dcbdaba46ba9343611e

Authored by 王富生
1 parent e72092a3

提交

src/main/java/com/zteits/oa/api/dto/asradaily/AsraProjectAndPersonNumDTO.java
@@ -45,6 +45,37 @@ public class AsraProjectAndPersonNumDTO extends BaiscDTO{ @@ -45,6 +45,37 @@ public class AsraProjectAndPersonNumDTO extends BaiscDTO{
45 public void setCommitPersonNum(Integer commitPersonNum) { 45 public void setCommitPersonNum(Integer commitPersonNum) {
46 this.commitPersonNum = commitPersonNum; 46 this.commitPersonNum = commitPersonNum;
47 } 47 }
  48 +
  49 +
  50 + @Override
  51 + public int hashCode() {
  52 + final int prime = 31;
  53 + int result = 1;
  54 + result = prime * result + ((projectId == null) ? 0 : projectId.hashCode());
  55 + result = prime * result + ((projectName == null) ? 0 : projectName.hashCode());
  56 + return result;
  57 + }
  58 + @Override
  59 + public boolean equals(Object obj) {
  60 + if (this == obj)
  61 + return true;
  62 + if (obj == null)
  63 + return false;
  64 + if (getClass() != obj.getClass())
  65 + return false;
  66 + AsraProjectAndPersonNumDTO other = (AsraProjectAndPersonNumDTO) obj;
  67 + if (projectId == null) {
  68 + if (other.projectId != null)
  69 + return false;
  70 + } else if (!projectId.equals(other.projectId))
  71 + return false;
  72 + if (projectName == null) {
  73 + if (other.projectName != null)
  74 + return false;
  75 + } else if (!projectName.equals(other.projectName))
  76 + return false;
  77 + return true;
  78 + }
48 @Override 79 @Override
49 public String toString() { 80 public String toString() {
50 return "AsraProjectAndPersonNumDTO [projectId=" + projectId + ", projectName=" + projectName 81 return "AsraProjectAndPersonNumDTO [projectId=" + projectId + ", projectName=" + projectName
src/main/java/com/zteits/oa/api/dto/asraop/AsraOpDTO.java
1 package com.zteits.oa.api.dto.asraop; 1 package com.zteits.oa.api.dto.asraop;
2 2
3 import java.util.Date; 3 import java.util.Date;
  4 +import java.util.List;
4 5
5 import com.zteits.oa.api.base.bean.BaiscDTO; 6 import com.zteits.oa.api.base.bean.BaiscDTO;
6 /** 7 /**
@@ -77,8 +78,20 @@ public class AsraOpDTO extends BaiscDTO{ @@ -77,8 +78,20 @@ public class AsraOpDTO extends BaiscDTO{
77 78
78 /**描述*/ 79 /**描述*/
79 private String remark; 80 private String remark;
  81 + /**员工ids.*/
  82 + private List<Long> opIds;
  83 +
  84 +
  85 +
  86 + public List<Long> getOpIds() {
  87 + return opIds;
  88 + }
  89 +
  90 + public void setOpIds(List<Long> opIds) {
  91 + this.opIds = opIds;
  92 + }
80 93
81 - /**获取主键*/ 94 + /**获取主键*/
82 public Long getId() { 95 public Long getId() {
83 return id; 96 return id;
84 } 97 }
src/main/java/com/zteits/oa/api/dto/asraop/LoginOathRes.java
1 package com.zteits.oa.api.dto.asraop; 1 package com.zteits.oa.api.dto.asraop;
2 2
3 import java.io.Serializable; 3 import java.io.Serializable;
  4 +import java.util.List;
4 5
5 /** 6 /**
6 * 登陆授权response.<br/> 7 * 登陆授权response.<br/>
@@ -52,6 +53,18 @@ public class LoginOathRes implements Serializable { @@ -52,6 +53,18 @@ public class LoginOathRes implements Serializable {
52 private Long cityId; 53 private Long cityId;
53 /** 地市名称 */ 54 /** 地市名称 */
54 private String cityName; 55 private String cityName;
  56 +
  57 + /**员工ids.*/
  58 + private List<Long> opIds;
  59 +
  60 +
  61 +
  62 + public List<Long> getOpIds() {
  63 + return opIds;
  64 + }
  65 + public void setOpIds(List<Long> opIds) {
  66 + this.opIds = opIds;
  67 + }
55 public String getAccessToken() { 68 public String getAccessToken() {
56 return accessToken; 69 return accessToken;
57 } 70 }
src/main/java/com/zteits/oa/report/biz/AsraOpRelationsQueryServiceImpl.java
@@ -5,7 +5,6 @@ import com.zteits.oa.api.base.bean.BizResult; @@ -5,7 +5,6 @@ import com.zteits.oa.api.base.bean.BizResult;
5 import com.zteits.oa.api.dto.asraoprelations.AsraOpRelationsDTO; 5 import com.zteits.oa.api.dto.asraoprelations.AsraOpRelationsDTO;
6 import com.zteits.oa.api.dto.asraoprelations.param.AsraOpRelationsQueryReq; 6 import com.zteits.oa.api.dto.asraoprelations.param.AsraOpRelationsQueryReq;
7 import com.zteits.oa.api.service.report.query.AsraOpRelationsQueryService; 7 import com.zteits.oa.api.service.report.query.AsraOpRelationsQueryService;
8 -import com.zteits.oa.report.dao.AsraOpRelationsDao;  
9 import com.zteits.oa.report.domain.AsraOpRelations; 8 import com.zteits.oa.report.domain.AsraOpRelations;
10 import org.springframework.beans.BeanUtils; 9 import org.springframework.beans.BeanUtils;
11 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
@@ -29,14 +28,14 @@ import java.util.List; @@ -29,14 +28,14 @@ import java.util.List;
29 @Service 28 @Service
30 public class AsraOpRelationsQueryServiceImpl implements AsraOpRelationsQueryService { 29 public class AsraOpRelationsQueryServiceImpl implements AsraOpRelationsQueryService {
31 30
32 - @Autowired  
33 - private AsraOpRelationsDao asraOpRelationsDao; 31 + //@Autowired
  32 + //private AsraOpRelationsDao asraOpRelationsDao;
34 33
35 @Override 34 @Override
36 public BizResult<List<AsraOpRelationsDTO>> queryAsraOpRelations(AsraOpRelationsQueryReq asraOpRelationsQueryReq) { 35 public BizResult<List<AsraOpRelationsDTO>> queryAsraOpRelations(AsraOpRelationsQueryReq asraOpRelationsQueryReq) {
37 36
38 List<AsraOpRelationsDTO> asraOpRelationsDTOs = new ArrayList<>(); 37 List<AsraOpRelationsDTO> asraOpRelationsDTOs = new ArrayList<>();
39 - List<AsraOpRelations> asraOpRelationsList = asraOpRelationsDao.queryAsraOpRelations(asraOpRelationsQueryReq.getParentId()); 38 + List<AsraOpRelations> asraOpRelationsList = null;//asraOpRelationsDao.queryAsraOpRelations(asraOpRelationsQueryReq.getParentId());
40 if(CollectionUtil.isNotEmpty(asraOpRelationsList)) { 39 if(CollectionUtil.isNotEmpty(asraOpRelationsList)) {
41 BeanUtils.copyProperties(asraOpRelationsList, asraOpRelationsDTOs, AsraOpRelationsDTO.class); 40 BeanUtils.copyProperties(asraOpRelationsList, asraOpRelationsDTOs, AsraOpRelationsDTO.class);
42 } 41 }
src/main/java/com/zteits/oa/report/dao/AsraOpRelationsDao.java deleted
1 -package com.zteits.oa.report.dao;  
2 -  
3 -import com.zteits.oa.report.domain.AsraOpRelations;  
4 -  
5 -import java.util.List;  
6 -  
7 -/**  
8 - * Copyright: Copyright (c) 2018 zteits  
9 - *  
10 - * @Description:  
11 - * @version: v1.0.0  
12 - * @author: xiejianpeng  
13 - * @date: 2018/7/31 11  
14 - * Modification History:  
15 - * Date Author Version Description  
16 - * ---------------------------------------------------------*  
17 - * 2018/7/31 xiejianpeng v1.0.0 创建  
18 - */  
19 -public interface AsraOpRelationsDao {  
20 -  
21 - /**  
22 - * 根据登录工号查询管理的员工信息  
23 - * @param  
24 - * @return  
25 - * @Author: xiejianpeng  
26 - * @Date: 2018/7/31 11:42  
27 - *  
28 - */  
29 - List<AsraOpRelations> queryAsraOpRelations(Long parentId);  
30 -}  
src/main/java/com/zteits/oa/report/dao/impl/AsraDailyDaoImpl.java
@@ -19,7 +19,6 @@ import com.zteits.oa.report.domain.AsraOpRelationsExample; @@ -19,7 +19,6 @@ import com.zteits.oa.report.domain.AsraOpRelationsExample;
19 import com.zteits.oa.report.domain.sdo.AsraDailyDO; 19 import com.zteits.oa.report.domain.sdo.AsraDailyDO;
20 import com.zteits.oa.report.domain.sdo.AsraDailyOpNumForCurrentDayDO; 20 import com.zteits.oa.report.domain.sdo.AsraDailyOpNumForCurrentDayDO;
21 import com.zteits.oa.report.mapper.AsraDailyMapper; 21 import com.zteits.oa.report.mapper.AsraDailyMapper;
22 -import com.zteits.oa.report.mapper.AsraOpRelationsMapper;  
23 import com.zteits.oa.report.mapper.smapper.AsraDailySmapper; 22 import com.zteits.oa.report.mapper.smapper.AsraDailySmapper;
24 23
25 /** 24 /**
@@ -39,8 +38,7 @@ public class AsraDailyDaoImpl implements AsraDailyDao{ @@ -39,8 +38,7 @@ public class AsraDailyDaoImpl implements AsraDailyDao{
39 38
40 @Autowired 39 @Autowired
41 private AsraDailyMapper asraDailyMapper; 40 private AsraDailyMapper asraDailyMapper;
42 - @Autowired  
43 - private AsraOpRelationsMapper asraOpRelationsMapper; 41 +
44 @Autowired 42 @Autowired
45 private AsraDailySmapper asraDailySmapper; 43 private AsraDailySmapper asraDailySmapper;
46 44
@@ -73,21 +71,22 @@ public class AsraDailyDaoImpl implements AsraDailyDao{ @@ -73,21 +71,22 @@ public class AsraDailyDaoImpl implements AsraDailyDao{
73 public AsraDailyOpNumForCurrentDayDO queryAsraDailyOpNumForCurrentDay(AsraDailyForTotalNumAndDetailReq request) { 71 public AsraDailyOpNumForCurrentDayDO queryAsraDailyOpNumForCurrentDay(AsraDailyForTotalNumAndDetailReq request) {
74 AsraDailyOpNumForCurrentDayDO asraDailyOpNumForCurrentDayDO = new AsraDailyOpNumForCurrentDayDO(); 72 AsraDailyOpNumForCurrentDayDO asraDailyOpNumForCurrentDayDO = new AsraDailyOpNumForCurrentDayDO();
75 List<Long> opList = new ArrayList<>(); 73 List<Long> opList = new ArrayList<>();
76 - //1.总人数获取  
77 - AsraOpRelationsExample example = new AsraOpRelationsExample();  
78 - example.createCriteria().andParentIdEqualTo(request.getOpId());  
79 - List<AsraOpRelations> selectByExample = asraOpRelationsMapper.selectByExample(example);  
80 - int employeeTotal = (CollectionUtil.isNotEmpty(selectByExample) ? selectByExample.size() +1 : 1);  
81 - asraDailyOpNumForCurrentDayDO.setEmployeeTotal(employeeTotal);  
82 - //获取员工人数  
83 - if(CollectionUtil.isNotEmpty(selectByExample)){  
84 - for(AsraOpRelations op:selectByExample){  
85 - if(op == null){  
86 - continue;  
87 - }  
88 - opList.add(op.getOpId());  
89 - }  
90 - } 74 + int employeeTotal = 0;
  75 +// //1.总人数获取
  76 +// AsraOpRelationsExample example = new AsraOpRelationsExample();
  77 +// example.createCriteria().andParentIdEqualTo(request.getOpId());
  78 +// //List<AsraOpRelations> selectByExample = asraOpRelationsMapper.selectByExample(example);
  79 +// int employeeTotal = (CollectionUtil.isNotEmpty(selectByExample) ? selectByExample.size() +1 : 1);
  80 +// asraDailyOpNumForCurrentDayDO.setEmployeeTotal(employeeTotal);
  81 +// //获取员工人数
  82 +// if(CollectionUtil.isNotEmpty(selectByExample)){
  83 +// for(AsraOpRelations op:selectByExample){
  84 +// if(op == null){
  85 +// continue;
  86 +// }
  87 +// opList.add(op.getOpId());
  88 +// }
  89 +// }
91 opList.add(request.getOpId());//查询自己id 90 opList.add(request.getOpId());//查询自己id
92 //2.查询今日日报填写人数 91 //2.查询今日日报填写人数
93 AsraDailyExample exampleTwo = new AsraDailyExample(); 92 AsraDailyExample exampleTwo = new AsraDailyExample();
src/main/java/com/zteits/oa/report/dao/impl/AsraOpRelationsDaoImpl.java deleted
1 -package com.zteits.oa.report.dao.impl;  
2 -  
3 -import com.zteits.oa.report.dao.AsraOpRelationsDao;  
4 -import com.zteits.oa.report.domain.AsraOpRelations;  
5 -import com.zteits.oa.report.domain.AsraOpRelationsExample;  
6 -import com.zteits.oa.report.mapper.AsraOpRelationsMapper;  
7 -import org.springframework.beans.factory.annotation.Autowired;  
8 -import org.springframework.stereotype.Component;  
9 -  
10 -import java.util.List;  
11 -  
12 -/**  
13 - * Copyright: Copyright (c) 2018 zteits  
14 - *  
15 - * @Description:  
16 - * @version: v1.0.0  
17 - * @author: xiejianpeng  
18 - * @date: 2018/7/31 11  
19 - * Modification History:  
20 - * Date Author Version Description  
21 - * ---------------------------------------------------------*  
22 - * 2018/7/31 xiejianpeng v1.0.0 创建  
23 - */  
24 -@Component  
25 -public class AsraOpRelationsDaoImpl implements AsraOpRelationsDao {  
26 -  
27 - @Autowired  
28 - private AsraOpRelationsMapper asraOpRelationsMapper;  
29 -  
30 - @Override  
31 - public List<AsraOpRelations> queryAsraOpRelations(Long parentId) {  
32 - AsraOpRelationsExample example = new AsraOpRelationsExample();  
33 - example.createCriteria().andParentIdEqualTo(parentId);  
34 - List<AsraOpRelations> asraOpRelationsList = asraOpRelationsMapper.selectByExample(example);  
35 - return asraOpRelationsList;  
36 - }  
37 -}  
src/main/java/com/zteits/oa/report/domain/AsraOp.java
@@ -54,6 +54,9 @@ public class AsraOp { @@ -54,6 +54,9 @@ public class AsraOp {
54 /**描述*/ 54 /**描述*/
55 private String remark; 55 private String remark;
56 56
  57 + /**父级ID 顶级为-1*/
  58 + private Long parentId;
  59 +
57 /**获取主键*/ 60 /**获取主键*/
58 public Long getId() { 61 public Long getId() {
59 return id; 62 return id;
@@ -223,4 +226,14 @@ public class AsraOp { @@ -223,4 +226,14 @@ public class AsraOp {
223 public void setRemark(String remark) { 226 public void setRemark(String remark) {
224 this.remark = remark == null ? null : remark.trim(); 227 this.remark = remark == null ? null : remark.trim();
225 } 228 }
  229 +
  230 + /**获取父级ID 顶级为-1*/
  231 + public Long getParentId() {
  232 + return parentId;
  233 + }
  234 +
  235 + /**设置父级ID 顶级为-1*/
  236 + public void setParentId(Long parentId) {
  237 + this.parentId = parentId;
  238 + }
226 } 239 }
227 \ No newline at end of file 240 \ No newline at end of file
src/main/java/com/zteits/oa/report/domain/AsraOpExample.java
@@ -1224,6 +1224,66 @@ public class AsraOpExample { @@ -1224,6 +1224,66 @@ public class AsraOpExample {
1224 addCriterion("remark not between", value1, value2, "remark"); 1224 addCriterion("remark not between", value1, value2, "remark");
1225 return (Criteria) this; 1225 return (Criteria) this;
1226 } 1226 }
  1227 +
  1228 + public Criteria andParentIdIsNull() {
  1229 + addCriterion("parent_id is null");
  1230 + return (Criteria) this;
  1231 + }
  1232 +
  1233 + public Criteria andParentIdIsNotNull() {
  1234 + addCriterion("parent_id is not null");
  1235 + return (Criteria) this;
  1236 + }
  1237 +
  1238 + public Criteria andParentIdEqualTo(Long value) {
  1239 + addCriterion("parent_id =", value, "parentId");
  1240 + return (Criteria) this;
  1241 + }
  1242 +
  1243 + public Criteria andParentIdNotEqualTo(Long value) {
  1244 + addCriterion("parent_id <>", value, "parentId");
  1245 + return (Criteria) this;
  1246 + }
  1247 +
  1248 + public Criteria andParentIdGreaterThan(Long value) {
  1249 + addCriterion("parent_id >", value, "parentId");
  1250 + return (Criteria) this;
  1251 + }
  1252 +
  1253 + public Criteria andParentIdGreaterThanOrEqualTo(Long value) {
  1254 + addCriterion("parent_id >=", value, "parentId");
  1255 + return (Criteria) this;
  1256 + }
  1257 +
  1258 + public Criteria andParentIdLessThan(Long value) {
  1259 + addCriterion("parent_id <", value, "parentId");
  1260 + return (Criteria) this;
  1261 + }
  1262 +
  1263 + public Criteria andParentIdLessThanOrEqualTo(Long value) {
  1264 + addCriterion("parent_id <=", value, "parentId");
  1265 + return (Criteria) this;
  1266 + }
  1267 +
  1268 + public Criteria andParentIdIn(List<Long> values) {
  1269 + addCriterion("parent_id in", values, "parentId");
  1270 + return (Criteria) this;
  1271 + }
  1272 +
  1273 + public Criteria andParentIdNotIn(List<Long> values) {
  1274 + addCriterion("parent_id not in", values, "parentId");
  1275 + return (Criteria) this;
  1276 + }
  1277 +
  1278 + public Criteria andParentIdBetween(Long value1, Long value2) {
  1279 + addCriterion("parent_id between", value1, value2, "parentId");
  1280 + return (Criteria) this;
  1281 + }
  1282 +
  1283 + public Criteria andParentIdNotBetween(Long value1, Long value2) {
  1284 + addCriterion("parent_id not between", value1, value2, "parentId");
  1285 + return (Criteria) this;
  1286 + }
1227 } 1287 }
1228 1288
1229 public static class Criteria extends GeneratedCriteria { 1289 public static class Criteria extends GeneratedCriteria {
src/main/java/com/zteits/oa/report/mapper/AsraOpRelationsMapper.java deleted
1 -package com.zteits.oa.report.mapper;  
2 -  
3 -import com.zteits.oa.report.domain.AsraOpRelations;  
4 -import com.zteits.oa.report.domain.AsraOpRelationsExample;  
5 -import java.util.List;  
6 -import org.apache.ibatis.annotations.Param;  
7 -  
8 -public interface AsraOpRelationsMapper {  
9 - long countByExample(AsraOpRelationsExample example);  
10 -  
11 - int deleteByExample(AsraOpRelationsExample example);  
12 -  
13 - int deleteByPrimaryKey(Long id);  
14 -  
15 - int insert(AsraOpRelations record);  
16 -  
17 - int insertSelective(AsraOpRelations record);  
18 -  
19 - List<AsraOpRelations> selectByExample(AsraOpRelationsExample example);  
20 -  
21 - AsraOpRelations selectByPrimaryKey(Long id);  
22 -  
23 - int updateByExampleSelective(@Param("record") AsraOpRelations record, @Param("example") AsraOpRelationsExample example);  
24 -  
25 - int updateByExample(@Param("record") AsraOpRelations record, @Param("example") AsraOpRelationsExample example);  
26 -  
27 - int updateByPrimaryKeySelective(AsraOpRelations record);  
28 -  
29 - int updateByPrimaryKey(AsraOpRelations record);  
30 -}  
31 \ No newline at end of file 0 \ No newline at end of file
src/main/java/com/zteits/oa/report/web/OAuthController.java
1 package com.zteits.oa.report.web; 1 package com.zteits.oa.report.web;
2 2
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
3 import javax.servlet.http.HttpServletRequest; 6 import javax.servlet.http.HttpServletRequest;
4 import javax.servlet.http.HttpSession; 7 import javax.servlet.http.HttpSession;
5 8
6 -import com.zteits.oa.api.service.report.query.AsraOpQueryService;  
7 import org.slf4j.Logger; 9 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory; 10 import org.slf4j.LoggerFactory;
9 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestBody; @@ -13,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestBody;
13 import org.springframework.web.bind.annotation.RequestMapping; 15 import org.springframework.web.bind.annotation.RequestMapping;
14 import org.springframework.web.bind.annotation.RestController; 16 import org.springframework.web.bind.annotation.RestController;
15 17
  18 +import com.alibaba.fastjson.JSONObject;
16 import com.zteits.oa.api.base.bean.BizResult; 19 import com.zteits.oa.api.base.bean.BizResult;
17 import com.zteits.oa.api.base.constants.ErrorType; 20 import com.zteits.oa.api.base.constants.ErrorType;
18 import com.zteits.oa.api.base.constants.SessionEnum; 21 import com.zteits.oa.api.base.constants.SessionEnum;
@@ -20,6 +23,7 @@ import com.zteits.oa.api.dto.asraop.AsraOpDTO; @@ -20,6 +23,7 @@ import com.zteits.oa.api.dto.asraop.AsraOpDTO;
20 import com.zteits.oa.api.dto.asraop.LoginOathRes; 23 import com.zteits.oa.api.dto.asraop.LoginOathRes;
21 import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; 24 import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq;
22 import com.zteits.oa.api.dto.asraop.param.LoginOauthReq; 25 import com.zteits.oa.api.dto.asraop.param.LoginOauthReq;
  26 +import com.zteits.oa.api.service.report.query.AsraOpQueryService;
23 import com.zteits.oa.report.vo.OAuthResult; 27 import com.zteits.oa.report.vo.OAuthResult;
24 import com.zteits.oa.util.MD5Utils; 28 import com.zteits.oa.util.MD5Utils;
25 29
@@ -85,6 +89,13 @@ public class OAuthController { @@ -85,6 +89,13 @@ public class OAuthController {
85 89
86 90
87 if(isCheckSuccess){ 91 if(isCheckSuccess){
  92 +
  93 + List<Long> opIds = new ArrayList<>();
  94 + opIds.add(asraOpDTO.getId());
  95 + /**递归查询员工ids.*/
  96 + opIds = queryOpTreeByOpId(asraOpDTO.getParentId(),opIds);
  97 + logger.info("---获取到的opIds={}",JSONObject.toJSON(opIds));
  98 + asraOpDTO.setOpIds(opIds);
88 HttpSession session = request.getSession(); 99 HttpSession session = request.getSession();
89 session.setAttribute(SessionEnum.USER_INFO.key(), asraOpDTO); 100 session.setAttribute(SessionEnum.USER_INFO.key(), asraOpDTO);
90 logger.info("---获取到的session_id={}",session.getId()); 101 logger.info("---获取到的session_id={}",session.getId());
@@ -121,6 +132,30 @@ public class OAuthController { @@ -121,6 +132,30 @@ public class OAuthController {
121 logger.info("end用户登出.."); 132 logger.info("end用户登出..");
122 return new OAuthResult<>(true); 133 return new OAuthResult<>(true);
123 } 134 }
  135 +
  136 + /**
  137 + * 递归查询员工id.<br/>
  138 + * @param parentOpId
  139 + * @param opList
  140 + * @return
  141 + * 2018年8月2日 wangfs.<br/>
  142 + */
  143 + private List<Long> queryOpTreeByOpId(Long parentOpId,List<Long> opList){
  144 + if(parentOpId != null && !parentOpId.equals(-1L)){
  145 + AsraOpQueryReq asraOpQueryRe = new AsraOpQueryReq();
  146 + asraOpQueryRe.setId(parentOpId);
  147 + BizResult<AsraOpDTO> asraOpReult = asraOpQueryService.queryAsraOp(asraOpQueryRe);
  148 + if(asraOpReult != null && asraOpReult.getData() != null){
  149 + AsraOpDTO data = asraOpReult.getData();
  150 + if(data != null){
  151 + opList.add(data.getId());
  152 + }
  153 + queryOpTreeByOpId(data.getParentId(),opList);
  154 + }
  155 + }
  156 +
  157 + return opList;
  158 + }
124 159
125 160
126 } 161 }
src/main/resources/generator/generatorConfig.xml
@@ -38,22 +38,7 @@ @@ -38,22 +38,7 @@
38 <javaClientGenerator type="XMLMAPPER" targetPackage="com.zteits.oa.report.mapper" targetProject="src/main/java"> 38 <javaClientGenerator type="XMLMAPPER" targetPackage="com.zteits.oa.report.mapper" targetProject="src/main/java">
39 <property name="enableSubPackages" value="true" /> 39 <property name="enableSubPackages" value="true" />
40 </javaClientGenerator> 40 </javaClientGenerator>
41 - <table tableName="asra_daily">  
42 - <!-- 指定自动生成主键的属性 -->  
43 - <generatedKey column="id" sqlStatement="MySql" identity="true"></generatedKey>  
44 - </table>  
45 - <table tableName="asra_op_relations">  
46 - <!-- 指定自动生成主键的属性 -->  
47 - <generatedKey column="id" sqlStatement="MySql" identity="true"></generatedKey>  
48 - </table>  
49 - <table tableName="asra_project">  
50 - <!-- 指定自动生成主键的属性 -->  
51 - <generatedKey column="id" sqlStatement="MySql" identity="true"></generatedKey>  
52 - </table>  
53 - <table tableName="asra_role">  
54 - <!-- 指定自动生成主键的属性 -->  
55 - <generatedKey column="id" sqlStatement="MySql" identity="true"></generatedKey>  
56 - </table> 41 +
57 <table tableName="asra_op"> 42 <table tableName="asra_op">
58 <!-- 指定自动生成主键的属性 --> 43 <!-- 指定自动生成主键的属性 -->
59 <generatedKey column="id" sqlStatement="MySql" identity="true"></generatedKey> 44 <generatedKey column="id" sqlStatement="MySql" identity="true"></generatedKey>
src/main/resources/mybatis/mapper/AsraOpMapper.xml
@@ -19,6 +19,7 @@ @@ -19,6 +19,7 @@
19 <result column="modfiy_emp_name" jdbcType="VARCHAR" property="modfiyEmpName" /> 19 <result column="modfiy_emp_name" jdbcType="VARCHAR" property="modfiyEmpName" />
20 <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" /> 20 <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
21 <result column="remark" jdbcType="VARCHAR" property="remark" /> 21 <result column="remark" jdbcType="VARCHAR" property="remark" />
  22 + <result column="parent_id" jdbcType="BIGINT" property="parentId" />
22 </resultMap> 23 </resultMap>
23 <sql id="Example_Where_Clause"> 24 <sql id="Example_Where_Clause">
24 <where> 25 <where>
@@ -81,7 +82,7 @@ @@ -81,7 +82,7 @@
81 <sql id="Base_Column_List"> 82 <sql id="Base_Column_List">
82 id, login_code, login_password, op_name, email, role_id, city_id, city_name, is_remind_email, 83 id, login_code, login_password, op_name, email, role_id, city_id, city_name, is_remind_email,
83 data_state, create_empid, create_emp_name, create_date, modfiy_empid, modfiy_emp_name, 84 data_state, create_empid, create_emp_name, create_date, modfiy_empid, modfiy_emp_name,
84 - modfiy_date, remark 85 + modfiy_date, remark, parent_id
85 </sql> 86 </sql>
86 <select id="selectByExample" parameterType="com.zteits.oa.report.domain.AsraOpExample" resultMap="BaseResultMap"> 87 <select id="selectByExample" parameterType="com.zteits.oa.report.domain.AsraOpExample" resultMap="BaseResultMap">
87 select 88 select
@@ -122,13 +123,13 @@ @@ -122,13 +123,13 @@
122 city_name, is_remind_email, data_state, 123 city_name, is_remind_email, data_state,
123 create_empid, create_emp_name, create_date, 124 create_empid, create_emp_name, create_date,
124 modfiy_empid, modfiy_emp_name, modfiy_date, 125 modfiy_empid, modfiy_emp_name, modfiy_date,
125 - remark) 126 + remark, parent_id)
126 values (#{loginCode,jdbcType=VARCHAR}, #{loginPassword,jdbcType=VARCHAR}, #{opName,jdbcType=VARCHAR}, 127 values (#{loginCode,jdbcType=VARCHAR}, #{loginPassword,jdbcType=VARCHAR}, #{opName,jdbcType=VARCHAR},
127 #{email,jdbcType=VARCHAR}, #{roleId,jdbcType=BIGINT}, #{cityId,jdbcType=BIGINT}, 128 #{email,jdbcType=VARCHAR}, #{roleId,jdbcType=BIGINT}, #{cityId,jdbcType=BIGINT},
128 #{cityName,jdbcType=VARCHAR}, #{isRemindEmail,jdbcType=INTEGER}, #{dataState,jdbcType=INTEGER}, 129 #{cityName,jdbcType=VARCHAR}, #{isRemindEmail,jdbcType=INTEGER}, #{dataState,jdbcType=INTEGER},
129 #{createEmpid,jdbcType=VARCHAR}, #{createEmpName,jdbcType=VARCHAR}, #{createDate,jdbcType=TIMESTAMP}, 130 #{createEmpid,jdbcType=VARCHAR}, #{createEmpName,jdbcType=VARCHAR}, #{createDate,jdbcType=TIMESTAMP},
130 #{modfiyEmpid,jdbcType=VARCHAR}, #{modfiyEmpName,jdbcType=VARCHAR}, #{modfiyDate,jdbcType=TIMESTAMP}, 131 #{modfiyEmpid,jdbcType=VARCHAR}, #{modfiyEmpName,jdbcType=VARCHAR}, #{modfiyDate,jdbcType=TIMESTAMP},
131 - #{remark,jdbcType=VARCHAR}) 132 + #{remark,jdbcType=VARCHAR}, #{parentId,jdbcType=BIGINT})
132 </insert> 133 </insert>
133 <insert id="insertSelective" parameterType="com.zteits.oa.report.domain.AsraOp"> 134 <insert id="insertSelective" parameterType="com.zteits.oa.report.domain.AsraOp">
134 <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> 135 <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
@@ -184,6 +185,9 @@ @@ -184,6 +185,9 @@
184 <if test="remark != null"> 185 <if test="remark != null">
185 remark, 186 remark,
186 </if> 187 </if>
  188 + <if test="parentId != null">
  189 + parent_id,
  190 + </if>
187 </trim> 191 </trim>
188 <trim prefix="values (" suffix=")" suffixOverrides=","> 192 <trim prefix="values (" suffix=")" suffixOverrides=",">
189 <if test="loginCode != null"> 193 <if test="loginCode != null">
@@ -234,6 +238,9 @@ @@ -234,6 +238,9 @@
234 <if test="remark != null"> 238 <if test="remark != null">
235 #{remark,jdbcType=VARCHAR}, 239 #{remark,jdbcType=VARCHAR},
236 </if> 240 </if>
  241 + <if test="parentId != null">
  242 + #{parentId,jdbcType=BIGINT},
  243 + </if>
237 </trim> 244 </trim>
238 </insert> 245 </insert>
239 <select id="countByExample" parameterType="com.zteits.oa.report.domain.AsraOpExample" resultType="java.lang.Long"> 246 <select id="countByExample" parameterType="com.zteits.oa.report.domain.AsraOpExample" resultType="java.lang.Long">
@@ -296,6 +303,9 @@ @@ -296,6 +303,9 @@
296 <if test="record.remark != null"> 303 <if test="record.remark != null">
297 remark = #{record.remark,jdbcType=VARCHAR}, 304 remark = #{record.remark,jdbcType=VARCHAR},
298 </if> 305 </if>
  306 + <if test="record.parentId != null">
  307 + parent_id = #{record.parentId,jdbcType=BIGINT},
  308 + </if>
299 </set> 309 </set>
300 <if test="_parameter != null"> 310 <if test="_parameter != null">
301 <include refid="Update_By_Example_Where_Clause" /> 311 <include refid="Update_By_Example_Where_Clause" />
@@ -319,7 +329,8 @@ @@ -319,7 +329,8 @@
319 modfiy_empid = #{record.modfiyEmpid,jdbcType=VARCHAR}, 329 modfiy_empid = #{record.modfiyEmpid,jdbcType=VARCHAR},
320 modfiy_emp_name = #{record.modfiyEmpName,jdbcType=VARCHAR}, 330 modfiy_emp_name = #{record.modfiyEmpName,jdbcType=VARCHAR},
321 modfiy_date = #{record.modfiyDate,jdbcType=TIMESTAMP}, 331 modfiy_date = #{record.modfiyDate,jdbcType=TIMESTAMP},
322 - remark = #{record.remark,jdbcType=VARCHAR} 332 + remark = #{record.remark,jdbcType=VARCHAR},
  333 + parent_id = #{record.parentId,jdbcType=BIGINT}
323 <if test="_parameter != null"> 334 <if test="_parameter != null">
324 <include refid="Update_By_Example_Where_Clause" /> 335 <include refid="Update_By_Example_Where_Clause" />
325 </if> 336 </if>
@@ -375,6 +386,9 @@ @@ -375,6 +386,9 @@
375 <if test="remark != null"> 386 <if test="remark != null">
376 remark = #{remark,jdbcType=VARCHAR}, 387 remark = #{remark,jdbcType=VARCHAR},
377 </if> 388 </if>
  389 + <if test="parentId != null">
  390 + parent_id = #{parentId,jdbcType=BIGINT},
  391 + </if>
378 </set> 392 </set>
379 where id = #{id,jdbcType=BIGINT} 393 where id = #{id,jdbcType=BIGINT}
380 </update> 394 </update>
@@ -395,7 +409,8 @@ @@ -395,7 +409,8 @@
395 modfiy_empid = #{modfiyEmpid,jdbcType=VARCHAR}, 409 modfiy_empid = #{modfiyEmpid,jdbcType=VARCHAR},
396 modfiy_emp_name = #{modfiyEmpName,jdbcType=VARCHAR}, 410 modfiy_emp_name = #{modfiyEmpName,jdbcType=VARCHAR},
397 modfiy_date = #{modfiyDate,jdbcType=TIMESTAMP}, 411 modfiy_date = #{modfiyDate,jdbcType=TIMESTAMP},
398 - remark = #{remark,jdbcType=VARCHAR} 412 + remark = #{remark,jdbcType=VARCHAR},
  413 + parent_id = #{parentId,jdbcType=BIGINT}
399 where id = #{id,jdbcType=BIGINT} 414 where id = #{id,jdbcType=BIGINT}
400 </update> 415 </update>
401 </mapper> 416 </mapper>
402 \ No newline at end of file 417 \ No newline at end of file
src/main/resources/mybatis/mapper/AsraOpRelationsMapper.xml deleted
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">  
3 -<mapper namespace="com.zteits.oa.report.mapper.AsraOpRelationsMapper">  
4 - <resultMap id="BaseResultMap" type="com.zteits.oa.report.domain.AsraOpRelations">  
5 - <id column="id" jdbcType="BIGINT" property="id" />  
6 - <result column="parent_id" jdbcType="BIGINT" property="parentId" />  
7 - <result column="op_id" jdbcType="BIGINT" property="opId" />  
8 - <result column="data_state" jdbcType="INTEGER" property="dataState" />  
9 - </resultMap>  
10 - <sql id="Example_Where_Clause">  
11 - <where>  
12 - <foreach collection="oredCriteria" item="criteria" separator="or">  
13 - <if test="criteria.valid">  
14 - <trim prefix="(" prefixOverrides="and" suffix=")">  
15 - <foreach collection="criteria.criteria" item="criterion">  
16 - <choose>  
17 - <when test="criterion.noValue">  
18 - and ${criterion.condition}  
19 - </when>  
20 - <when test="criterion.singleValue">  
21 - and ${criterion.condition} #{criterion.value}  
22 - </when>  
23 - <when test="criterion.betweenValue">  
24 - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}  
25 - </when>  
26 - <when test="criterion.listValue">  
27 - and ${criterion.condition}  
28 - <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">  
29 - #{listItem}  
30 - </foreach>  
31 - </when>  
32 - </choose>  
33 - </foreach>  
34 - </trim>  
35 - </if>  
36 - </foreach>  
37 - </where>  
38 - </sql>  
39 - <sql id="Update_By_Example_Where_Clause">  
40 - <where>  
41 - <foreach collection="example.oredCriteria" item="criteria" separator="or">  
42 - <if test="criteria.valid">  
43 - <trim prefix="(" prefixOverrides="and" suffix=")">  
44 - <foreach collection="criteria.criteria" item="criterion">  
45 - <choose>  
46 - <when test="criterion.noValue">  
47 - and ${criterion.condition}  
48 - </when>  
49 - <when test="criterion.singleValue">  
50 - and ${criterion.condition} #{criterion.value}  
51 - </when>  
52 - <when test="criterion.betweenValue">  
53 - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}  
54 - </when>  
55 - <when test="criterion.listValue">  
56 - and ${criterion.condition}  
57 - <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">  
58 - #{listItem}  
59 - </foreach>  
60 - </when>  
61 - </choose>  
62 - </foreach>  
63 - </trim>  
64 - </if>  
65 - </foreach>  
66 - </where>  
67 - </sql>  
68 - <sql id="Base_Column_List">  
69 - id, parent_id, op_id, data_state  
70 - </sql>  
71 - <select id="selectByExample" parameterType="com.zteits.oa.report.domain.AsraOpRelationsExample" resultMap="BaseResultMap">  
72 - select  
73 - <if test="distinct">  
74 - distinct  
75 - </if>  
76 - <include refid="Base_Column_List" />  
77 - from asra_op_relations  
78 - <if test="_parameter != null">  
79 - <include refid="Example_Where_Clause" />  
80 - </if>  
81 - <if test="orderByClause != null">  
82 - order by ${orderByClause}  
83 - </if>  
84 - </select>  
85 - <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">  
86 - select  
87 - <include refid="Base_Column_List" />  
88 - from asra_op_relations  
89 - where id = #{id,jdbcType=BIGINT}  
90 - </select>  
91 - <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">  
92 - delete from asra_op_relations  
93 - where id = #{id,jdbcType=BIGINT}  
94 - </delete>  
95 - <delete id="deleteByExample" parameterType="com.zteits.oa.report.domain.AsraOpRelationsExample">  
96 - delete from asra_op_relations  
97 - <if test="_parameter != null">  
98 - <include refid="Example_Where_Clause" />  
99 - </if>  
100 - </delete>  
101 - <insert id="insert" parameterType="com.zteits.oa.report.domain.AsraOpRelations">  
102 - <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">  
103 - SELECT LAST_INSERT_ID()  
104 - </selectKey>  
105 - insert into asra_op_relations (parent_id, op_id, data_state  
106 - )  
107 - values (#{parentId,jdbcType=BIGINT}, #{opId,jdbcType=BIGINT}, #{dataState,jdbcType=INTEGER}  
108 - )  
109 - </insert>  
110 - <insert id="insertSelective" parameterType="com.zteits.oa.report.domain.AsraOpRelations">  
111 - <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">  
112 - SELECT LAST_INSERT_ID()  
113 - </selectKey>  
114 - insert into asra_op_relations  
115 - <trim prefix="(" suffix=")" suffixOverrides=",">  
116 - <if test="parentId != null">  
117 - parent_id,  
118 - </if>  
119 - <if test="opId != null">  
120 - op_id,  
121 - </if>  
122 - <if test="dataState != null">  
123 - data_state,  
124 - </if>  
125 - </trim>  
126 - <trim prefix="values (" suffix=")" suffixOverrides=",">  
127 - <if test="parentId != null">  
128 - #{parentId,jdbcType=BIGINT},  
129 - </if>  
130 - <if test="opId != null">  
131 - #{opId,jdbcType=BIGINT},  
132 - </if>  
133 - <if test="dataState != null">  
134 - #{dataState,jdbcType=INTEGER},  
135 - </if>  
136 - </trim>  
137 - </insert>  
138 - <select id="countByExample" parameterType="com.zteits.oa.report.domain.AsraOpRelationsExample" resultType="java.lang.Long">  
139 - select count(*) from asra_op_relations  
140 - <if test="_parameter != null">  
141 - <include refid="Example_Where_Clause" />  
142 - </if>  
143 - </select>  
144 - <update id="updateByExampleSelective" parameterType="map">  
145 - update asra_op_relations  
146 - <set>  
147 - <if test="record.id != null">  
148 - id = #{record.id,jdbcType=BIGINT},  
149 - </if>  
150 - <if test="record.parentId != null">  
151 - parent_id = #{record.parentId,jdbcType=BIGINT},  
152 - </if>  
153 - <if test="record.opId != null">  
154 - op_id = #{record.opId,jdbcType=BIGINT},  
155 - </if>  
156 - <if test="record.dataState != null">  
157 - data_state = #{record.dataState,jdbcType=INTEGER},  
158 - </if>  
159 - </set>  
160 - <if test="_parameter != null">  
161 - <include refid="Update_By_Example_Where_Clause" />  
162 - </if>  
163 - </update>  
164 - <update id="updateByExample" parameterType="map">  
165 - update asra_op_relations  
166 - set id = #{record.id,jdbcType=BIGINT},  
167 - parent_id = #{record.parentId,jdbcType=BIGINT},  
168 - op_id = #{record.opId,jdbcType=BIGINT},  
169 - data_state = #{record.dataState,jdbcType=INTEGER}  
170 - <if test="_parameter != null">  
171 - <include refid="Update_By_Example_Where_Clause" />  
172 - </if>  
173 - </update>  
174 - <update id="updateByPrimaryKeySelective" parameterType="com.zteits.oa.report.domain.AsraOpRelations">  
175 - update asra_op_relations  
176 - <set>  
177 - <if test="parentId != null">  
178 - parent_id = #{parentId,jdbcType=BIGINT},  
179 - </if>  
180 - <if test="opId != null">  
181 - op_id = #{opId,jdbcType=BIGINT},  
182 - </if>  
183 - <if test="dataState != null">  
184 - data_state = #{dataState,jdbcType=INTEGER},  
185 - </if>  
186 - </set>  
187 - where id = #{id,jdbcType=BIGINT}  
188 - </update>  
189 - <update id="updateByPrimaryKey" parameterType="com.zteits.oa.report.domain.AsraOpRelations">  
190 - update asra_op_relations  
191 - set parent_id = #{parentId,jdbcType=BIGINT},  
192 - op_id = #{opId,jdbcType=BIGINT},  
193 - data_state = #{dataState,jdbcType=INTEGER}  
194 - where id = #{id,jdbcType=BIGINT}  
195 - </update>  
196 -</mapper>  
197 \ No newline at end of file 0 \ No newline at end of file