-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat-DictCategoryController-增加初始化数据字典功能
- Loading branch information
Showing
15 changed files
with
195 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
my-platform/src/main/java/net/ximatai/muyun/platform/model/Dict.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package net.ximatai.muyun.platform.model; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class Dict { | ||
private String categoryID; | ||
private String value; | ||
private String name; | ||
private int order; | ||
|
||
public Dict(String value, String name) { | ||
this.value = value; | ||
this.name = name; | ||
} | ||
|
||
public Dict setOrder(int order) { | ||
this.order = order; | ||
return this; | ||
} | ||
|
||
public Dict setCategoryID(String categoryID) { | ||
this.categoryID = categoryID; | ||
return this; | ||
} | ||
|
||
public Map<String, Object> toMap() { | ||
Map map = new HashMap(); | ||
map.put("id_at_app_dictcategory", categoryID); | ||
map.put("v_value", value); | ||
map.put("v_name", name); | ||
map.put("n_order", order); | ||
return map; | ||
} | ||
|
||
} |
75 changes: 75 additions & 0 deletions
75
my-platform/src/main/java/net/ximatai/muyun/platform/model/DictCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package net.ximatai.muyun.platform.model; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class DictCategory { | ||
private String id; | ||
private String pid; | ||
private String name; | ||
private int order; | ||
private List<Dict> dictList; | ||
|
||
public DictCategory(String id, String name) { | ||
this.id = id; | ||
this.name = name; | ||
} | ||
|
||
public DictCategory(String id, String name, int order) { | ||
this.id = id; | ||
this.name = name; | ||
this.order = order; | ||
} | ||
|
||
public DictCategory(String id, String pid, String name, int order) { | ||
this.id = id; | ||
this.pid = pid; | ||
this.name = name; | ||
this.order = order; | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public String getPid() { | ||
return pid; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public int getOrder() { | ||
return order; | ||
} | ||
|
||
public List<Dict> getDictList() { | ||
return dictList; | ||
} | ||
|
||
public DictCategory setDictList(List<Dict> dictList) { | ||
for (int i = 0; i < dictList.size(); i++) { | ||
Dict dict = dictList.get(i); | ||
dict.setCategoryID(this.id); | ||
dict.setOrder(i); | ||
} | ||
|
||
this.dictList = dictList; | ||
return this; | ||
} | ||
|
||
public Map toMap() { | ||
HashMap<String, Object> map = new HashMap<>(); | ||
map.put("id", this.id); | ||
map.put("pid", this.pid); | ||
map.put("v_name", this.name); | ||
map.put("n_order", this.order); | ||
if (this.dictList != null) { | ||
map.put("app_dict", this.dictList.stream().map(Dict::toMap).toList()); | ||
} | ||
|
||
return map; | ||
} | ||
} |