|
|
@@ -2,9 +2,9 @@ package com.uas.erp.schedular.database;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
+import com.uas.erp.schedular.b2b.domain.IdObject;
|
|
|
import com.uas.erp.schedular.service.SettingService;
|
|
|
import com.uas.erp.schedular.util.BeanUtil;
|
|
|
-import com.uas.erp.schedular.util.CollectionUtil;
|
|
|
import com.uas.erp.schedular.web.ResultListWrap;
|
|
|
import com.uas.erp.schedular.web.ResultWrap;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -277,4 +277,16 @@ public class RestJdbcTemplate {
|
|
|
return null == code ? null : code.toString();
|
|
|
}
|
|
|
|
|
|
+ public <T> List<Long> queryIdList(String sql, Class<T> elementType) {
|
|
|
+ HttpEntity request = new HttpEntity<Executable>(Executable.query(sql, BeanUtil.getProperties(elementType), null));
|
|
|
+ String resultStr = restTemplate.postForObject(getUrl() + "/v1/exec", request, String.class);
|
|
|
+ ResultListWrap<IdObject> result = JSON.parseObject(resultStr, new TypeReference<ResultListWrap<IdObject>>(elementType){});
|
|
|
+ List<Long> list = new ArrayList<>();
|
|
|
+ if (!CollectionUtils.isEmpty(result.getContent())) {
|
|
|
+ for (IdObject object : result.getContent()) {
|
|
|
+ list.add(object.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
}
|