【8.1.8】更新一些测试数据的填充

dev-8.1.9
fengshuonan 2024-06-05 17:09:06 +08:00
parent e4080a4235
commit 77916522aa
3 changed files with 208 additions and 0 deletions

View File

@ -0,0 +1,58 @@
package cn.stylefeng.roses.kernel.sys.modular.data.controller;
import cn.stylefeng.roses.kernel.rule.pojo.dict.SimpleTreeDict;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.sys.modular.data.factory.DemoDataCreateFactory;
import cn.stylefeng.roses.kernel.sys.modular.data.pojo.UserRequest;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* Demo
*
* @author fengshuonan
* @since 2024/6/5 16:52
*/
@RestController
@ApiResource(name = "Demo控制器填充测试数据")
public class DemoTreeDataController {
/**
*
*
* @author fengshuonan
* @since 2024/6/5 16:53
*/
@GetResource(name = "生成一些随机的数据,组织机构信息", path = "/my/org/selectList")
public ResponseData<List<SimpleTreeDict>> orgSelectList(BaseRequest baseRequest) {
return new SuccessResponseData<>(DemoDataCreateFactory.createOrgData());
}
/**
*
*
* @author fengshuonan
* @since 2024/6/5 17:04
*/
@GetResource(name = "生成一些随机的数据,组织机构信息(树形下拉)", path = "/my/org/treeSelectList")
public ResponseData<List<SimpleTreeDict>> treeSelectList(BaseRequest baseRequest) {
return new SuccessResponseData<>(DemoDataCreateFactory.createOrgData());
}
/**
*
*
* @author fengshuonan
* @since 2024/6/5 17:04
*/
@GetResource(name = "生成一些用户信息", path = "/my/user/selectList")
public ResponseData<List<SimpleTreeDict>> userSelectList(UserRequest userRequest) {
return new SuccessResponseData<>(DemoDataCreateFactory.createUserData());
}
}

View File

@ -0,0 +1,125 @@
package cn.stylefeng.roses.kernel.sys.modular.data.factory;
import cn.stylefeng.roses.kernel.rule.pojo.dict.SimpleTreeDict;
import java.util.ArrayList;
import java.util.List;
/**
*
*
* @author fengshuonan
* @since 2024/6/5 17:00
*/
public class DemoDataCreateFactory {
/**
*
*
* @author fengshuonan
* @since 2024/6/5 17:01
*/
public static List<SimpleTreeDict> createOrgData() {
List<SimpleTreeDict> orgList = new ArrayList<>();
// 创建几个顶级组织机构
SimpleTreeDict bj = new SimpleTreeDict();
bj.setId("1798280342488690689");
bj.setName("北京总部");
bj.setCode("bj");
bj.setParentId("-1");
orgList.add(bj);
SimpleTreeDict sh = new SimpleTreeDict();
sh.setId("1798280342488690696");
sh.setName("上海分公司");
sh.setCode("sh");
sh.setParentId("-1");
orgList.add(sh);
SimpleTreeDict gz = new SimpleTreeDict();
gz.setId("1798280342488690704");
gz.setName("广州分公司");
gz.setCode("gz");
gz.setParentId("-1");
orgList.add(gz);
// 公司下建立几个部门
SimpleTreeDict bj1 = new SimpleTreeDict();
bj1.setId("1798280342488690711");
bj1.setName("北京总部1部门");
bj1.setCode("bj1");
bj1.setParentId(bj.getId());
orgList.add(bj1);
SimpleTreeDict bj2 = new SimpleTreeDict();
bj2.setId("1798280342488690720");
bj2.setName("北京总部2部门");
bj2.setCode("bj2");
bj2.setParentId(bj.getId());
orgList.add(bj2);
SimpleTreeDict sh1 = new SimpleTreeDict();
sh1.setId("1798280342488690731");
sh1.setName("上海分公司1部门");
sh1.setCode("sh1");
sh1.setParentId(sh.getId());
orgList.add(sh1);
SimpleTreeDict sh2 = new SimpleTreeDict();
sh2.setId("1798280342488690742");
sh2.setName("上海分公司2部门");
sh2.setCode("sh2");
sh2.setParentId(sh.getId());
orgList.add(sh2);
SimpleTreeDict gz1 = new SimpleTreeDict();
gz1.setId("1798280342488690756");
gz1.setName("广州分公司1部门");
gz1.setCode("gz1");
gz1.setParentId(gz.getId());
orgList.add(gz1);
SimpleTreeDict gz2 = new SimpleTreeDict();
gz2.setId("1798280342488690769");
gz2.setName("广州分公司2部门");
gz2.setCode("gz2");
gz2.setParentId(gz.getId());
orgList.add(gz2);
return orgList;
}
/**
*
*
* @author fengshuonan
* @since 2024/6/5 17:05
*/
public static List<SimpleTreeDict> createUserData() {
List<SimpleTreeDict> userList = new ArrayList<>();
// 创建几个用户
SimpleTreeDict user1 = new SimpleTreeDict();
user1.setId("1798280342488690773");
user1.setName("张三");
user1.setCode("zhangsan");
userList.add(user1);
SimpleTreeDict user2 = new SimpleTreeDict();
user2.setId("1798280342488690776");
user2.setName("李四");
user2.setCode("lisi");
userList.add(user2);
SimpleTreeDict user3 = new SimpleTreeDict();
user3.setId("1798280342488690781");
user3.setName("王五");
user3.setCode("wangwu");
userList.add(user3);
return userList;
}
}

View File

@ -0,0 +1,25 @@
package cn.stylefeng.roses.kernel.sys.modular.data.pojo;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import lombok.Data;
/**
*
*
* @author fengshuonan
* @since 2024-01-29 14:36
*/
@Data
public class UserRequest extends BaseRequest {
/**
* id
*/
private Long org_id;
/**
* id
*/
private Long dept_id;
}