From 3974bdb7f36e3e37e6cdd67e9164e55345c49f34 Mon Sep 17 00:00:00 2001 From: "20932067@zju.edu.cn" Date: Wed, 27 Jan 2021 15:38:00 +0800 Subject: [PATCH] 11 --- .../framework/config/SecurityConfig.java | 1 + .../hchyun/generator/controller/SysTest.java | 28 ++++++++++ .../hchyun/generator/dao/InterTableDao.java | 6 ++ .../com/hchyun/generator/entity/Apiclass.java | 12 ++++ .../hchyun/generator/entity/InterTable.java | 55 +++++++++++++++++-- .../com/hchyun/generator/entity/Module.java | 12 ++++ .../generator/util/InterTableUtils.java | 4 ++ .../mapper/generator/InterTableMapper.xml | 33 +++++++++++ .../test/controller/ResultsController.java | 2 - 9 files changed, 145 insertions(+), 8 deletions(-) create mode 100644 hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/SysTest.java create mode 100644 hchyun/hchyun-generator/src/main/java/com/hchyun/generator/util/InterTableUtils.java diff --git a/hchyun/hchyun-framework/src/main/java/com/hchyun/framework/config/SecurityConfig.java b/hchyun/hchyun-framework/src/main/java/com/hchyun/framework/config/SecurityConfig.java index 7adebbe..d1b613c 100644 --- a/hchyun/hchyun-framework/src/main/java/com/hchyun/framework/config/SecurityConfig.java +++ b/hchyun/hchyun-framework/src/main/java/com/hchyun/framework/config/SecurityConfig.java @@ -110,6 +110,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { .antMatchers("/webjars/**").anonymous() .antMatchers("/*/api-docs").anonymous() .antMatchers("/druid/**").anonymous() + .antMatchers("/test/**").anonymous() // 除上面外的所有请求全部需要鉴权认证 .anyRequest().authenticated() .and() diff --git a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/SysTest.java b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/SysTest.java new file mode 100644 index 0000000..13afb76 --- /dev/null +++ b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/controller/SysTest.java @@ -0,0 +1,28 @@ +package com.hchyun.generator.controller; + +import com.hchyun.generator.dao.ApiclassDao; +import com.hchyun.generator.dao.InterTableDao; +import com.hchyun.generator.entity.Apiclass; +import com.hchyun.generator.entity.InterTable; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/test") +public class SysTest { + @Autowired + private InterTableDao interTableDao; + + @GetMapping("/1") + public Apiclass test(){ + return interTableDao.selectInterTableClass(3L); + } + @GetMapping("/2") + public List test2(){ + return interTableDao.selectInterTableModule(3L); + } +} diff --git a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/dao/InterTableDao.java b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/dao/InterTableDao.java index 88b8d03..eb5eb53 100644 --- a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/dao/InterTableDao.java +++ b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/dao/InterTableDao.java @@ -1,6 +1,8 @@ package com.hchyun.generator.dao; import java.util.List; + +import com.hchyun.generator.entity.Apiclass; import com.hchyun.generator.entity.InterTable; /** @@ -82,4 +84,8 @@ public interface InterTableDao * @return 结果 */ public int deleteInterTableByIds(Long[] ids); + + Apiclass selectInterTableClass(Long id); + + List selectInterTableModule(Long id); } \ No newline at end of file diff --git a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/entity/Apiclass.java b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/entity/Apiclass.java index e0caa9f..464a9b9 100644 --- a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/entity/Apiclass.java +++ b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/entity/Apiclass.java @@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModel; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; +import java.util.List; + /** * 接口类名对象 sys_apiclass * @@ -67,6 +69,16 @@ public class Apiclass extends BaseEntity { */ private Module module; + private List interTables; + + public List getInterTables() { + return interTables; + } + + public void setInterTables(List interTables) { + this.interTables = interTables; + } + public String getPrefix() { return prefix; } diff --git a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/entity/InterTable.java b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/entity/InterTable.java index 60bd087..0089c04 100644 --- a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/entity/InterTable.java +++ b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/entity/InterTable.java @@ -1,11 +1,14 @@ package com.hchyun.generator.entity; +import com.fasterxml.jackson.annotation.JsonFormat; import com.hchyun.common.annotation.Excel; import com.hchyun.common.core.entity.BaseEntity; import io.swagger.annotations.ApiModel; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; +import java.util.Date; + /** * 接口信息对象 sys_inter_table * @@ -13,8 +16,7 @@ import org.apache.commons.lang3.builder.ToStringStyle; * @date 2021-01-25 */ @ApiModel("接口信息") -public class InterTable extends BaseEntity { - private static final long serialVersionUID = 1L; +public class InterTable { /** * id @@ -72,6 +74,51 @@ public class InterTable extends BaseEntity { * 类型 */ private Integer type; + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** + * 创建者 + */ + private Long createBy; + + private String mName; + private Apiclass apiclass; + + public Apiclass getApiclass() { + return apiclass; + } + + public void setApiclass(Apiclass apiclass) { + this.apiclass = apiclass; + } + + public String getmName() { + return mName; + } + + public void setmName(String mName) { + this.mName = mName; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Long getCreateBy() { + return createBy; + } + + public void setCreateBy(Long createBy) { + this.createBy = createBy; + } public Integer getType() { return type; @@ -162,10 +209,6 @@ public class InterTable extends BaseEntity { .append("itDescribe", getItDescribe()) .append("requrl", getRequrl()) .append("method", getMethod()) - .append("createTime", getCreateTime()) - .append("createBy", getCreateBy()) - .append("updateTime", getUpdateTime()) - .append("updateBy", getUpdateBy()) .toString(); } } \ No newline at end of file diff --git a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/entity/Module.java b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/entity/Module.java index 1cd8447..c90bfc6 100644 --- a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/entity/Module.java +++ b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/entity/Module.java @@ -5,6 +5,8 @@ import com.hchyun.common.core.entity.BaseEntity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; +import java.util.List; + /** * 模块管理对象 sys_module * @@ -31,6 +33,16 @@ public class Module extends BaseEntity { @Excel(name = "模块描述") private String mDescribe; + private List apiclassList; + + public List getApiclassList() { + return apiclassList; + } + + public void setApiclassList(List apiclassList) { + this.apiclassList = apiclassList; + } + public void setId(Long id) { this.id = id; } diff --git a/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/util/InterTableUtils.java b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/util/InterTableUtils.java new file mode 100644 index 0000000..d944db9 --- /dev/null +++ b/hchyun/hchyun-generator/src/main/java/com/hchyun/generator/util/InterTableUtils.java @@ -0,0 +1,4 @@ +package com.hchyun.generator.util; + +public class InterTableUtils { +} diff --git a/hchyun/hchyun-generator/src/main/resources/mapper/generator/InterTableMapper.xml b/hchyun/hchyun-generator/src/main/resources/mapper/generator/InterTableMapper.xml index 15347fc..94790f4 100644 --- a/hchyun/hchyun-generator/src/main/resources/mapper/generator/InterTableMapper.xml +++ b/hchyun/hchyun-generator/src/main/resources/mapper/generator/InterTableMapper.xml @@ -14,9 +14,26 @@ + + + + + + + + + + + + + + + + + @@ -37,11 +54,27 @@ + + select id, m_id, c_id, it_name, it_describe, is_permission, requrl, method, is_generate, type, create_time, create_by from sys_inter_table + + +