|
|
@@ -144,7 +144,7 @@ public class JdbcServiceImpl<T> implements JdbcService{
|
|
|
* @return
|
|
|
*/
|
|
|
private List<T> queryVProducts(String sql) {
|
|
|
- return (List<T>) jdbcTemplate.query(sql, new V_Products());
|
|
|
+ return jdbcTemplate.query(sql, new V_Products());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -153,6 +153,53 @@ public class JdbcServiceImpl<T> implements JdbcService{
|
|
|
* @return
|
|
|
*/
|
|
|
private List<T> queryGoods(String sql) {
|
|
|
- return jdbcTemplate.query(sql, new TradeGoods());
|
|
|
+ List<Goods> goodsList = new ArrayList<>();
|
|
|
+ List<TradeGoods> tradeGoodses = jdbcTemplate.query(sql, new TradeGoods());
|
|
|
+ String componentSql = "select * from product$component where cmp_uuid = ";
|
|
|
+ String kindSql = "select * from product$kind where ki_id = ";
|
|
|
+ String brandSql = "select * from product$brand where br_id = ";
|
|
|
+ String productsql = "select * from products where pr_id = ";
|
|
|
+ String storeSql = "select * from store$info where st_uuid = ";
|
|
|
+ for (TradeGoods tradeGoods : tradeGoodses) {
|
|
|
+ Component component = null;
|
|
|
+ if (tradeGoods.getCmpUuid() != null){
|
|
|
+ List<Component> components = jdbcTemplate.query(componentSql + tradeGoods.getCmpUuid(), new Component());
|
|
|
+ if (!CollectionUtils.isEmpty(components)) {
|
|
|
+ component = components.get(0);
|
|
|
+
|
|
|
+ if (component.getKindId() != null) {
|
|
|
+ List<Kind> kinds = jdbcTemplate.query(kindSql + component.getKindId(), new Kind());
|
|
|
+ if (!CollectionUtils.isEmpty(kinds)) {
|
|
|
+ component.setKind(kinds.get(0));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (component.getBrandId() != null) {
|
|
|
+ List<Brand> brands = jdbcTemplate.query(brandSql + component.getBrandId(), new Brand());
|
|
|
+ if (!CollectionUtils.isEmpty(brands)) {
|
|
|
+ component.setBrand(brands.get(0));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Store store = null;
|
|
|
+ if (tradeGoods.getStoreId() != null) {
|
|
|
+ List<Store> stores = jdbcTemplate.query(storeSql + tradeGoods.getStoreId(), new Store());
|
|
|
+ if (!CollectionUtils.isEmpty(stores)) {
|
|
|
+ store = stores.get(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Products products = null;
|
|
|
+ if (tradeGoods.getProductId() != null) {
|
|
|
+ List<Products> productsList = jdbcTemplate.query(productsql + tradeGoods.getProductId(), new Products());
|
|
|
+ if (!CollectionUtils.isEmpty(productsList)) {
|
|
|
+ products = productsList.get(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ goodsList.add(new Goods(tradeGoods, store, component, products));
|
|
|
+ }
|
|
|
+ return null;
|
|
|
}
|
|
|
}
|