|
@ -5,6 +5,8 @@ import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
|
|
import com.yihu.jw.entity.hospital.article.KnowledgeCategoryDO;
|
|
import com.yihu.jw.entity.hospital.article.KnowledgeCategoryDO;
|
|
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDao;
|
|
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDao;
|
|
import com.yihu.jw.hospital.dao.consult.KnowledgeCategoryDao;
|
|
import com.yihu.jw.hospital.dao.consult.KnowledgeCategoryDao;
|
|
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@ -14,6 +16,7 @@ import java.io.UnsupportedEncodingException;
|
|
import java.net.URLDecoder;
|
|
import java.net.URLDecoder;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -29,7 +32,8 @@ public class KnowledgeCategoryService extends BaseJpaService<KnowledgeCategoryDO
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ObjectMapper objectMapper;
|
|
private ObjectMapper objectMapper;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private HibenateUtils hibenateUtils;
|
|
public KnowledgeCategoryDO saveCategory(String jsonData) throws Exception {
|
|
public KnowledgeCategoryDO saveCategory(String jsonData) throws Exception {
|
|
jsonData = URLDecoder.decode(jsonData,"utf-8");
|
|
jsonData = URLDecoder.decode(jsonData,"utf-8");
|
|
KnowledgeCategoryDO knowledgeCategoryDO = objectMapper.readValue(jsonData, KnowledgeCategoryDO.class);
|
|
KnowledgeCategoryDO knowledgeCategoryDO = objectMapper.readValue(jsonData, KnowledgeCategoryDO.class);
|
|
@ -58,4 +62,20 @@ public class KnowledgeCategoryService extends BaseJpaService<KnowledgeCategoryDO
|
|
knowledgeCategoryDao.updateDel(code);
|
|
knowledgeCategoryDao.updateDel(code);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public MixEnvelop findAllGroup(){
|
|
|
|
String sqlPid = "select id as \"id\",name as \"name\",pid as \"pid\" from wlyy_knowledge_category where pid = '0' and del = 1";
|
|
|
|
List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sqlPid);
|
|
|
|
String child = "select id as \"id\",name as \"name\",pid as \"pid\" from wlyy_knowledge_category where del = 1";
|
|
|
|
if (list.size()>0){
|
|
|
|
for (Map<String,Object> map:list){
|
|
|
|
String pid = map.get("id").toString();
|
|
|
|
child+=" and pid = '"+pid+"'";
|
|
|
|
List<Map<String,Object>> childList = hibenateUtils.createSQLQuery(child);
|
|
|
|
map.put("childList",childList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MixEnvelop envelop = new MixEnvelop();
|
|
|
|
envelop.setDetailModelList(list);
|
|
|
|
return envelop;
|
|
|
|
}
|
|
}
|
|
}
|