Commit 5e8d9026b50aa2bc73f21dcbdaba46ba9343611e
1 parent
e72092a3
提交
Showing
14 changed files
with
208 additions
and
338 deletions
src/main/java/com/zteits/oa/api/dto/asradaily/AsraProjectAndPersonNumDTO.java
| ... | ... | @@ -45,6 +45,37 @@ public class AsraProjectAndPersonNumDTO extends BaiscDTO{ |
| 45 | 45 | public void setCommitPersonNum(Integer commitPersonNum) { |
| 46 | 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 | 79 | @Override |
| 49 | 80 | public String toString() { |
| 50 | 81 | return "AsraProjectAndPersonNumDTO [projectId=" + projectId + ", projectName=" + projectName | ... | ... |
src/main/java/com/zteits/oa/api/dto/asraop/AsraOpDTO.java
| 1 | 1 | package com.zteits.oa.api.dto.asraop; |
| 2 | 2 | |
| 3 | 3 | import java.util.Date; |
| 4 | +import java.util.List; | |
| 4 | 5 | |
| 5 | 6 | import com.zteits.oa.api.base.bean.BaiscDTO; |
| 6 | 7 | /** |
| ... | ... | @@ -77,8 +78,20 @@ public class AsraOpDTO extends BaiscDTO{ |
| 77 | 78 | |
| 78 | 79 | /**描述*/ |
| 79 | 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 | 95 | public Long getId() { |
| 83 | 96 | return id; |
| 84 | 97 | } | ... | ... |
src/main/java/com/zteits/oa/api/dto/asraop/LoginOathRes.java
| 1 | 1 | package com.zteits.oa.api.dto.asraop; |
| 2 | 2 | |
| 3 | 3 | import java.io.Serializable; |
| 4 | +import java.util.List; | |
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * 登陆授权response.<br/> |
| ... | ... | @@ -52,6 +53,18 @@ public class LoginOathRes implements Serializable { |
| 52 | 53 | private Long cityId; |
| 53 | 54 | /** 地市名称 */ |
| 54 | 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 | 68 | public String getAccessToken() { |
| 56 | 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 | 5 | import com.zteits.oa.api.dto.asraoprelations.AsraOpRelationsDTO; |
| 6 | 6 | import com.zteits.oa.api.dto.asraoprelations.param.AsraOpRelationsQueryReq; |
| 7 | 7 | import com.zteits.oa.api.service.report.query.AsraOpRelationsQueryService; |
| 8 | -import com.zteits.oa.report.dao.AsraOpRelationsDao; | |
| 9 | 8 | import com.zteits.oa.report.domain.AsraOpRelations; |
| 10 | 9 | import org.springframework.beans.BeanUtils; |
| 11 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -29,14 +28,14 @@ import java.util.List; |
| 29 | 28 | @Service |
| 30 | 29 | public class AsraOpRelationsQueryServiceImpl implements AsraOpRelationsQueryService { |
| 31 | 30 | |
| 32 | - @Autowired | |
| 33 | - private AsraOpRelationsDao asraOpRelationsDao; | |
| 31 | + //@Autowired | |
| 32 | + //private AsraOpRelationsDao asraOpRelationsDao; | |
| 34 | 33 | |
| 35 | 34 | @Override |
| 36 | 35 | public BizResult<List<AsraOpRelationsDTO>> queryAsraOpRelations(AsraOpRelationsQueryReq asraOpRelationsQueryReq) { |
| 37 | 36 | |
| 38 | 37 | List<AsraOpRelationsDTO> asraOpRelationsDTOs = new ArrayList<>(); |
| 39 | - List<AsraOpRelations> asraOpRelationsList = asraOpRelationsDao.queryAsraOpRelations(asraOpRelationsQueryReq.getParentId()); | |
| 38 | + List<AsraOpRelations> asraOpRelationsList = null;//asraOpRelationsDao.queryAsraOpRelations(asraOpRelationsQueryReq.getParentId()); | |
| 40 | 39 | if(CollectionUtil.isNotEmpty(asraOpRelationsList)) { |
| 41 | 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 | 19 | import com.zteits.oa.report.domain.sdo.AsraDailyDO; |
| 20 | 20 | import com.zteits.oa.report.domain.sdo.AsraDailyOpNumForCurrentDayDO; |
| 21 | 21 | import com.zteits.oa.report.mapper.AsraDailyMapper; |
| 22 | -import com.zteits.oa.report.mapper.AsraOpRelationsMapper; | |
| 23 | 22 | import com.zteits.oa.report.mapper.smapper.AsraDailySmapper; |
| 24 | 23 | |
| 25 | 24 | /** |
| ... | ... | @@ -39,8 +38,7 @@ public class AsraDailyDaoImpl implements AsraDailyDao{ |
| 39 | 38 | |
| 40 | 39 | @Autowired |
| 41 | 40 | private AsraDailyMapper asraDailyMapper; |
| 42 | - @Autowired | |
| 43 | - private AsraOpRelationsMapper asraOpRelationsMapper; | |
| 41 | + | |
| 44 | 42 | @Autowired |
| 45 | 43 | private AsraDailySmapper asraDailySmapper; |
| 46 | 44 | |
| ... | ... | @@ -73,21 +71,22 @@ public class AsraDailyDaoImpl implements AsraDailyDao{ |
| 73 | 71 | public AsraDailyOpNumForCurrentDayDO queryAsraDailyOpNumForCurrentDay(AsraDailyForTotalNumAndDetailReq request) { |
| 74 | 72 | AsraDailyOpNumForCurrentDayDO asraDailyOpNumForCurrentDayDO = new AsraDailyOpNumForCurrentDayDO(); |
| 75 | 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 | 90 | opList.add(request.getOpId());//查询自己id |
| 92 | 91 | //2.查询今日日报填写人数 |
| 93 | 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 | 54 | /**描述*/ |
| 55 | 55 | private String remark; |
| 56 | 56 | |
| 57 | + /**父级ID 顶级为-1*/ | |
| 58 | + private Long parentId; | |
| 59 | + | |
| 57 | 60 | /**获取主键*/ |
| 58 | 61 | public Long getId() { |
| 59 | 62 | return id; |
| ... | ... | @@ -223,4 +226,14 @@ public class AsraOp { |
| 223 | 226 | public void setRemark(String remark) { |
| 224 | 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 | 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 | 1224 | addCriterion("remark not between", value1, value2, "remark"); |
| 1225 | 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 | 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 | 0 | \ No newline at end of file |
src/main/java/com/zteits/oa/report/web/OAuthController.java
| 1 | 1 | package com.zteits.oa.report.web; |
| 2 | 2 | |
| 3 | +import java.util.ArrayList; | |
| 4 | +import java.util.List; | |
| 5 | + | |
| 3 | 6 | import javax.servlet.http.HttpServletRequest; |
| 4 | 7 | import javax.servlet.http.HttpSession; |
| 5 | 8 | |
| 6 | -import com.zteits.oa.api.service.report.query.AsraOpQueryService; | |
| 7 | 9 | import org.slf4j.Logger; |
| 8 | 10 | import org.slf4j.LoggerFactory; |
| 9 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -13,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestBody; |
| 13 | 15 | import org.springframework.web.bind.annotation.RequestMapping; |
| 14 | 16 | import org.springframework.web.bind.annotation.RestController; |
| 15 | 17 | |
| 18 | +import com.alibaba.fastjson.JSONObject; | |
| 16 | 19 | import com.zteits.oa.api.base.bean.BizResult; |
| 17 | 20 | import com.zteits.oa.api.base.constants.ErrorType; |
| 18 | 21 | import com.zteits.oa.api.base.constants.SessionEnum; |
| ... | ... | @@ -20,6 +23,7 @@ import com.zteits.oa.api.dto.asraop.AsraOpDTO; |
| 20 | 23 | import com.zteits.oa.api.dto.asraop.LoginOathRes; |
| 21 | 24 | import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq; |
| 22 | 25 | import com.zteits.oa.api.dto.asraop.param.LoginOauthReq; |
| 26 | +import com.zteits.oa.api.service.report.query.AsraOpQueryService; | |
| 23 | 27 | import com.zteits.oa.report.vo.OAuthResult; |
| 24 | 28 | import com.zteits.oa.util.MD5Utils; |
| 25 | 29 | |
| ... | ... | @@ -85,6 +89,13 @@ public class OAuthController { |
| 85 | 89 | |
| 86 | 90 | |
| 87 | 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 | 99 | HttpSession session = request.getSession(); |
| 89 | 100 | session.setAttribute(SessionEnum.USER_INFO.key(), asraOpDTO); |
| 90 | 101 | logger.info("---获取到的session_id={}",session.getId()); |
| ... | ... | @@ -121,6 +132,30 @@ public class OAuthController { |
| 121 | 132 | logger.info("end用户登出.."); |
| 122 | 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 | 38 | <javaClientGenerator type="XMLMAPPER" targetPackage="com.zteits.oa.report.mapper" targetProject="src/main/java"> |
| 39 | 39 | <property name="enableSubPackages" value="true" /> |
| 40 | 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 | 42 | <table tableName="asra_op"> |
| 58 | 43 | <!-- 指定自动生成主键的属性 --> |
| 59 | 44 | <generatedKey column="id" sqlStatement="MySql" identity="true"></generatedKey> | ... | ... |
src/main/resources/mybatis/mapper/AsraOpMapper.xml
| ... | ... | @@ -19,6 +19,7 @@ |
| 19 | 19 | <result column="modfiy_emp_name" jdbcType="VARCHAR" property="modfiyEmpName" /> |
| 20 | 20 | <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" /> |
| 21 | 21 | <result column="remark" jdbcType="VARCHAR" property="remark" /> |
| 22 | + <result column="parent_id" jdbcType="BIGINT" property="parentId" /> | |
| 22 | 23 | </resultMap> |
| 23 | 24 | <sql id="Example_Where_Clause"> |
| 24 | 25 | <where> |
| ... | ... | @@ -81,7 +82,7 @@ |
| 81 | 82 | <sql id="Base_Column_List"> |
| 82 | 83 | id, login_code, login_password, op_name, email, role_id, city_id, city_name, is_remind_email, |
| 83 | 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 | 86 | </sql> |
| 86 | 87 | <select id="selectByExample" parameterType="com.zteits.oa.report.domain.AsraOpExample" resultMap="BaseResultMap"> |
| 87 | 88 | select |
| ... | ... | @@ -122,13 +123,13 @@ |
| 122 | 123 | city_name, is_remind_email, data_state, |
| 123 | 124 | create_empid, create_emp_name, create_date, |
| 124 | 125 | modfiy_empid, modfiy_emp_name, modfiy_date, |
| 125 | - remark) | |
| 126 | + remark, parent_id) | |
| 126 | 127 | values (#{loginCode,jdbcType=VARCHAR}, #{loginPassword,jdbcType=VARCHAR}, #{opName,jdbcType=VARCHAR}, |
| 127 | 128 | #{email,jdbcType=VARCHAR}, #{roleId,jdbcType=BIGINT}, #{cityId,jdbcType=BIGINT}, |
| 128 | 129 | #{cityName,jdbcType=VARCHAR}, #{isRemindEmail,jdbcType=INTEGER}, #{dataState,jdbcType=INTEGER}, |
| 129 | 130 | #{createEmpid,jdbcType=VARCHAR}, #{createEmpName,jdbcType=VARCHAR}, #{createDate,jdbcType=TIMESTAMP}, |
| 130 | 131 | #{modfiyEmpid,jdbcType=VARCHAR}, #{modfiyEmpName,jdbcType=VARCHAR}, #{modfiyDate,jdbcType=TIMESTAMP}, |
| 131 | - #{remark,jdbcType=VARCHAR}) | |
| 132 | + #{remark,jdbcType=VARCHAR}, #{parentId,jdbcType=BIGINT}) | |
| 132 | 133 | </insert> |
| 133 | 134 | <insert id="insertSelective" parameterType="com.zteits.oa.report.domain.AsraOp"> |
| 134 | 135 | <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> |
| ... | ... | @@ -184,6 +185,9 @@ |
| 184 | 185 | <if test="remark != null"> |
| 185 | 186 | remark, |
| 186 | 187 | </if> |
| 188 | + <if test="parentId != null"> | |
| 189 | + parent_id, | |
| 190 | + </if> | |
| 187 | 191 | </trim> |
| 188 | 192 | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| 189 | 193 | <if test="loginCode != null"> |
| ... | ... | @@ -234,6 +238,9 @@ |
| 234 | 238 | <if test="remark != null"> |
| 235 | 239 | #{remark,jdbcType=VARCHAR}, |
| 236 | 240 | </if> |
| 241 | + <if test="parentId != null"> | |
| 242 | + #{parentId,jdbcType=BIGINT}, | |
| 243 | + </if> | |
| 237 | 244 | </trim> |
| 238 | 245 | </insert> |
| 239 | 246 | <select id="countByExample" parameterType="com.zteits.oa.report.domain.AsraOpExample" resultType="java.lang.Long"> |
| ... | ... | @@ -296,6 +303,9 @@ |
| 296 | 303 | <if test="record.remark != null"> |
| 297 | 304 | remark = #{record.remark,jdbcType=VARCHAR}, |
| 298 | 305 | </if> |
| 306 | + <if test="record.parentId != null"> | |
| 307 | + parent_id = #{record.parentId,jdbcType=BIGINT}, | |
| 308 | + </if> | |
| 299 | 309 | </set> |
| 300 | 310 | <if test="_parameter != null"> |
| 301 | 311 | <include refid="Update_By_Example_Where_Clause" /> |
| ... | ... | @@ -319,7 +329,8 @@ |
| 319 | 329 | modfiy_empid = #{record.modfiyEmpid,jdbcType=VARCHAR}, |
| 320 | 330 | modfiy_emp_name = #{record.modfiyEmpName,jdbcType=VARCHAR}, |
| 321 | 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 | 334 | <if test="_parameter != null"> |
| 324 | 335 | <include refid="Update_By_Example_Where_Clause" /> |
| 325 | 336 | </if> |
| ... | ... | @@ -375,6 +386,9 @@ |
| 375 | 386 | <if test="remark != null"> |
| 376 | 387 | remark = #{remark,jdbcType=VARCHAR}, |
| 377 | 388 | </if> |
| 389 | + <if test="parentId != null"> | |
| 390 | + parent_id = #{parentId,jdbcType=BIGINT}, | |
| 391 | + </if> | |
| 378 | 392 | </set> |
| 379 | 393 | where id = #{id,jdbcType=BIGINT} |
| 380 | 394 | </update> |
| ... | ... | @@ -395,7 +409,8 @@ |
| 395 | 409 | modfiy_empid = #{modfiyEmpid,jdbcType=VARCHAR}, |
| 396 | 410 | modfiy_emp_name = #{modfiyEmpName,jdbcType=VARCHAR}, |
| 397 | 411 | modfiy_date = #{modfiyDate,jdbcType=TIMESTAMP}, |
| 398 | - remark = #{remark,jdbcType=VARCHAR} | |
| 412 | + remark = #{remark,jdbcType=VARCHAR}, | |
| 413 | + parent_id = #{parentId,jdbcType=BIGINT} | |
| 399 | 414 | where id = #{id,jdbcType=BIGINT} |
| 400 | 415 | </update> |
| 401 | 416 | </mapper> |
| 402 | 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 | 0 | \ No newline at end of file |