Browse Source

。。。

wangwei 7 năm trước cách đây
mục cha
commit
48d80c6f7b

+ 15 - 6
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/service/core/api/AppApi.java

@@ -1,11 +1,16 @@
 package cn.com.qmth.examcloud.service.core.api;
 
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Sort;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
+import cn.com.qmth.examcloud.core.basic.dao.AppRepo;
+import cn.com.qmth.examcloud.core.basic.dao.entity.App;
 import io.swagger.annotations.ApiOperation;
 
 /**
@@ -13,11 +18,15 @@ import io.swagger.annotations.ApiOperation;
  */
 @RestController
 @RequestMapping("${app.api.root}/app")
-public class AppApi {
+public class AppApi extends ControllerSupport {
+
+	@Autowired
+	AppRepo appRepo;
 
 	@ApiOperation(value = "查询所有应用")
-	@GetMapping
-	public ResponseEntity getAllApp() {
-		return new ResponseEntity(null, HttpStatus.OK);
+	@GetMapping("getAllApp")
+	public List<App> getAllApp() {
+		Sort sort = new Sort(Sort.Direction.ASC, "id");
+		return appRepo.findAll(sort);
 	}
 }

+ 24 - 0
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/AppRepo.java

@@ -0,0 +1,24 @@
+package cn.com.qmth.examcloud.core.basic.dao;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.repository.query.QueryByExampleExecutor;
+
+import cn.com.qmth.examcloud.core.basic.dao.entity.App;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年6月11日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public interface AppRepo
+		extends
+			JpaRepository<App, Long>,
+			QueryByExampleExecutor<App>,
+			JpaSpecificationExecutor<App> {
+
+}

+ 84 - 0
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/Privilege.java

@@ -52,6 +52,42 @@ public class Privilege extends JpaEntity implements TreeNode {
 	@Column(unique = false, nullable = false)
 	private Long groupId;
 
+	/**
+	 * 描述
+	 */
+	@Column(unique = false, nullable = true)
+	private String description;
+
+	/**
+	 * 扩展属性
+	 */
+	@Column(unique = false, nullable = true)
+	private String ext1;
+
+	/**
+	 * 扩展属性
+	 */
+	@Column(unique = false, nullable = true)
+	private String ext2;
+
+	/**
+	 * 扩展属性
+	 */
+	@Column(unique = false, nullable = true)
+	private String ext3;
+
+	/**
+	 * 扩展属性
+	 */
+	@Column(unique = false, nullable = true)
+	private String ext4;
+
+	/**
+	 * 扩展属性
+	 */
+	@Column(unique = false, nullable = true)
+	private String ext5;
+
 	public Long getId() {
 		return id;
 	}
@@ -92,6 +128,54 @@ public class Privilege extends JpaEntity implements TreeNode {
 		this.groupId = groupId;
 	}
 
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	public String getExt1() {
+		return ext1;
+	}
+
+	public void setExt1(String ext1) {
+		this.ext1 = ext1;
+	}
+
+	public String getExt2() {
+		return ext2;
+	}
+
+	public void setExt2(String ext2) {
+		this.ext2 = ext2;
+	}
+
+	public String getExt3() {
+		return ext3;
+	}
+
+	public void setExt3(String ext3) {
+		this.ext3 = ext3;
+	}
+
+	public String getExt4() {
+		return ext4;
+	}
+
+	public void setExt4(String ext4) {
+		this.ext4 = ext4;
+	}
+
+	public String getExt5() {
+		return ext5;
+	}
+
+	public void setExt5(String ext5) {
+		this.ext5 = ext5;
+	}
+
 	@Override
 	public String getTreeId() {
 		return null;

+ 1 - 1
examcloud-core-basic-starter/src/main/resources/application-dev.properties

@@ -1,4 +1,4 @@
-spring.datasource.url=jdbc:mysql://localhost:3306/exam_cloud_test?useUnicode=true&characterEncoding=UTF-8&useSSL=false
+spring.datasource.url=jdbc:mysql://db-host:3306/exam_cloud_test?useUnicode=true&characterEncoding=UTF-8&useSSL=false
 spring.datasource.username=root
 spring.datasource.password=root