刘力
3 years ago
7 changed files with 230 additions and 5 deletions
-
20archives/src/main/java/com/storeroom/modules/dictionary/controller/MyTestController.java
-
67archives/src/main/java/com/storeroom/modules/dictionary/domain/ArchivesType.java
-
43common/src/main/java/com/storeroom/utils/ListUtils.java
-
2common/src/main/java/com/storeroom/utils/NanoIdUtils.java
-
6system/pom.xml
-
71system/src/main/java/com/storeroom/modules/system/controller/TestController.java
-
26system/src/main/java/com/storeroom/modules/system/domain/vo/CreateTableVo.java
@ -0,0 +1,20 @@ |
|||||
|
package com.storeroom.modules.dictionary.controller; |
||||
|
|
||||
|
|
||||
|
import com.storeroom.annotaion.rest.AnonymousGetMapping; |
||||
|
import com.storeroom.utils.ApiResponse; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/api/test") |
||||
|
public class MyTestController { |
||||
|
|
||||
|
|
||||
|
|
||||
|
@AnonymousGetMapping(value = "/ok") |
||||
|
public ApiResponse<Object> Ok(){ |
||||
|
return ApiResponse.success("请求成功"); |
||||
|
} |
||||
|
} |
@ -0,0 +1,67 @@ |
|||||
|
package com.storeroom.modules.dictionary.domain; |
||||
|
|
||||
|
|
||||
|
import com.storeroom.base.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Getter; |
||||
|
import lombok.Setter; |
||||
|
|
||||
|
import javax.persistence.*; |
||||
|
import javax.validation.constraints.NotNull; |
||||
|
import java.io.Serializable; |
||||
|
import java.util.Objects; |
||||
|
|
||||
|
@Entity |
||||
|
@Getter |
||||
|
@Setter |
||||
|
@Table(name = "archives_type") |
||||
|
public class ArchivesType extends BaseEntity implements Serializable { |
||||
|
|
||||
|
@Id |
||||
|
@Column(name = "id") |
||||
|
@NotNull(groups = Update.class) |
||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY) |
||||
|
@ApiModelProperty(value = "id", hidden = true) |
||||
|
private String id; |
||||
|
|
||||
|
@Column(name = "cn_name") |
||||
|
@ApiModelProperty(value = "门类名称") |
||||
|
private String cnName; |
||||
|
|
||||
|
@Column(name = "en_name") |
||||
|
@ApiModelProperty(value = "表名") |
||||
|
private String enName; |
||||
|
|
||||
|
@Column(name = "pid") |
||||
|
@ApiModelProperty(value = "父类id") |
||||
|
private String pid; |
||||
|
|
||||
|
@Column(name = "is_type") |
||||
|
@ApiModelProperty(value = "门类级别") |
||||
|
private long isType; |
||||
|
|
||||
|
@Column(name = "is_type_metic") |
||||
|
@ApiModelProperty(value = "是否为模板档案") |
||||
|
private long isTypeMetic; |
||||
|
|
||||
|
@Column(name = "category_seq") |
||||
|
@ApiModelProperty(value = "排序") |
||||
|
private long categorySeq; |
||||
|
|
||||
|
@Column(name = "remark") |
||||
|
@ApiModelProperty(value = "备注") |
||||
|
private String remark; |
||||
|
|
||||
|
@Override |
||||
|
public boolean equals(Object o) { |
||||
|
if (this == o) return true; |
||||
|
if (o == null || getClass() != o.getClass()) return false; |
||||
|
ArchivesType that = (ArchivesType) o; |
||||
|
return isType == that.isType && isTypeMetic == that.isTypeMetic && categorySeq == that.categorySeq && Objects.equals(id, that.id) && Objects.equals(cnName, that.cnName) && Objects.equals(enName, that.enName) && Objects.equals(pid, that.pid) && Objects.equals(remark, that.remark); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int hashCode() { |
||||
|
return Objects.hash(id, cnName, enName, pid, isType, isTypeMetic, categorySeq, remark); |
||||
|
} |
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
package com.storeroom.utils; |
||||
|
|
||||
|
import java.lang.reflect.Field; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* List 工具类 |
||||
|
*/ |
||||
|
public class ListUtils { |
||||
|
|
||||
|
public static List<Map<String, Object>> converListMap(List<Object> list) { |
||||
|
List<Map<String, Object>> maps = new ArrayList<Map<String, Object>>(); |
||||
|
|
||||
|
for (Object obj : list) { |
||||
|
Class c = obj.getClass(); |
||||
|
Field[] f = c.getDeclaredFields(); |
||||
|
Map<String, Object> map = new HashMap<String, Object>(); |
||||
|
for (Field fie : f) { |
||||
|
try { |
||||
|
fie.setAccessible(true); |
||||
|
map.put(fie.getName(),fie.get(obj)); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
//获取父类的私有属性 |
||||
|
for(Field fie : c.getSuperclass().getDeclaredFields()){ |
||||
|
try { |
||||
|
fie.setAccessible(true);//取消语言访问检查 |
||||
|
map.put(fie.getName(), fie.get(obj));//获取私有变量值 |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
} |
||||
|
maps.add(map); |
||||
|
} |
||||
|
return maps; |
||||
|
} |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
package com.storeroom.modules.system.domain.vo; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
@Data |
||||
|
public class CreateTableVo implements Serializable { |
||||
|
public CreateTableVo(){ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
private String tableName; |
||||
|
private List<Vo> list; |
||||
|
|
||||
|
@Data |
||||
|
static class Vo{ |
||||
|
//字段名称 |
||||
|
private String fieldName; |
||||
|
//字段类型 |
||||
|
private String fieldType; |
||||
|
//数据长度 |
||||
|
private Integer fieldExtent; |
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue