Browse Source

新增获取可投资列表

anderx 3 years ago
parent
commit
0b52856056

+ 16 - 0
src/main/java/com/goafanti/ambSystem/controller/AmbInvestApiController.java

@@ -112,4 +112,20 @@ public class AmbInvestApiController extends CertifyApiController {
 		return res;
 	}
 
+
+	/**
+	 * 获取可投资列表
+	 * @return
+	 */
+	@RequestMapping(value="/getInvestAmbList",method = RequestMethod.GET)
+	public Result getInvestAmbList(Long id){
+		Result res =new Result();
+		if (id==null){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"当前阿米巴","当前阿米巴"));
+			return res;
+		}
+		res.data(ambInvestService.getInvestAmbList(id));
+		return res;
+	}
+
 }

+ 3 - 0
src/main/java/com/goafanti/ambSystem/service/AmbInvestService.java

@@ -3,6 +3,7 @@ package com.goafanti.ambSystem.service;
 import com.goafanti.ambSystem.bo.InputAmbInvest;
 import com.goafanti.ambSystem.bo.InputInvestList;
 import com.goafanti.ambSystem.bo.OutInvestLog;
+import com.goafanti.common.model.AmbSystem;
 import com.goafanti.core.mybatis.page.Pagination;
 
 import java.util.List;
@@ -19,4 +20,6 @@ public interface AmbInvestService {
     int updateInvestTransfer(InputAmbInvest in);
 
     int updateExamineTransfer(InputAmbInvest in);
+
+    List<AmbSystem> getInvestAmbList(Long id);
 }

+ 8 - 0
src/main/java/com/goafanti/ambSystem/service/Impl/AmbInvestServiceImpl.java

@@ -154,6 +154,8 @@ public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implem
         return 1;
     }
 
+
+
     private void addAmbInvestLog(InputAmbInvest in, AmbInvest ambInvest) {
         AmbInvestLog log = new AmbInvestLog();
         log.setAmbInvestId(ambInvest.getId());
@@ -162,4 +164,10 @@ public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implem
         log.setStatus(in.getStatus());
         ambInvestLogMapper.insertSelective(log);
     }
+
+    @Override
+    public List<AmbSystem> getInvestAmbList(Long id) {
+        AmbSystem ambSystem = ambSystemMapper.selectByPrimaryKey(id);
+        return ambSystemMapper.selectBySuperId(ambSystem);
+    }
 }

+ 1 - 0
src/main/java/com/goafanti/common/dao/AmbSystemMapper.java

@@ -32,4 +32,5 @@ public interface AmbSystemMapper {
     int updateAncestorsNames(@Param(value = "id") Long id, @Param(value = "name")String name, @Param(value = "useName")String useName);
 
 
+    List<AmbSystem> selectBySuperId(AmbSystem ambSystem);
 }

+ 7 - 0
src/main/java/com/goafanti/common/mapper/AmbSystemMapper.xml

@@ -367,4 +367,11 @@
     left join admin d on a.accountant =d.id
     where a.id= #{id}
   </select>
+    <select id="selectBySuperId" parameterType="com.goafanti.common.model.AmbSystem" resultMap="BaseResultMap">
+  select
+  <include refid="Base_Column_List" />
+  from amb_system
+  where  lvl= #{lvl}+1
+and find_in_set(#{id},ancestors)
+</select>
 </mapper>