package com.matrix.system.dataMove;
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.matrix.system.shopXcx.bean.ShopProductAttribute;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.stereotype.Service;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* @author wzy
|
* @date 2021-08-11
|
**/
|
@Service
|
public class SjfDataMoveServiceImpl {
|
|
@Autowired
|
private JdbcTemplate jdbcTemplate;
|
|
|
public <T> List<T> mapsToListBean(List<Map<String, Object>> maps, Class<T> t) {
|
List<T> list = new ArrayList<>();
|
for (Map<String, Object> map : maps) {
|
String s = JSONObject.toJSONString(map);
|
T object = JSONObject.parseObject(s, t);
|
list.add(object);
|
}
|
return list;
|
}
|
|
public <T> T mapToBane(Map<String, Object> map, Class<T> t) {
|
String s = JSONObject.toJSONString(map);
|
return JSONObject.parseObject(s, t);
|
}
|
|
@DS("slave")
|
public List<ShopProductAttribute> oldProductAttr() {
|
return null;
|
}
|
|
}
|