zhangyu 1 week geleden
bovenliggende
commit
acf51da298

+ 22 - 3
src/main/java/com/futu/goose/course/controller/CourseController.java

@@ -5,9 +5,7 @@ import com.futu.goose.course.pojo.Course;
 import com.futu.goose.course.service.CourseService;
 import com.futu.goose.utils.Result;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -16,13 +14,34 @@ import java.util.List;
 public class CourseController {
     @Autowired
     private CourseService courseService;
+
+    /**
+     * 课程查询
+     * @return
+     */
     @RequestMapping("/listcourse")
     public Result listcourse() {
       List<Course> courseList= courseService.listcourse();
         return new Result(true, "查询成功", courseList);
     }
+
+    /**
+     * 搜索
+     * @param title
+     * @return
+     */
     @RequestMapping("selectes")
     public Result selectes(@RequestParam("title") String title) {
         return courseService.selectes(title);
     }
+
+    /**
+     * 添加课程
+     * @param course
+     * @return
+     */
+    @PostMapping("/addcourse")
+    public Result addCourse(@RequestBody Course course) {
+        return courseService.addCourse(course);
+    }
 }

+ 4 - 78
src/main/java/com/futu/goose/course/pojo/Course.java

@@ -91,84 +91,10 @@ public class Course implements Serializable {
      * 更新时间
      */
     private Date updateTime;
-
+    /**
+     * shop_id
+     */
+    private Long shopId;
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;
-
-    @Override
-    public boolean equals(Object that) {
-        if (this == that) {
-            return true;
-        }
-        if (that == null) {
-            return false;
-        }
-        if (getClass() != that.getClass()) {
-            return false;
-        }
-        Course other = (Course) that;
-        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
-            && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
-            && (this.getSubtitle() == null ? other.getSubtitle() == null : this.getSubtitle().equals(other.getSubtitle()))
-            && (this.getCoverImage() == null ? other.getCoverImage() == null : this.getCoverImage().equals(other.getCoverImage()))
-            && (this.getCategoryId() == null ? other.getCategoryId() == null : this.getCategoryId().equals(other.getCategoryId()))
-            && (this.getTeacherId() == null ? other.getTeacherId() == null : this.getTeacherId().equals(other.getTeacherId()))
-            && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
-            && (this.getOriginalPrice() == null ? other.getOriginalPrice() == null : this.getOriginalPrice().equals(other.getOriginalPrice()))
-            && (this.getDuration() == null ? other.getDuration() == null : this.getDuration().equals(other.getDuration()))
-            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
-            && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
-            && (this.getLearnGoals() == null ? other.getLearnGoals() == null : this.getLearnGoals().equals(other.getLearnGoals()))
-            && (this.getRequirements() == null ? other.getRequirements() == null : this.getRequirements().equals(other.getRequirements()))
-            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
-            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
-        result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
-        result = prime * result + ((getSubtitle() == null) ? 0 : getSubtitle().hashCode());
-        result = prime * result + ((getCoverImage() == null) ? 0 : getCoverImage().hashCode());
-        result = prime * result + ((getCategoryId() == null) ? 0 : getCategoryId().hashCode());
-        result = prime * result + ((getTeacherId() == null) ? 0 : getTeacherId().hashCode());
-        result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
-        result = prime * result + ((getOriginalPrice() == null) ? 0 : getOriginalPrice().hashCode());
-        result = prime * result + ((getDuration() == null) ? 0 : getDuration().hashCode());
-        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
-        result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
-        result = prime * result + ((getLearnGoals() == null) ? 0 : getLearnGoals().hashCode());
-        result = prime * result + ((getRequirements() == null) ? 0 : getRequirements().hashCode());
-        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
-        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
-        return result;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append(getClass().getSimpleName());
-        sb.append(" [");
-        sb.append("Hash = ").append(hashCode());
-        sb.append(", id=").append(id);
-        sb.append(", title=").append(title);
-        sb.append(", subtitle=").append(subtitle);
-        sb.append(", coverImage=").append(coverImage);
-        sb.append(", categoryId=").append(categoryId);
-        sb.append(", teacherId=").append(teacherId);
-        sb.append(", price=").append(price);
-        sb.append(", originalPrice=").append(originalPrice);
-        sb.append(", duration=").append(duration);
-        sb.append(", status=").append(status);
-        sb.append(", description=").append(description);
-        sb.append(", learnGoals=").append(learnGoals);
-        sb.append(", requirements=").append(requirements);
-        sb.append(", createTime=").append(createTime);
-        sb.append(", updateTime=").append(updateTime);
-        sb.append(", serialVersionUID=").append(serialVersionUID);
-        sb.append("]");
-        return sb.toString();
-    }
 }

+ 0 - 16
src/main/java/com/futu/goose/course/pojo/CourseCategory.java

@@ -82,20 +82,4 @@ public class CourseCategory implements Serializable {
         return result;
     }
 
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append(getClass().getSimpleName());
-        sb.append(" [");
-        sb.append("Hash = ").append(hashCode());
-        sb.append(", id=").append(id);
-        sb.append(", name=").append(name);
-        sb.append(", parentId=").append(parentId);
-        sb.append(", sortOrder=").append(sortOrder);
-        sb.append(", createTime=").append(createTime);
-        sb.append(", updateTime=").append(updateTime);
-        sb.append(", serialVersionUID=").append(serialVersionUID);
-        sb.append("]");
-        return sb.toString();
-    }
 }

+ 2 - 0
src/main/java/com/futu/goose/course/service/CourseService.java

@@ -16,4 +16,6 @@ public interface CourseService extends IService<Course> {
     List<Course> listcourse();
 
     Result selectes(String title);
+
+    Result addCourse(Course course);
 }

+ 6 - 0
src/main/java/com/futu/goose/course/service/impl/CourseServiceImpl.java

@@ -35,6 +35,12 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course>
     public Result selectes(String title) {
         return esSyncUtils.searchDataByIndexAndName("course",title);
     }
+
+    @Override
+    public Result addCourse(Course course) {
+        courseMapper.insert(course);
+        return new Result(true,"添加成功");
+    }
 }
 
 

+ 1 - 1
src/main/java/com/futu/goose/store/controller/ShopController.java

@@ -30,7 +30,7 @@ public class ShopController {
     }
 
     /**
-     * 创建新商铺
+     * 添加新商铺
      * @param shop
      * @return
      */

+ 6 - 0
src/main/java/com/futu/goose/user/controller/MinioController.java

@@ -13,6 +13,12 @@ import org.springframework.web.multipart.MultipartFile;
 public class MinioController {
     @Autowired
     private MinioUtils minioUtils;
+
+    /**
+     * 上传图片
+     * @param file
+     * @return
+     */
     @RequestMapping("upload")
     public Result upload(@RequestParam("file") MultipartFile file){
         try {

+ 12 - 0
src/main/java/com/futu/goose/user/controller/UserController.java

@@ -23,10 +23,22 @@ public class UserController {
     public ResponseResult login(@RequestBody TUser user){
         return tUserService.login(user);
     }
+
+    /**
+     * 手机号登录
+     * @param user
+     * @return
+     */
     @RequestMapping("phonelogin")
     public ResponseResult phonelogin(@RequestBody TUser user){
         return tUserService.phonelogin(user);
     }
+
+    /**
+     * 注册
+     * @param user
+     * @return
+     */
     @PostMapping("/regist")
     public ResponseResult regist(@RequestBody TUser user){
         return tUserService.regist(user);

+ 5 - 0
src/main/java/com/futu/goose/user/controller/ValidateCode.java

@@ -19,6 +19,11 @@ public class ValidateCode {
     @Autowired
     private RedisClient redisClient;
 
+    /**
+     * 生成验证码
+     * @param telephone
+     * @return
+     */
     @RequestMapping("/send4Order")
     public Result send4Order(@RequestParam("telephone") String telephone) {
         Integer code = validateCodeService.send4Order(telephone);

+ 0 - 4
src/main/java/com/futu/goose/user/service/impl/TUserServiceImpl.java

@@ -142,7 +142,3 @@ public class TUserServiceImpl extends ServiceImpl<TUserMapper, TUser>
         return ResponseResult.okResult(map);
     }
 }
-
-
-
-