yusm il y a 1 mois
Parent
commit
05c6b1053b
15 fichiers modifiés avec 318 ajouts et 43 suppressions
  1. 0 39
      fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/controller/CommonUploadController.java
  2. 31 0
      fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/controller/CourseInfoController.java
  3. 46 0
      fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/controller/CourseTypeController.java
  4. 17 0
      fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/controller/UserController.java
  5. 21 2
      fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/entity/CourseInfo.java
  6. 41 0
      fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/entity/CourseType.java
  7. 74 0
      fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/entity/dto/CourseInfoDto.java
  8. 16 0
      fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/mapper/CourseTypeMapper.java
  9. 16 0
      fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/service/CourseTypeService.java
  10. 3 0
      fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/service/UserService.java
  11. 20 0
      fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/service/impl/CourseTypeServiceImpl.java
  12. 12 0
      fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/service/impl/UserServiceImpl.java
  13. 1 1
      fhKeeper/formulahousekeeper/course-manager/src/main/resources/application.yml
  14. 4 1
      fhKeeper/formulahousekeeper/course-manager/src/main/resources/mapper/CourseInfoMapper.xml
  15. 16 0
      fhKeeper/formulahousekeeper/course-manager/src/main/resources/mapper/CourseTypeMapper.xml

+ 0 - 39
fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/controller/CommonUploadController.java

@@ -26,9 +26,6 @@ public class CommonUploadController {
     @Value(value = "${upload.path}")
     private String path;
 
-    @Value(value = "${upload.tempUpdatePath}")
-    private String tempUpdatePath;
-
     @Value(value = "${logging.path}")
     private String logPath;
 
@@ -67,42 +64,6 @@ public class CommonUploadController {
         return msg;
     }
 
-    @RequestMapping(value="uploadUpdateFile")
-    public HttpRespMsg uploadUpdateFile(MultipartFile multipartFile) {
-        HttpRespMsg msg = new HttpRespMsg();
-
-        //然后处理文件
-        String fileName = multipartFile.getOriginalFilename();
-        String[] split = fileName.split("\\.");
-        String serverName = UUID.randomUUID().toString().replaceAll("-", "") + "."+split[split.length-1];
-
-        //检查目录
-        File dir = new File(tempUpdatePath);
-        if (!dir.exists()) {
-            dir.mkdir();
-        }
-        File file = new File(dir, serverName);
-        InputStream inputStream = null;
-        OutputStream outputStream = null;
-        try {
-            inputStream = multipartFile.getInputStream();
-            outputStream = new FileOutputStream(file);
-            byte[] buffer = new byte[4096];
-            int temp = 0;
-            while ((temp = inputStream.read(buffer, 0, 4096)) != -1) {
-                outputStream.write(buffer, 0, temp);
-            }
-            inputStream.close();
-            outputStream.close();
-            msg.data = serverName;
-        } catch (Exception exception) {
-            exception.printStackTrace();
-            log.error(exception.getMessage());
-        }
-
-        return msg;
-    }
-
     @RequestMapping("/downLoadLog")
     public ResponseEntity<byte[]> downLoadLog() throws IOException {
         // 🧐🧐🧐读取本地的文件

+ 31 - 0
fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/controller/CourseInfoController.java

@@ -2,12 +2,16 @@ package com.management.platform.controller;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.management.platform.entity.CourseInfo;
 import com.management.platform.entity.User;
+import com.management.platform.entity.dto.CourseInfoDto;
 import com.management.platform.service.CourseInfoService;
 import com.management.platform.service.UserService;
 import com.management.platform.util.HttpRespMsg;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
@@ -19,6 +23,7 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.HashMap;
 import java.util.UUID;
 
 /**
@@ -88,5 +93,31 @@ public class CourseInfoController {
         courseInfoService.removeById(id);
         return msg;
     }
+
+    /**
+     * 分页查询
+     * @param courseInfoDto
+     * @return
+     */
+    @RequestMapping(value="/list")
+    public HttpRespMsg list(CourseInfoDto courseInfoDto) {
+        HttpRespMsg msg = new HttpRespMsg();
+        QueryWrapper<CourseInfo> wrapper = new QueryWrapper<>();
+        if(StringUtils.isNotEmpty(courseInfoDto.getCourseName())){
+            wrapper.like("course_name", courseInfoDto.getCourseName());
+        }
+        if (StringUtils.isNotEmpty(courseInfoDto.getCourseName())){
+            wrapper.like("course_instructor", courseInfoDto.getCourseInstructor());
+        }
+        if(courseInfoDto.getCourseType()!=null){
+            wrapper.eq("course_type", courseInfoDto.getCourseType());
+        }
+        IPage<CourseInfo> page = courseInfoService.page(new Page<CourseInfo>(courseInfoDto.getPage(), courseInfoDto.getSize()), wrapper);
+        HashMap<String, Object> map = new HashMap<>();
+        map.put("records", page.getRecords());
+        map.put("total", page.getTotal());
+        msg.setData(map);
+        return msg;
+    }
 }
 

+ 46 - 0
fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/controller/CourseTypeController.java

@@ -0,0 +1,46 @@
+package com.management.platform.controller;
+
+
+import com.management.platform.entity.CourseInfo;
+import com.management.platform.entity.CourseType;
+import com.management.platform.service.CourseTypeService;
+import com.management.platform.util.HttpRespMsg;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author Seyason
+ * @since 2025-04-14
+ */
+@RestController
+@RequestMapping("/course-type")
+public class CourseTypeController {
+    @Resource
+    private CourseTypeService courseTypeService;
+
+    /**
+     * 保存或新增
+     * @param courseType
+     * @param request
+     * @return
+     */
+    @RequestMapping(value="/saveOrUpdate")
+    public HttpRespMsg saveOrUpdate(CourseType courseType, HttpServletRequest request) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+//        if (courseType.getId() == null) {
+//
+//        }
+        return httpRespMsg;
+
+    }
+
+}
+

+ 17 - 0
fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/controller/UserController.java

@@ -1,10 +1,15 @@
 package com.management.platform.controller;
 
 
+import com.management.platform.service.UserService;
+import com.management.platform.util.HttpRespMsg;
 import org.springframework.web.bind.annotation.RequestMapping;
 
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
+
 /**
  * <p>
  *  前端控制器
@@ -16,6 +21,18 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping("/user")
 public class UserController {
+    @Resource
+    private UserService userService;
+
+    /**
+     * 登录网页端
+     * username 用户名
+     * password 密码
+     */
+    @RequestMapping("/loginAdmin")
+    public HttpRespMsg loginAdmin(@RequestParam String username, @RequestParam String password) {
+        return userService.loginAdmin(username, password);
+    }
 
 }
 

+ 21 - 2
fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/entity/CourseInfo.java

@@ -3,8 +3,9 @@ package com.management.platform.entity;
 import java.math.BigDecimal;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.time.LocalDate;
 import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.time.LocalDate;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
 
@@ -20,7 +21,7 @@ import org.springframework.format.annotation.DateTimeFormat;
  * </p>
  *
  * @author Seyason
- * @since 2025-04-11
+ * @since 2025-04-14
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -97,6 +98,24 @@ public class CourseInfo extends Model<CourseInfo> {
     @TableField("company_id")
     private Integer companyId;
 
+    /**
+     * 课程分类id
+     */
+    @TableField("course_type_id")
+    private Integer courseTypeId;
+
+    /**
+     * 附件url
+     */
+    @TableField("attachment_url")
+    private String attachmentUrl;
+
+    /**
+     * 课程url
+     */
+    @TableField("course_url")
+    private String courseUrl;
+
 
     @Override
     protected Serializable pkVal() {

+ 41 - 0
fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/entity/CourseType.java

@@ -0,0 +1,41 @@
+package com.management.platform.entity;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author Seyason
+ * @since 2025-04-14
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class CourseType extends Model<CourseType> {
+
+    private static final long serialVersionUID=1L;
+
+    @TableId("id")
+    private Integer id;
+
+    /**
+     * 课程类型名称
+     */
+    @TableField("type_name")
+    private String typeName;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 74 - 0
fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/entity/dto/CourseInfoDto.java

@@ -0,0 +1,74 @@
+package com.management.platform.entity.dto;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class CourseInfoDto {
+    private Integer id;
+
+    /**
+     * 课程名称
+     */
+    private String courseName;
+
+    /**
+     * 课程介绍
+     */
+    private String courseDesc;
+
+    /**
+     * 课程讲师
+     */
+    private String courseInstructor;
+
+    /**
+     * 课程价格
+     */
+    private BigDecimal coursePrice;
+
+    /**
+     * 课程是否上架 0未上架,1已上架
+     */
+    private Integer courseStatus;
+
+    /**
+     * 讲师级别
+     */
+    private String instructorType;
+
+    /**
+     * 讲师头像url
+     */
+    private String instructorImg;
+
+    /**
+     * 讲师介绍
+     */
+    private String instructorDesc;
+
+    /**
+     * 上传日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private LocalDate createDate;
+
+    /**
+     * 公司id
+     */
+    private Integer companyId;
+
+    private Integer page;
+
+    private Integer size;
+
+    private Integer courseType;
+}

+ 16 - 0
fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/mapper/CourseTypeMapper.java

@@ -0,0 +1,16 @@
+package com.management.platform.mapper;
+
+import com.management.platform.entity.CourseType;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author Seyason
+ * @since 2025-04-14
+ */
+public interface CourseTypeMapper extends BaseMapper<CourseType> {
+
+}

+ 16 - 0
fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/service/CourseTypeService.java

@@ -0,0 +1,16 @@
+package com.management.platform.service;
+
+import com.management.platform.entity.CourseType;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2025-04-14
+ */
+public interface CourseTypeService extends IService<CourseType> {
+
+}

+ 3 - 0
fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/service/UserService.java

@@ -2,6 +2,7 @@ package com.management.platform.service;
 
 import com.management.platform.entity.User;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.management.platform.util.HttpRespMsg;
 
 /**
  * <p>
@@ -13,4 +14,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface UserService extends IService<User> {
 
+    HttpRespMsg loginAdmin(String username, String password);
+
 }

+ 20 - 0
fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/service/impl/CourseTypeServiceImpl.java

@@ -0,0 +1,20 @@
+package com.management.platform.service.impl;
+
+import com.management.platform.entity.CourseType;
+import com.management.platform.mapper.CourseTypeMapper;
+import com.management.platform.service.CourseTypeService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2025-04-14
+ */
+@Service
+public class CourseTypeServiceImpl extends ServiceImpl<CourseTypeMapper, CourseType> implements CourseTypeService {
+
+}

+ 12 - 0
fhKeeper/formulahousekeeper/course-manager/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -4,6 +4,7 @@ import com.management.platform.entity.User;
 import com.management.platform.mapper.UserMapper;
 import com.management.platform.service.UserService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.management.platform.util.HttpRespMsg;
 import org.springframework.stereotype.Service;
 
 /**
@@ -17,4 +18,15 @@ import org.springframework.stereotype.Service;
 @Service
 public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
 
+    //登录网页端
+    @Override
+    public HttpRespMsg loginAdmin(String username, String password) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        if ("admin".equals(username) && "admin".equals(password)) {
+            return httpRespMsg;
+        }else {
+            httpRespMsg.setError("账号或密码错误");
+            return httpRespMsg;
+        }
+    }
 }

+ 1 - 1
fhKeeper/formulahousekeeper/course-manager/src/main/resources/application.yml

@@ -80,7 +80,7 @@ management:
   security:
     enabled:false:
   server:
-    port: 10019
+    port: 10031
 #  endpoints:
 #    web:
 #      exposure:

+ 4 - 1
fhKeeper/formulahousekeeper/course-manager/src/main/resources/mapper/CourseInfoMapper.xml

@@ -15,11 +15,14 @@
         <result column="instructor_desc" property="instructorDesc" />
         <result column="create_date" property="createDate" />
         <result column="company_id" property="companyId" />
+        <result column="course_type_id" property="courseTypeId" />
+        <result column="attachment_url" property="attachmentUrl" />
+        <result column="course_url" property="courseUrl" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, course_name, course_desc, course_instructor, course_price, course_status, instructor_type, instructor_img, instructor_desc, create_date, company_id
+        id, course_name, course_desc, course_instructor, course_price, course_status, instructor_type, instructor_img, instructor_desc, create_date, company_id, course_type_id, attachment_url, course_url
     </sql>
 
 </mapper>

+ 16 - 0
fhKeeper/formulahousekeeper/course-manager/src/main/resources/mapper/CourseTypeMapper.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.management.platform.mapper.CourseTypeMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.management.platform.entity.CourseType">
+        <id column="id" property="id" />
+        <result column="type_name" property="typeName" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, type_name
+    </sql>
+
+</mapper>