Commit 73c50923 authored by hanbing's avatar hanbing

获取厂商简称逻辑修改

parent b6203261
...@@ -7,19 +7,10 @@ public class BasicEnum { ...@@ -7,19 +7,10 @@ public class BasicEnum {
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum ManufacturerEnum { public enum ManufacturerEnum {
HK(1, "海康", "HK"); HK("海康", "HK");
private Integer id;
private String nick; private String nick;
private String code; private String code;
public static String getNickById(Integer id) {
for (ManufacturerEnum value : values()) {
if (value.getId().equals(id)) {
return value.getNick();
}
}
return null;
}
} }
} }
...@@ -26,4 +26,6 @@ public interface ManufacturerInfoMapper { ...@@ -26,4 +26,6 @@ public interface ManufacturerInfoMapper {
void deleteBatch(@Param("ids") List<Integer> ids); void deleteBatch(@Param("ids") List<Integer> ids);
Integer selectIdByNick(@Param("manufacturerNick") String manufacturerNick); Integer selectIdByNick(@Param("manufacturerNick") String manufacturerNick);
String selectNickById(@Param("manufacturerId") Integer manufacturerId);
} }
...@@ -62,8 +62,9 @@ public class ManufacturerApiInfoServiceImpl implements ManufacturerApiInfoServic ...@@ -62,8 +62,9 @@ public class ManufacturerApiInfoServiceImpl implements ManufacturerApiInfoServic
Integer type = manufacturerApiInfoPO.getType(); Integer type = manufacturerApiInfoPO.getType();
String apiType = ManufacturerApiInfoTypeEnum.getMsgByCode(type); String apiType = ManufacturerApiInfoTypeEnum.getMsgByCode(type);
manufacturerApiInfoOutVO.setApiType(apiType); manufacturerApiInfoOutVO.setApiType(apiType);
// 转换厂商简称
Integer manufacturerId1 = manufacturerApiInfoPO.getManufacturerId(); Integer manufacturerId1 = manufacturerApiInfoPO.getManufacturerId();
String manufacturerNick1 = BasicEnum.ManufacturerEnum.getNickById(manufacturerId1); String manufacturerNick1 = manufacturerInfoMapper.selectNickById(manufacturerId1);
manufacturerApiInfoOutVO.setManufacturerNick(manufacturerNick1); manufacturerApiInfoOutVO.setManufacturerNick(manufacturerNick1);
manufacturerApiInfoOutVOPageInfo.getList().add(manufacturerApiInfoOutVO); manufacturerApiInfoOutVOPageInfo.getList().add(manufacturerApiInfoOutVO);
} }
......
...@@ -81,4 +81,9 @@ ...@@ -81,4 +81,9 @@
select id from t_manufacturer_info select id from t_manufacturer_info
where nick_name = #{manufacturerNick} where nick_name = #{manufacturerNick}
</select> </select>
<select id="selectNickById" resultType="java.lang.String">
select nick_name from t_manufacturer_info
where id = #{manufacturerId}
</select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment