Merge branch 'main' of http://10.10.14.176:3000/huanghai/QingLong
commit
9c79f08581
@ -1,128 +0,0 @@
|
|||||||
package com.dsideal.QingLong.Hk.Bean;
|
|
||||||
|
|
||||||
import com.jfinal.plugin.activerecord.Record;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class HkSubjectBean {
|
|
||||||
public static HkSubjectBean convertListForTreeTable(List<Record> list) {
|
|
||||||
// 创建根节点
|
|
||||||
HkSubjectBean rootNode = new HkSubjectBean();
|
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
|
||||||
Record record = list.get(i);
|
|
||||||
// 上级节点
|
|
||||||
int parent_id = record.getInt("parent_id");
|
|
||||||
|
|
||||||
// 添加数据
|
|
||||||
int id = record.getInt("id");
|
|
||||||
String name = record.getStr("name");
|
|
||||||
String group_name = record.getStr("group_name");
|
|
||||||
String group_code = record.getStr("group_code");
|
|
||||||
String subject_code = record.getStr("subject_code");
|
|
||||||
// 创建要添加的新节点
|
|
||||||
HkSubjectBean newNode = new HkSubjectBean(id, name, parent_id, group_name, group_code, subject_code);
|
|
||||||
if (parent_id == -1) rootNode.addChild(newNode);
|
|
||||||
else {
|
|
||||||
// 添加新节点
|
|
||||||
HkSubjectBean node = rootNode.findNode(parent_id);
|
|
||||||
if (node != null) {
|
|
||||||
node.addChild(newNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rootNode;
|
|
||||||
}
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getParent_id() {
|
|
||||||
return parent_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParent_id(int parent_id) {
|
|
||||||
this.parent_id = parent_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGroup_name() {
|
|
||||||
return group_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGroup_name(String group_name) {
|
|
||||||
this.group_name = group_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGroup_code() {
|
|
||||||
return group_code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGroup_code(String group_code) {
|
|
||||||
this.group_code = group_code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addChild(HkSubjectBean child) {
|
|
||||||
this.children.add(child);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<HkSubjectBean> getChildren() {
|
|
||||||
return children;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HkSubjectBean(int id, String name, int parent_id, String group_name, String group_code, String subject_code) {
|
|
||||||
this.id = id;
|
|
||||||
this.name = name;
|
|
||||||
this.parent_id = parent_id;
|
|
||||||
this.group_name = group_name;
|
|
||||||
this.group_code = group_code;
|
|
||||||
this.subject_code = subject_code;
|
|
||||||
this.children = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public HkSubjectBean() {
|
|
||||||
this.children = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<HkSubjectBean> children;
|
|
||||||
int id;
|
|
||||||
String name;
|
|
||||||
int parent_id;
|
|
||||||
String group_name;
|
|
||||||
String group_code;
|
|
||||||
|
|
||||||
public String getSubject_code() {
|
|
||||||
return subject_code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubject_code(String subject_code) {
|
|
||||||
this.subject_code = subject_code;
|
|
||||||
}
|
|
||||||
|
|
||||||
String subject_code;
|
|
||||||
|
|
||||||
public HkSubjectBean findNode(int targetId) {
|
|
||||||
if (this.id == targetId) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
for (HkSubjectBean child : this.children) {
|
|
||||||
HkSubjectBean result = child.findNode(targetId);
|
|
||||||
if (result != null) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.dsideal.QingLong.Hk.Controller;
|
|
||||||
|
|
||||||
import com.jfinal.aop.Before;
|
|
||||||
import com.jfinal.core.Controller;
|
|
||||||
import com.jfinal.ext.interceptor.GET;
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
|
|
||||||
public class HkAdminController extends Controller {
|
|
||||||
|
|
||||||
private static final Logger log = Logger.getLogger(HkAdminController.class);
|
|
||||||
@Before({GET.class})
|
|
||||||
public void index() {
|
|
||||||
redirect("/view/hk/admin.html");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
package com.dsideal.QingLong.Hk.Model;
|
|
||||||
|
|
||||||
public class RefreshHkWorker extends Thread{
|
|
||||||
//线程一直执行
|
|
||||||
public void run() {
|
|
||||||
RefreshHk myclient=new RefreshHk();
|
|
||||||
myclient.run();
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue