Authored by FengRuwei

添加查询所有java服务类型的接口

... ... @@ -22,6 +22,8 @@ import java.util.List;
public class TypeInfoCtrl {
public static final Logger DEBUG = LoggerFactory.getLogger(TypeInfoCtrl.class);
public static final String TYPE_JAVA_APP="java_app";
@Autowired
ITypeInfoService typeInfoService;
... ... @@ -72,10 +74,8 @@ public class TypeInfoCtrl {
if (null != allTypeInfo) {
for (TypeInfo info : allTypeInfo)
{
if(1==info.getTypeIsLeaf())
{
for (TypeInfo info : allTypeInfo) {
if (1 == info.getTypeIsLeaf()) {
leafTypeInfo.add(info);
}
}
... ... @@ -249,6 +249,34 @@ public class TypeInfoCtrl {
}
@RequestMapping(value = "/queryJavaApi", method = RequestMethod.GET)
public BaseResponse queryJavaApi() {
DEBUG.debug("Query all java api info...");
List<TypeInfo> allTypeInfo = null;
BaseResponse response = new BaseResponse();
try {
TypeInfo typeInfo = typeInfoService.queryTypeInfoByName(TYPE_JAVA_APP);
if (typeInfo != null) {
allTypeInfo = typeInfoService.queryChildTypesInfo(typeInfo.getTypeId());
if (null != allTypeInfo) {
response.setData(allTypeInfo);
}
}
} catch (Exception e) {
DEBUG.error("Failed to query all typeInfo, error: {}", e);
response.setCode(400);
response.setMessage(e.getMessage());
}
return response;
}
@RequestMapping(value = "/queryNode", method = RequestMethod.GET)
public BaseResponse queryNodeTypeInfo() {
... ... @@ -265,10 +293,8 @@ public class TypeInfoCtrl {
if (null != allTypeInfo) {
for (TypeInfo info : allTypeInfo)
{
if(0==info.getTypeIsLeaf())
{
for (TypeInfo info : allTypeInfo) {
if (0 == info.getTypeIsLeaf()) {
leafTypeInfo.add(info);
}
}
... ... @@ -288,5 +314,4 @@ public class TypeInfoCtrl {
}
}
... ...
... ... @@ -21,4 +21,6 @@ public interface ITypeInfoService {
void updateTypeInfo(TypeInfo typeInfo);
TypeInfo queryTypeInfoByName(String typeName);
}
... ...
... ... @@ -71,4 +71,9 @@ public class TypeInfoServiceImpl implements ITypeInfoService {
mTypeInfoMapper.updateTypeInfo(typeInfo);
}
@Override
public TypeInfo queryTypeInfoByName(String typeName) {
return mTypeInfoMapper.selectTypeInfoByName(typeName);
}
}
... ...
... ... @@ -20,5 +20,5 @@ public interface MTypeInfoMapper {
TypeInfo getParentTypeInfo(TypeInfo childInfo);*/
TypeInfo selectTypeInfoByName(String typeName);
}
... ...
... ... @@ -12,8 +12,12 @@
<id property="typeParentId" column="parent_id"></id>
</resultMap>
<sql id="Base_Column_List"> id, alias, isLeaf, parent_id </sql>
<select id="getAllTypesInfo" resultType="com.model.TypeInfo" resultMap="typeInfoMap" useCache="true">
SELECT * FROM type_info ORDER BY id asc
SELECT
<include refid="Base_Column_List"/>
FROM type_info ORDER BY id asc
</select>
<!-- <select id="getChildTypesInfo" parameterType="int" resultType="com.model.TypeInfo" resultMap="typeInfoMap">
... ... @@ -37,4 +41,11 @@
WHERE id=#{typeId}
</update>
<select id="selectTypeInfoByName" resultMap="typeInfoMap" resultType="com.model.TypeInfo">
SELECT
<include refid="Base_Column_List"/>
FROM type_info where alias =#{typeName} limit 1
</select>
</mapper>
\ No newline at end of file
... ...