Commit 8f9e7177 authored by zhangyingbin's avatar zhangyingbin

技术参数service

parent d1d51f3b
package com.yeejoin.amos.api.openapi.face.service;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.openapi.enums.EquipTypeEnum;
import com.yeejoin.amos.api.openapi.face.orm.dao.EquipTechParamBoilerMapper;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List;
@Service
public class TechInfoService {
@Autowired
EquipTechParamBoilerMapper equipTechParamBoilerMapper;
public String saveTechInfo(List<JSONObject> techInfoList){
for (JSONObject techInfo: techInfoList) {
String type = techInfo.getString("type");
String entityClasspath = EquipTypeEnum.classPathmap.get(type);
String serviceClaseePath = EquipTypeEnum.servicePathmap.get(type);
try {
Class entityClazz = Class.forName(entityClasspath);
Class mapperClazz = Class.forName(serviceClaseePath);
BaseService service = (BaseService) mapperClazz.newInstance();
service.save(JSON.parseObject(JSON.toJSONString(techInfo),entityClazz));
} catch (Exception e) {
e.printStackTrace();
}
}
return "ok";
}
}
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