Browse Source

重构代码,修改mavan构建配置

宋悦 8 years ago
parent
commit
b8fad91f57

+ 9 - 2
core-api/src/main/java/cn/com/qmth/examcloud/service/core/api/CourseApi.java

@@ -6,6 +6,7 @@ import cn.com.qmth.examcloud.service.core.service.CourseService;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.PageRequest;
+import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
@@ -35,6 +36,12 @@ public class CourseApi {
         return courseService.getAllCourse(courseCriteria);
     }
 
+    @ApiOperation(value="查询所有课程",notes="不分页不带查询")
+    @GetMapping
+    public ResponseEntity getAllCourse(){
+        return new ResponseEntity(courseRepo.findAll(), HttpStatus.OK);
+    }
+
     @ApiOperation(value="按ID查询课程",notes="ID查询")
     @GetMapping("/{id}")
     public ResponseEntity<Course> getCourseById(@PathVariable Long id){
@@ -43,13 +50,13 @@ public class CourseApi {
 
     @ApiOperation(value="新增课程",notes="新增")
     @PostMapping
-    public ResponseEntity addCourse(@ModelAttribute Course course){
+    public ResponseEntity addCourse(@RequestBody Course course){
         return courseService.saveCourse(course);
     }
 
     @ApiOperation(value="更新课程",notes="更新")
     @PutMapping
-    public ResponseEntity updateCourse(@ModelAttribute Course course){
+    public ResponseEntity updateCourse(@RequestBody Course course){
         return courseService.saveCourse(course);
     }
 

+ 9 - 2
core-api/src/main/java/cn/com/qmth/examcloud/service/core/api/LearnCenterApi.java

@@ -6,6 +6,7 @@ import cn.com.qmth.examcloud.service.core.service.LearnCenterService;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.PageRequest;
+import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
@@ -35,6 +36,12 @@ public class LearnCenterApi {
         return learnCenterService.getAllLearnCenter(learnCenterCriteria);
     }
 
+    @ApiOperation(value="查询所有学习中心",notes="不分页不带查询")
+    @GetMapping
+    public ResponseEntity getAllLearnCenter(){
+        return new ResponseEntity(learnCenterRepo.findAll(), HttpStatus.OK);
+    }
+
     @ApiOperation(value="按ID查询学习中心",notes="ID查询")
     @GetMapping("/{id}")
     public ResponseEntity<LearnCenter> getLearnCenterById(@PathVariable Long id){
@@ -43,13 +50,13 @@ public class LearnCenterApi {
 
     @ApiOperation(value="新增学习中心",notes="新增")
     @PostMapping
-    public ResponseEntity addLearnCenter(@ModelAttribute LearnCenter learnCenter){
+    public ResponseEntity addLearnCenter(@RequestBody LearnCenter learnCenter){
         return learnCenterService.saveLearnCenter(learnCenter);
     }
 
     @ApiOperation(value="更新学习中心",notes="更新")
     @PutMapping
-    public ResponseEntity updateLearnCenter(@ModelAttribute LearnCenter learnCenter){
+    public ResponseEntity updateLearnCenter(@RequestBody LearnCenter learnCenter){
         return learnCenterService.saveLearnCenter(learnCenter);
     }
 

+ 9 - 2
core-api/src/main/java/cn/com/qmth/examcloud/service/core/api/SchoolApi.java

@@ -6,6 +6,7 @@ import cn.com.qmth.examcloud.service.core.service.SchoolService;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.PageRequest;
+import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
@@ -35,6 +36,12 @@ public class SchoolApi {
         return schoolService.getAllSchool(schoolCriteria);
     }
 
+    @ApiOperation(value="查询所有学校",notes="不分页不带查询")
+    @GetMapping
+    public ResponseEntity getAllSchool(){
+        return new ResponseEntity(schoolRepo.findAll(), HttpStatus.OK);
+    }
+
     @ApiOperation(value="按ID查询学校",notes="ID查询")
     @GetMapping("/{id}")
     public ResponseEntity<School> getSchoolById(@PathVariable Long id){
@@ -43,13 +50,13 @@ public class SchoolApi {
 
     @ApiOperation(value="新增学校",notes="新增")
     @PostMapping
-    public ResponseEntity addSchool(@ModelAttribute School school){
+    public ResponseEntity addSchool(@RequestBody School school){
         return schoolService.saveSchool(school);
     }
 
     @ApiOperation(value="更新学校",notes="更新")
     @PutMapping
-    public ResponseEntity updateSchool(@ModelAttribute School school){
+    public ResponseEntity updateSchool(@RequestBody School school){
         return schoolService.saveSchool(school);
     }
 

+ 9 - 2
core-api/src/main/java/cn/com/qmth/examcloud/service/core/api/StudentApi.java

@@ -6,6 +6,7 @@ import cn.com.qmth.examcloud.service.core.service.StudentService;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.PageRequest;
+import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
@@ -35,6 +36,12 @@ public class StudentApi {
         return studentService.getAllStudent(studentCriteria);
     }
 
+    @ApiOperation(value="查询所有学生",notes="不分页不带查询")
+    @GetMapping
+    public ResponseEntity getAllStudent(){
+        return new ResponseEntity(studentRepo.findAll(), HttpStatus.OK);
+    }
+
     @ApiOperation(value="按ID查询学生",notes="ID查询")
     @GetMapping("/{id}")
     public ResponseEntity<Student> getStudentById(@PathVariable Long id){
@@ -43,13 +50,13 @@ public class StudentApi {
 
     @ApiOperation(value="新增学生",notes="新增")
     @PostMapping
-    public ResponseEntity addStudent(@ModelAttribute Student student){
+    public ResponseEntity addStudent(@RequestBody Student student){
         return studentService.saveStudent(student);
     }
 
     @ApiOperation(value="更新学生",notes="更新")
     @PutMapping
-    public ResponseEntity updateStudent(@ModelAttribute Student student){
+    public ResponseEntity updateStudent(@RequestBody Student student){
         return studentService.saveStudent(student);
     }
 

+ 9 - 2
core-api/src/main/java/cn/com/qmth/examcloud/service/core/api/UserApi.java

@@ -6,6 +6,7 @@ import cn.com.qmth.examcloud.service.core.service.UserService;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.PageRequest;
+import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
@@ -35,6 +36,12 @@ public class UserApi {
         return userService.getAllUser(userCriteria);
     }
 
+    @ApiOperation(value="查询所有用户",notes="不分页不带查询")
+    @GetMapping
+    public ResponseEntity getAllUser(){
+        return new ResponseEntity(userRepo.findAll(), HttpStatus.OK);
+    }
+
     @ApiOperation(value="按ID查询用户",notes="ID查询")
     @GetMapping("/{id}")
     public ResponseEntity<User> getUserById(@PathVariable Long id){
@@ -43,13 +50,13 @@ public class UserApi {
 
     @ApiOperation(value="新增用户",notes="新增")
     @PostMapping
-    public ResponseEntity addUser(@ModelAttribute User user){
+    public ResponseEntity addUser(@RequestBody User user){
         return userService.saveUser(user);
     }
 
     @ApiOperation(value="更新用户",notes="更新")
     @PutMapping
-    public ResponseEntity updateUser(@ModelAttribute User user){
+    public ResponseEntity updateUser(@RequestBody User user){
         return userService.saveUser(user);
     }
 

+ 13 - 0
core-domain/src/main/java/cn/com/qmth/examcloud/service/core/entity/Course.java

@@ -30,6 +30,8 @@ public class Course implements Serializable{
 
 	@Temporal(TemporalType.DATE)
 	private Date createTime;
+
+	private Boolean isValid;
     
 	public Long getId() {
 		return id;
@@ -66,4 +68,15 @@ public class Course implements Serializable{
 	public void setCreateTime(Date createTime) {
 		this.createTime = createTime;
 	}
+
+	public Boolean getValid() {
+		return isValid;
+	}
+
+	public void setValid(Boolean valid) {
+		isValid = valid;
+	}
+
+	public Course() {
+	}
 }

+ 15 - 7
core-domain/src/main/java/cn/com/qmth/examcloud/service/core/entity/LearnCenter.java

@@ -1,6 +1,5 @@
 package cn.com.qmth.examcloud.service.core.entity;
 
-import cn.com.qmth.examcloud.service.core.enums.isValid;
 import javax.persistence.*;
 import javax.validation.constraints.NotNull;
 import java.io.Serializable;
@@ -24,8 +23,7 @@ public class LearnCenter implements Serializable{
     @NotNull
     private String name;
 
-    @Enumerated(EnumType.STRING)
-    private isValid isvalid;
+    private Boolean isValid;
 
     @ManyToOne
     @JoinColumn(name = "schoolId")
@@ -34,6 +32,8 @@ public class LearnCenter implements Serializable{
     @Temporal(value = TemporalType.DATE)
     private Date createTime;
 
+    private String remark;
+
     public static long getSerialVersionUID() {
         return serialVersionUID;
     }
@@ -62,12 +62,12 @@ public class LearnCenter implements Serializable{
         this.name = name;
     }
 
-    public isValid getIsvalid() {
-        return isvalid;
+    public Boolean getIsValid() {
+        return isValid;
     }
 
-    public void setIsvalid(isValid isvalid) {
-        this.isvalid = isvalid;
+    public void setIsValid(Boolean isvalid) {
+        this.isValid = isvalid;
     }
 
     public School getSchool() {
@@ -86,6 +86,14 @@ public class LearnCenter implements Serializable{
         this.createTime = createTime;
     }
 
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
     public LearnCenter() {
     }
 }

+ 13 - 19
core-domain/src/main/java/cn/com/qmth/examcloud/service/core/entity/School.java

@@ -1,12 +1,9 @@
 package cn.com.qmth.examcloud.service.core.entity;
 
-import cn.com.qmth.examcloud.service.core.enums.isValid;
-
 import javax.persistence.*;
 import javax.validation.constraints.NotNull;
 import java.io.Serializable;
 import java.util.Date;
-import java.util.List;
 
 /**
  * Created by songyue on 17/1/13.
@@ -30,12 +27,9 @@ public class School implements Serializable{
     @Temporal(value = TemporalType.DATE)
     private Date createTime;
 
-    @Enumerated(EnumType.STRING)
-    private isValid isvalid;
+    private Boolean isValid;
 
-//    @OneToMany(cascade = {CascadeType.ALL})
-//    @JoinColumn(name="schoolId")
-//    private List<LearnCenter> learnCenters;
+    private String remark;
 
     public static long getSerialVersionUID() {
         return serialVersionUID;
@@ -73,21 +67,21 @@ public class School implements Serializable{
         this.createTime = createTime;
     }
 
-    public isValid getIsvalid() {
-        return isvalid;
+    public Boolean getIsValid() {
+        return isValid;
+    }
+
+    public void setIsValid(Boolean isvalid) {
+        this.isValid = isvalid;
     }
 
-    public void setIsvalid(isValid isvalid) {
-        this.isvalid = isvalid;
+    public String getRemark() {
+        return remark;
     }
 
-//    public List<LearnCenter> getLearnCenters() {
-//        return learnCenters;
-//    }
-//
-//    public void setLearnCenters(List<LearnCenter> learnCenters) {
-//        this.learnCenters = learnCenters;
-//    }
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
 
     public School() {
     }

+ 5 - 7
core-domain/src/main/java/cn/com/qmth/examcloud/service/core/entity/User.java

@@ -1,6 +1,5 @@
 package cn.com.qmth.examcloud.service.core.entity;
 
-import cn.com.qmth.examcloud.service.core.enums.isValid;
 import javax.persistence.*;
 import javax.validation.constraints.NotNull;
 import java.io.Serializable;
@@ -31,8 +30,7 @@ public class User implements Serializable{
     @NotNull
     private String password;
 
-    @Enumerated(EnumType.STRING)
-    private isValid isvalid;
+    private Boolean isValid;
 
     public static long getSerialVersionUID() {
         return serialVersionUID;
@@ -78,12 +76,12 @@ public class User implements Serializable{
         this.password = password;
     }
 
-    public isValid getIsvalid() {
-        return isvalid;
+    public Boolean getIsValid() {
+        return isValid;
     }
 
-    public void setIsvalid(isValid isvalid) {
-        this.isvalid = isvalid;
+    public void setIsValid(Boolean isvalid) {
+        this.isValid = isvalid;
     }
 
     public User() {

+ 0 - 8
core-domain/src/main/java/cn/com/qmth/examcloud/service/core/enums/isValid.java

@@ -1,8 +0,0 @@
-package cn.com.qmth.examcloud.service.core.enums;
-
-/**
- * Created by songyue on 17/1/13.
- */
-public enum isValid {
-    TRUE,FALSE
-}

+ 14 - 0
core-main/src/test/java/cn/com/qmth/examcloud/service/core/AppTest.java

@@ -0,0 +1,14 @@
+package cn.com.qmth.examcloud.service.core;
+
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+/**
+ * Unit test for simple App.
+ */
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class AppTest {
+
+}

+ 34 - 16
pom.xml

@@ -29,8 +29,6 @@
         <!-- non-dependencies -->
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <java.version>1.8</java.version>
-        <thymeleaf.version>3.0.0.RELEASE</thymeleaf.version>
-        <thymeleaf-layout-dialect.version>2.0.0</thymeleaf-layout-dialect.version>
         <mysql.version>5.1.21</mysql.version>
         <poi.version>3.8</poi.version>
         <!--反射工具类 -->
@@ -80,22 +78,42 @@
     <build>
         <plugins>
             <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-                <version>${spring.boot.version}</version>
-                <configuration><!-- 指定该Main Class为全局的唯一入口 -->
-                    <mainClass>cn.com.qmth.examcloud.service.core.Application</mainClass>
-                    <layout>ZIP</layout>
-                </configuration>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中-->
-                        </goals>
-                    </execution>
-                </executions>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
             </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+            </plugin>
+
         </plugins>
+
+        <pluginManagement>
+            <plugins>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <version>${maven-surefire-plugin.version}</version>
+                    <configuration>
+                        <testFailureIgnore>true</testFailureIgnore>
+                    </configuration>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <version>${maven-compiler-plugin.version}</version>
+                    <configuration>
+                        <source>1.8</source>
+                        <target>1.8</target>
+                        <compilerArgument>-proc:none</compilerArgument>
+                    </configuration>
+                </plugin>
+
+            </plugins>
+        </pluginManagement>
     </build>
 
 </project>