Pārlūkot izejas kodu

Merge branch 'master' of http://47.100.37.243:10080/ZHOU/yunsu

sunyadv 5 gadi atpakaļ
vecāks
revīzija
9a482b7954
25 mainītis faili ar 456 papildinājumiem un 123 dzēšanām
  1. 3 2
      official_backend/src/main/java/com/hssx/ysofficial/controller/ArticleController.java
  2. 19 7
      official_backend/src/main/java/com/hssx/ysofficial/entity/Article.java
  3. 20 2
      official_backend/src/main/java/com/hssx/ysofficial/entity/BannerPictures.java
  4. 5 5
      official_backend/src/main/java/com/hssx/ysofficial/entity/Comment.java
  5. 17 2
      official_backend/src/main/java/com/hssx/ysofficial/entity/Cooperations.java
  6. 11 2
      official_backend/src/main/java/com/hssx/ysofficial/entity/User.java
  7. 1 1
      official_backend/src/main/java/com/hssx/ysofficial/mapper/ArticleMapper.java
  8. 2 1
      official_backend/src/main/java/com/hssx/ysofficial/service/ArticleService.java
  9. 31 2
      official_backend/src/main/java/com/hssx/ysofficial/service/impl/ArticleServiceImpl.java
  10. 6 0
      official_backend/src/main/resources/application.properties
  11. 3 1
      official_backend/src/main/resources/mapper/ArticleMapper.xml
  12. 1 13
      website/src/main/java/com/hssx/website/controller/ArticleController.java
  13. 17 1
      website/src/main/java/com/hssx/website/defaultviewconfig/DefaultView.java
  14. 37 7
      website/src/main/java/com/hssx/website/entity/Article.java
  15. 20 2
      website/src/main/java/com/hssx/website/entity/BannerPictures.java
  16. 5 5
      website/src/main/java/com/hssx/website/entity/Comment.java
  17. 17 2
      website/src/main/java/com/hssx/website/entity/Cooperations.java
  18. 77 0
      website/src/main/java/com/hssx/website/entity/User.java
  19. 16 0
      website/src/main/java/com/hssx/website/mapper/UserMapper.java
  20. 16 0
      website/src/main/java/com/hssx/website/service/UserService.java
  21. 19 1
      website/src/main/java/com/hssx/website/service/impl/ArticleServiceImpl.java
  22. 20 0
      website/src/main/java/com/hssx/website/service/impl/UserServiceImpl.java
  23. 3 1
      website/src/main/resources/mapper/ArticleMapper.xml
  24. 17 0
      website/src/main/resources/mapper/UserMapper.xml
  25. 73 66
      website/src/main/resources/templates/index.html

+ 3 - 2
official_backend/src/main/java/com/hssx/ysofficial/controller/ArticleController.java

@@ -9,6 +9,7 @@ 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.multipart.MultipartFile;
 
 /**
  * <p>
@@ -40,8 +41,8 @@ public class ArticleController {
     }
 
     @RequestMapping("/editArticle")
-    public HttpRespMsg editArticle(Article article){
-        return articleService.editArticle(article);
+    public HttpRespMsg editArticle(Article article, MultipartFile multipartFile){
+        return articleService.editArticle(article, multipartFile);
     }
 
     @RequestMapping("/deleteArticleById")

+ 19 - 7
official_backend/src/main/java/com/hssx/ysofficial/entity/Article.java

@@ -12,11 +12,11 @@ import lombok.experimental.Accessors;
 
 /**
  * <p>
- * 
+ * 第一个数据是公司优势 其他是案例
  * </p>
  *
  * @author Reiskuchen
- * @since 2019-10-23
+ * @since 2019-10-24
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -33,35 +33,47 @@ public class Article extends Model<Article> {
     private Integer id;
 
     /**
-     * the title of articles
+     * 案例的名字
      */
     @TableField("title")
     private String title;
 
     /**
-     * the content of article
+     * 案例内容
      */
     @TableField("content")
     private String content;
 
     /**
-     * the type of article
+     * 案例种类: 公司优势或案例
      */
     @TableField("type")
     private String type;
 
     /**
-     * whether the article is sticked or not
+     * 是否显示在首页 0不显示 1显示
      */
     @TableField("sticky")
     private Integer sticky;
 
     /**
-     * the position of article in the list
+     * 位置 应该按照位置排序
      */
     @TableField("position")
     private Integer position;
 
+    /**
+     * 图片地址
+     */
+    @TableField("image_url")
+    private String imageUrl;
+
+    /**
+     * 简介
+     */
+    @TableField("introduction")
+    private String introduction;
+
 
     @Override
     protected Serializable pkVal() {

+ 20 - 2
official_backend/src/main/java/com/hssx/ysofficial/entity/BannerPictures.java

@@ -13,11 +13,11 @@ import lombok.experimental.Accessors;
 
 /**
  * <p>
- * the pictures of banner
+ * 轮播图图片
  * </p>
  *
  * @author Reiskuchen
- * @since 2019-10-23
+ * @since 2019-10-24
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -27,21 +27,39 @@ public class BannerPictures extends Model<BannerPictures> {
 
     private static final long serialVersionUID=1L;
 
+    /**
+     * id
+     */
     @TableId(value = "id", type = IdType.AUTO)
     private Integer id;
 
+    /**
+     * 轮播图url
+     */
     @TableField("url")
     private String url;
 
+    /**
+     * 轮播图文件名
+     */
     @TableField("file_name")
     private String fileName;
 
+    /**
+     * 轮播图大小
+     */
     @TableField("file_size")
     private String fileSize;
 
+    /**
+     * 轮播图文件类型
+     */
     @TableField("file_type")
     private String fileType;
 
+    /**
+     * 上传时间
+     */
     @TableField("upload_indate")
     private LocalDateTime uploadIndate;
 

+ 5 - 5
official_backend/src/main/java/com/hssx/ysofficial/entity/Comment.java

@@ -17,7 +17,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author Reiskuchen
- * @since 2019-10-23
+ * @since 2019-10-24
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -34,25 +34,25 @@ public class Comment extends Model<Comment> {
     private Integer id;
 
     /**
-     * the name of customer
+     * 留言者姓名
      */
     @TableField("name")
     private String name;
 
     /**
-     * the phone number of customer
+     * 留言者联系方式
      */
     @TableField("phone")
     private String phone;
 
     /**
-     * the main content left by customer
+     * 留言内容
      */
     @TableField("comment")
     private String comment;
 
     /**
-     * the timestamp when the customer left the message
+     * 留言时间
      */
     @TableField("indate")
     private LocalDateTime indate;

+ 17 - 2
official_backend/src/main/java/com/hssx/ysofficial/entity/Cooperations.java

@@ -12,11 +12,11 @@ import lombok.experimental.Accessors;
 
 /**
  * <p>
- * the cooperations of client company and high school
+ * 合作伙伴
  * </p>
  *
  * @author Reiskuchen
- * @since 2019-10-23
+ * @since 2019-10-24
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -29,18 +29,33 @@ public class Cooperations extends Model<Cooperations> {
     @TableId(value = "id", type = IdType.AUTO)
     private Integer id;
 
+    /**
+     * 合作者名称
+     */
     @TableField("name")
     private String name;
 
+    /**
+     * 合作者的描述
+     */
     @TableField("description")
     private String description;
 
+    /**
+     * 一张描述用的图的url
+     */
     @TableField("image_url")
     private String imageUrl;
 
+    /**
+     * 合作者种类: 学校或公司
+     */
     @TableField("type")
     private Integer type;
 
+    /**
+     * 是否显示于首页 0为不显示 1为显示
+     */
     @TableField("sticky")
     private Integer sticky;
 

+ 11 - 2
official_backend/src/main/java/com/hssx/ysofficial/entity/User.java

@@ -12,11 +12,11 @@ import lombok.experimental.Accessors;
 
 /**
  * <p>
- * 
+ * 用户
  * </p>
  *
  * @author Reiskuchen
- * @since 2019-10-23
+ * @since 2019-10-24
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -26,12 +26,21 @@ public class User extends Model<User> {
 
     private static final long serialVersionUID=1L;
 
+    /**
+     * id
+     */
     @TableId(value = "id", type = IdType.AUTO)
     private Integer id;
 
+    /**
+     * 用户名
+     */
     @TableField("username")
     private String username;
 
+    /**
+     * 密码
+     */
     @TableField("password")
     private String password;
 

+ 1 - 1
official_backend/src/main/java/com/hssx/ysofficial/mapper/ArticleMapper.java

@@ -14,5 +14,5 @@ import org.apache.ibatis.annotations.Select;
  */
 public interface ArticleMapper extends BaseMapper<Article> {
     @Select("SELECT MAX(position)+1 AS new_position FROM article;")
-    public Integer getNewPosition();
+    Integer getNewPosition();
 }

+ 2 - 1
official_backend/src/main/java/com/hssx/ysofficial/service/ArticleService.java

@@ -3,6 +3,7 @@ package com.hssx.ysofficial.service;
 import com.hssx.ysofficial.entity.Article;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.hssx.ysofficial.utility.HttpRespMsg;
+import org.springframework.web.multipart.MultipartFile;
 
 /**
  * <p>
@@ -16,7 +17,7 @@ public interface ArticleService extends IService<Article> {
     HttpRespMsg getArticleAll();
     HttpRespMsg getArticleById(Integer id);
     HttpRespMsg getArticleByType(String Type);
-    HttpRespMsg editArticle(Article article);
+    HttpRespMsg editArticle(Article article, MultipartFile multipartFile);
     HttpRespMsg deleteArticleById(Integer id);
     HttpRespMsg switchSticky(Integer id);
     HttpRespMsg switchPosition(Integer id, Integer position);

+ 31 - 2
official_backend/src/main/java/com/hssx/ysofficial/service/impl/ArticleServiceImpl.java

@@ -7,12 +7,16 @@ import com.hssx.ysofficial.service.ArticleService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.hssx.ysofficial.utility.HttpRespMsg;
 import org.hibernate.validator.constraints.EAN;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
+import java.io.File;
 import java.sql.SQLOutput;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.UUID;
 
 /**
  * <p>
@@ -24,6 +28,13 @@ import java.util.Map;
  */
 @Service
 public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {
+
+    @Value("${upload.path}")
+    private String uploadPath;
+
+    @Value("${download.path}")
+    private String downloadPath;
+
     @Resource
     private ArticleMapper articleMapper;
 
@@ -56,11 +67,29 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> impl
     }
 
     @Override
-    public HttpRespMsg editArticle(Article article){
+    public HttpRespMsg editArticle(Article article, MultipartFile multipartFile){
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         if(article != null){
             Integer id = article.getId();
-            if(id == null){
+
+            if(multipartFile != null){
+                String fileName = multipartFile.getOriginalFilename();
+                File direction = new File(uploadPath);
+                String rand = UUID.randomUUID().toString().replaceAll("-", "");
+                String suffix = fileName.substring(fileName.lastIndexOf("."));
+                String storedFileName = rand + suffix;
+                try {
+                    File savedFile = new File(direction, storedFileName);
+                    savedFile.createNewFile();
+                    multipartFile.transferTo(savedFile);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                article.setImageUrl("/upload/" + storedFileName);
+            }
+
+            if(id == -1){
+                article.setId(null);
                 article.setPosition(articleMapper.getNewPosition());
                 articleMapper.insert(article);
             }else{

+ 6 - 0
official_backend/src/main/resources/application.properties

@@ -21,6 +21,12 @@ spring.datasource.hikari.ConnectionTimeout=60000
 spring.datasource.hikari.ValidationTimeout=3000
 spring.datasource.hikari.LoginTimeout=5
 
+spring.servlet.multipart.enabled=true
+spring.servlet.multipart.file-size-threshold=0
+spring.servlet.multipart.max-file-size=100MB
+spring.servlet.multipart.max-request-size=100MB
+spring.servlet.multipart.resolve-lazily=false
+
 #ÎļþÉÏ´«Â·¾¶
 upload.path=D:/ysofficial/upload/
 

+ 3 - 1
official_backend/src/main/resources/mapper/ArticleMapper.xml

@@ -10,11 +10,13 @@
         <result column="type" property="type" />
         <result column="sticky" property="sticky" />
         <result column="position" property="position" />
+        <result column="image_url" property="imageUrl" />
+        <result column="introduction" property="introduction" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, title, content, type, sticky, position
+        id, title, content, type, sticky, position, image_url, introduction
     </sql>
 
 </mapper>

+ 1 - 13
website/src/main/java/com/hssx/website/controller/ArticleController.java

@@ -27,22 +27,10 @@ public class ArticleController {
     private CooperationsService cooperationsService;
 
     @ApiOperation("案例")
-    @GetMapping("/article")
+    @GetMapping("/index")
     public String index(Model model) {
         model = articleService.getList(model);
         return "index";
     }
-//    @GetMapping("/")
-//    public String index(Model model) {
-//        model = articleService.getList(model);
-//        return "index";
-//    }
-
-    @ApiOperation("合作伙伴")
-    @GetMapping("/cooperations")
-    public String cooperations(Model model) {
-        model = cooperationsService.getList(model);
-        return "index";
-    }
 }
 

+ 17 - 1
website/src/main/java/com/hssx/website/defaultviewconfig/DefaultView.java

@@ -1,7 +1,9 @@
 package com.hssx.website.defaultviewconfig;
 
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.core.Ordered;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
 import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
 
@@ -10,10 +12,24 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
  */
 @Configuration
 public class DefaultView extends WebMvcConfigurerAdapter {
+  @Value("${upload.path}")
+  private String path;
   @Override
   public void addViewControllers(ViewControllerRegistry registry) {
-    registry.addViewController("/").setViewName("index");
+    System.out.println("捡来++++++++++222222222222+++++");
+
+    /*将项目启动首页后提交给/index的controller来处理*/
+    registry.addViewController("/").setViewName("forward:/index");
     registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
     super.addViewControllers(registry);
   }
+  @Override
+  public void addResourceHandlers(ResourceHandlerRegistry registry) {
+    System.out.println("捡来+++++++++++++++");
+    //和页面有关的静态目录都放在项目的static目录下
+//    registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
+    //上传的图片在D盘下的OTA目录下,访问路径如:http://localhost:8081/OTA/d3cf0281-bb7f-40e0-ab77-406db95ccf2c.jpg
+    //其中OTA表示访问的前缀。"file:D:/OTA/"是文件真实的存储路径
+    registry.addResourceHandler("/upload/**").addResourceLocations("file:"+path);
+  }
 }

+ 37 - 7
website/src/main/java/com/hssx/website/entity/Article.java

@@ -8,11 +8,11 @@ import java.io.Serializable;
 
 /**
  * <p>
- * 
+ * 第一个数据是公司优势 其他是案例
  * </p>
  *
  * @author 吴涛涛
- * @since 2019-10-23
+ * @since 2019-10-24
  */
 public class Article extends Model<Article> {
 
@@ -25,35 +25,47 @@ public class Article extends Model<Article> {
     private Integer id;
 
     /**
-     * the title of articles
+     * 案例的名字
      */
     @TableField("title")
     private String title;
 
     /**
-     * the content of article
+     * 案例内容
      */
     @TableField("content")
     private String content;
 
     /**
-     * the type of article
+     * 案例种类: 公司优势或案例
      */
     @TableField("type")
     private String type;
 
     /**
-     * whether the article is sticked or not
+     * 是否显示在首页 0不显示 1显示
      */
     @TableField("sticky")
     private Integer sticky;
 
     /**
-     * the position of article in the list
+     * 位置 应该按照位置排序
      */
     @TableField("position")
     private Integer position;
 
+    /**
+     * 图片地址
+     */
+    @TableField("image_url")
+    private String imageUrl;
+
+    /**
+     * 简介
+     */
+    @TableField("introduction")
+    private String introduction;
+
 
     public Integer getId() {
         return id;
@@ -103,6 +115,22 @@ public class Article extends Model<Article> {
         this.position = position;
     }
 
+    public String getImageUrl() {
+        return imageUrl;
+    }
+
+    public void setImageUrl(String imageUrl) {
+        this.imageUrl = imageUrl;
+    }
+
+    public String getIntroduction() {
+        return introduction;
+    }
+
+    public void setIntroduction(String introduction) {
+        this.introduction = introduction;
+    }
+
     @Override
     protected Serializable pkVal() {
         return this.id;
@@ -117,6 +145,8 @@ public class Article extends Model<Article> {
         ", type=" + type +
         ", sticky=" + sticky +
         ", position=" + position +
+        ", imageUrl=" + imageUrl +
+        ", introduction=" + introduction +
         "}";
     }
 }

+ 20 - 2
website/src/main/java/com/hssx/website/entity/BannerPictures.java

@@ -9,31 +9,49 @@ import java.io.Serializable;
 
 /**
  * <p>
- * the pictures of banner
+ * 轮播图图片
  * </p>
  *
  * @author 吴涛涛
- * @since 2019-10-23
+ * @since 2019-10-24
  */
 public class BannerPictures extends Model<BannerPictures> {
 
     private static final long serialVersionUID=1L;
 
+    /**
+     * id
+     */
     @TableId(value = "id", type = IdType.AUTO)
     private Integer id;
 
+    /**
+     * 轮播图url
+     */
     @TableField("url")
     private String url;
 
+    /**
+     * 轮播图文件名
+     */
     @TableField("file_name")
     private String fileName;
 
+    /**
+     * 轮播图大小
+     */
     @TableField("file_size")
     private String fileSize;
 
+    /**
+     * 轮播图文件类型
+     */
     @TableField("file_type")
     private String fileType;
 
+    /**
+     * 上传时间
+     */
     @TableField("upload_indate")
     private LocalDateTime uploadIndate;
 

+ 5 - 5
website/src/main/java/com/hssx/website/entity/Comment.java

@@ -13,7 +13,7 @@ import java.io.Serializable;
  * </p>
  *
  * @author 吴涛涛
- * @since 2019-10-23
+ * @since 2019-10-24
  */
 public class Comment extends Model<Comment> {
 
@@ -26,25 +26,25 @@ public class Comment extends Model<Comment> {
     private Integer id;
 
     /**
-     * the name of customer
+     * 留言者姓名
      */
     @TableField("name")
     private String name;
 
     /**
-     * the phone number of customer
+     * 留言者联系方式
      */
     @TableField("phone")
     private String phone;
 
     /**
-     * the main content left by customer
+     * 留言内容
      */
     @TableField("comment")
     private String comment;
 
     /**
-     * the timestamp when the customer left the message
+     * 留言时间
      */
     @TableField("indate")
     private LocalDateTime indate;

+ 17 - 2
website/src/main/java/com/hssx/website/entity/Cooperations.java

@@ -8,11 +8,11 @@ import java.io.Serializable;
 
 /**
  * <p>
- * the cooperations of client company and high school
+ * 合作伙伴
  * </p>
  *
  * @author 吴涛涛
- * @since 2019-10-23
+ * @since 2019-10-24
  */
 public class Cooperations extends Model<Cooperations> {
 
@@ -21,18 +21,33 @@ public class Cooperations extends Model<Cooperations> {
     @TableId(value = "id", type = IdType.AUTO)
     private Integer id;
 
+    /**
+     * 合作者名称
+     */
     @TableField("name")
     private String name;
 
+    /**
+     * 合作者的描述
+     */
     @TableField("description")
     private String description;
 
+    /**
+     * 一张描述用的图的url
+     */
     @TableField("image_url")
     private String imageUrl;
 
+    /**
+     * 合作者种类: 学校或公司
+     */
     @TableField("type")
     private Integer type;
 
+    /**
+     * 是否显示于首页 0为不显示 1为显示
+     */
     @TableField("sticky")
     private Integer sticky;
 

+ 77 - 0
website/src/main/java/com/hssx/website/entity/User.java

@@ -0,0 +1,77 @@
+package com.hssx.website.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 用户
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-10-24
+ */
+public class User extends Model<User> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 用户名
+     */
+    @TableField("username")
+    private String username;
+
+    /**
+     * 密码
+     */
+    @TableField("password")
+    private String password;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+    @Override
+    public String toString() {
+        return "User{" +
+        "id=" + id +
+        ", username=" + username +
+        ", password=" + password +
+        "}";
+    }
+}

+ 16 - 0
website/src/main/java/com/hssx/website/mapper/UserMapper.java

@@ -0,0 +1,16 @@
+package com.hssx.website.mapper;
+
+import com.hssx.website.entity.User;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 用户 Mapper 接口
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-10-24
+ */
+public interface UserMapper extends BaseMapper<User> {
+
+}

+ 16 - 0
website/src/main/java/com/hssx/website/service/UserService.java

@@ -0,0 +1,16 @@
+package com.hssx.website.service;
+
+import com.hssx.website.entity.User;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 用户 服务类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-10-24
+ */
+public interface UserService extends IService<User> {
+
+}

+ 19 - 1
website/src/main/java/com/hssx/website/service/impl/ArticleServiceImpl.java

@@ -2,7 +2,13 @@ package com.hssx.website.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.hssx.website.entity.Article;
+import com.hssx.website.entity.BannerPictures;
+import com.hssx.website.entity.Comment;
+import com.hssx.website.entity.Cooperations;
 import com.hssx.website.mapper.ArticleMapper;
+import com.hssx.website.mapper.BannerPicturesMapper;
+import com.hssx.website.mapper.CommentMapper;
+import com.hssx.website.mapper.CooperationsMapper;
 import com.hssx.website.service.ArticleService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
@@ -24,11 +30,23 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> impl
 
     @Resource
     private ArticleMapper articleMapper;
+    @Resource
+    private CooperationsMapper cooperationsMapper;
+    @Resource
+    private BannerPicturesMapper bannerPicturesMapper;
+    @Resource
+    private CommentMapper commentMapper;
 
     @Override
     public Model getList(Model model) {
-        List<Article> articles = articleMapper.selectList(new QueryWrapper<Article>().orderByAsc("id"));
+        List<Article> articles = articleMapper.selectList(new QueryWrapper<Article>().orderByAsc("position"));
         model.addAttribute("articles", articles);
+        List<Cooperations> cooperations = cooperationsMapper.selectList(new QueryWrapper<Cooperations>().orderByAsc("id"));
+        model.addAttribute("cooperations", cooperations);
+        List<BannerPictures> pictures = bannerPicturesMapper.selectList(new QueryWrapper<BannerPictures>().orderByAsc("id"));
+        model.addAttribute("pictures", pictures);
+        List<Comment> comment = commentMapper.selectList(new QueryWrapper<Comment>().orderByAsc("id"));
+        model.addAttribute("comment", comment);
         return model;
     }
 }

+ 20 - 0
website/src/main/java/com/hssx/website/service/impl/UserServiceImpl.java

@@ -0,0 +1,20 @@
+package com.hssx.website.service.impl;
+
+import com.hssx.website.entity.User;
+import com.hssx.website.mapper.UserMapper;
+import com.hssx.website.service.UserService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 用户 服务实现类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-10-24
+ */
+@Service
+public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
+
+}

+ 3 - 1
website/src/main/resources/mapper/ArticleMapper.xml

@@ -10,11 +10,13 @@
         <result column="type" property="type" />
         <result column="sticky" property="sticky" />
         <result column="position" property="position" />
+        <result column="image_url" property="imageUrl" />
+        <result column="introduction" property="introduction" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, title, content, type, sticky, position
+        id, title, content, type, sticky, position, image_url, introduction
     </sql>
 
 </mapper>

+ 17 - 0
website/src/main/resources/mapper/UserMapper.xml

@@ -0,0 +1,17 @@
+<?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.hssx.website.mapper.UserMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.website.entity.User">
+        <id column="id" property="id" />
+        <result column="username" property="username" />
+        <result column="password" property="password" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, username, password
+    </sql>
+
+</mapper>

+ 73 - 66
website/src/main/resources/templates/index.html

@@ -70,9 +70,9 @@
                     <div class="home-carousel">
                         <!-- <div class="dark-mask mask-primary"></div> -->
                         <div>
-                            <div class="homepage owl-carousel">
+                            <div class="homepage owl-carousel" th:each="item : ${pictures}">
                                 <div class="item">
-                                    <img src="img/banner1.png" alt="" class="img-fluid">
+                                    <img  src="img/banner1.png" alt="" class="img-fluid">
                                 </div>
                                 <div class="item">
                                     <img src="img/banner2.png" alt="" class="img-fluid">
@@ -89,22 +89,22 @@
                     <div class="col-lg-4 col-md-6">
                     <div class="box-simple">
                         <div class="icon-outlined"><i class="fa fa-desktop"></i></div>
-                        <h3 class="h4">Webdesign</h3>
-                        <p>Fifth abundantly made Give sixth hath. Cattle creature i be don't them behold green moved fowl Moved life us beast good yielding. Have bring.</p>
+                        <h3 class="h4">原料入场</h3>
+                        <p>扫码录入仓位和物料信息,出入库记录随时查询。</p>
                     </div>
                     </div>
                     <div class="col-lg-4 col-md-6">
                     <div class="box-simple">
                         <div class="icon-outlined"><i class="fa fa-print"></i></div>
-                        <h3 class="h4">Print</h3>
-                        <p>Advantage old had otherwise sincerity dependent additions. It in adapted natural hastily is justice. Six draw you him full not mean evil. Prepare garrets it expense windows shewing do an.</p>
+                        <h3 class="h4">生产执行</h3>
+                        <p>线上即可接单、报工、扫码进行投产、生产效率数据线上直接看。</p>
                     </div>
                     </div>
                     <div class="col-lg-4 col-md-6">
                     <div class="box-simple">
                         <div class="icon-outlined"><i class="fa fa-globe"></i></div>
-                        <h3 class="h4">SEO and SEM</h3>
-                        <p>Am terminated it excellence invitation projection as. She graceful shy believed distance use nay. Lively is people so basket ladies window expect.</p>
+                        <h3 class="h4">仓库管理</h3>
+                        <p>二维码轻松完成物料入库管理,库存清晰可查。</p>
                     </div>
                     </div>
                 </div>
@@ -112,22 +112,22 @@
                     <div class="col-lg-4 col-md-6">
                     <div class="box-simple">
                         <div class="icon-outlined"><i class="fa fa-lightbulb-o"></i></div>
-                        <h3 class="h4">Consulting</h3>
-                        <p>Fifth abundantly made Give sixth hath. Cattle creature i be don't them behold green moved fowl Moved life us beast good yielding. Have bring.</p>
+                        <h3 class="h4">计划排程</h3>
+                        <p>智能分配生产设备时间、批量发生产任务到工位。</p>
                     </div>
                     </div>
                     <div class="col-lg-4 col-md-6">
                     <div class="box-simple">
                         <div class="icon-outlined"><i class="fa fa-envelope-o"></i></div>
-                        <h3 class="h4">Email Marketing</h3>
-                        <p>Advantage old had otherwise sincerity dependent additions. It in adapted natural hastily is justice. Six draw you him full not mean evil. Prepare garrets it expense windows shewing do an.</p>
+                        <h3 class="h4">图形分析报表</h3>
+                        <p>物料、生产、设备等多维度数据图形化呈现、实时查看监管监控。</p>
                     </div>
                     </div>
                     <div class="col-lg-4 col-md-6">
                     <div class="box-simple">
                         <div class="icon-outlined"><i class="fa fa-user"></i></div>
-                        <h3 class="h4">UX</h3>
-                        <p>Am terminated it excellence invitation projection as. She graceful shy believed distance use nay. Lively is people so basket ladies window expect.</p>
+                        <h3 class="h4">设备维护</h3>
+                        <p>扫码即可查看设备信息、云端配置维保计划。</p>
                     </div>
                     </div>
                 </div>
@@ -247,54 +247,60 @@
                 </div>
                 <p class="lead">Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. <a href="blog.html">Check our blog</a></p>
                 <div class="row">
-                    <div class="col-lg-3">
-                    <div class="home-blog-post">
-                        <div class="image"><img src="img/portfolio-4.jpg" alt="..." class="img-fluid">
-                        <div class="overlay d-flex align-items-center justify-content-center"><a href="#" class="btn btn-template-outlined-white"><i class="fa fa-chain"> </i> Read More</a></div>
-                        </div>
-                        <div class="text">
-                        <h4><a href="#">Fashion Now </a></h4>
-                        <p class="author-category">By <a href="#">John Snow</a> in <a href="blog.html">Webdesign</a></p>
-                        <p class="intro">Fifth abundantly made Give sixth hath. Cattle creature i be don't them behold green moved fowl Moved life us beast good yielding. Have bring.</p><a href="#" class="btn btn-template-outlined">Continue Reading</a>
-                        </div>
-                    </div>
-                    </div>
-                    <div class="col-lg-3">
-                    <div class="home-blog-post">
-                        <div class="image"><img src="img/portfolio-3.jpg" alt="..." class="img-fluid">
-                        <div class="overlay d-flex align-items-center justify-content-center"><a href="#" class="btn btn-template-outlined-white"><i class="fa fa-chain"> </i> Read More</a></div>
-                        </div>
-                        <div class="text">
-                        <h4><a href="#">What to do</a></h4>
-                        <p class="author-category">By <a href="#">John Snow</a> in <a href="blog.html">Webdesign</a></p>
-                        <p class="intro">Fifth abundantly made Give sixth hath. Cattle creature i be don't them behold green moved fowl Moved life us beast good yielding. Have bring.</p><a href="#" class="btn btn-template-outlined">Continue Reading</a>
-                        </div>
-                    </div>
-                    </div>
-                    <div class="col-lg-3">
-                    <div class="home-blog-post">
-                        <div class="image"><img src="img/portfolio-5.jpg" alt="..." class="img-fluid">
-                        <div class="overlay d-flex align-items-center justify-content-center"><a href="#" class="btn btn-template-outlined-white"><i class="fa fa-chain"> </i> Read More</a></div>
-                        </div>
-                        <div class="text">
-                        <h4><a href="#">5 ways to look awesome</a></h4>
-                        <p class="author-category">By <a href="#">John Snow</a> in <a href="blog.html">Webdesign</a></p>
-                        <p class="intro">Fifth abundantly made Give sixth hath. Cattle creature i be don't them behold green moved fowl Moved life us beast good yielding. Have bring.</p><a href="#" class="btn btn-template-outlined">Continue Reading</a>
-                        </div>
-                    </div>
-                    </div>
-                    <div class="col-lg-3">
-                    <div class="home-blog-post">
-                        <div class="image"><img src="img/portfolio-6.jpg" alt="..." class="img-fluid">
-                        <div class="overlay d-flex align-items-center justify-content-center"><a href="#" class="btn btn-template-outlined-white"><i class="fa fa-chain"> </i> Read More</a></div>
-                        </div>
-                        <div class="text">
-                        <h4><a href="#">Fashion Now </a></h4>
-                        <p class="author-category">By <a href="#">John Snow</a> in <a href="blog.html">Webdesign</a></p>
-                        <p class="intro">Fifth abundantly made Give sixth hath. Cattle creature i be don't them behold green moved fowl Moved life us beast good yielding. Have bring.</p><a href="#" class="btn btn-template-outlined">Continue Reading</a>
+                    <div class="col-lg-3" th:each="item : ${articles}">
+                        <div class="home-blog-post" >
+                            <div class="image"><img  th:src="${{item.imageUrl}}" src="img/portfolio-4.jpg" alt="..." class="img-fluid">
+                                <div class="overlay d-flex align-items-center justify-content-center">
+                                    <!--<a href="#" class="btn btn-template-outlined-white">-->
+                                        <i class="fa fa-chain"> </i> Read More</a></div>
+                            </div>
+                            <div class="text">
+                                <h4><a href="#">Fashion Now </a></h4>
+                                <p class="author-category" th:text="${{item.title}}">
+                                     <!--By <a href="#">John Snow</a> in <a href="blog.html">Webdesign</a>-->
+                                </p>
+                                <!--这里的 th:utext 是对html标签进行转译 -->
+                                <p class="intro" th:utext="${{item.content}}">Fifth abundantly made Give sixth hath. Cattle creature i be don't them behold green moved fowl Moved life us beast good yielding. Have bring.</p>
+                                <!--<a href="#" class="btn btn-template-outlined">Continue Reading</a>-->
+                            </div>
                         </div>
                     </div>
-                    </div>
+                    <!--<div class="col-lg-3">-->
+                    <!--<div class="home-blog-post">-->
+                        <!--<div class="image"><img src="img/portfolio-3.jpg" alt="..." class="img-fluid">-->
+                        <!--<div class="overlay d-flex align-items-center justify-content-center"><a href="#" class="btn btn-template-outlined-white"><i class="fa fa-chain"> </i> Read More</a></div>-->
+                        <!--</div>-->
+                        <!--<div class="text">-->
+                        <!--<h4><a href="#">What to do</a></h4>-->
+                        <!--<p class="author-category">By <a href="#">John Snow</a> in <a href="blog.html">Webdesign</a></p>-->
+                        <!--<p class="intro">Fifth abundantly made Give sixth hath. Cattle creature i be don't them behold green moved fowl Moved life us beast good yielding. Have bring.</p><a href="#" class="btn btn-template-outlined">Continue Reading</a>-->
+                        <!--</div>-->
+                    <!--</div>-->
+                    <!--</div>-->
+                    <!--<div class="col-lg-3">-->
+                    <!--<div class="home-blog-post">-->
+                        <!--<div class="image"><img src="img/portfolio-5.jpg" alt="..." class="img-fluid">-->
+                        <!--<div class="overlay d-flex align-items-center justify-content-center"><a href="#" class="btn btn-template-outlined-white"><i class="fa fa-chain"> </i> Read More</a></div>-->
+                        <!--</div>-->
+                        <!--<div class="text">-->
+                        <!--<h4><a href="#">5 ways to look awesome</a></h4>-->
+                        <!--<p class="author-category">By <a href="#">John Snow</a> in <a href="blog.html">Webdesign</a></p>-->
+                        <!--<p class="intro">Fifth abundantly made Give sixth hath. Cattle creature i be don't them behold green moved fowl Moved life us beast good yielding. Have bring.</p><a href="#" class="btn btn-template-outlined">Continue Reading</a>-->
+                        <!--</div>-->
+                    <!--</div>-->
+                    <!--</div>-->
+                    <!--<div class="col-lg-3">-->
+                    <!--<div class="home-blog-post">-->
+                        <!--<div class="image"><img src="img/portfolio-6.jpg" alt="..." class="img-fluid">-->
+                        <!--<div class="overlay d-flex align-items-center justify-content-center"><a href="#" class="btn btn-template-outlined-white"><i class="fa fa-chain"> </i> Read More</a></div>-->
+                        <!--</div>-->
+                        <!--<div class="text">-->
+                        <!--<h4><a href="#">Fashion Now </a></h4>-->
+                        <!--<p class="author-category">By <a href="#">John Snow</a> in <a href="blog.html">Webdesign</a></p>-->
+                        <!--<p class="intro">Fifth abundantly made Give sixth hath. Cattle creature i be don't them behold green moved fowl Moved life us beast good yielding. Have bring.</p><a href="#" class="btn btn-template-outlined">Continue Reading</a>-->
+                        <!--</div>-->
+                    <!--</div>-->
+                    <!--</div>-->
                 </div>
                 </div>
             </section>
@@ -304,12 +310,13 @@
                     <h2>Our Clients</h2>
                 </div>
                 <ul class="list-unstyled owl-carousel customers no-mb">
-                    <li class="item"><img src="img/customer-1.png" alt="" class="img-fluid"></li>
-                    <li class="item"><img src="img/customer-2.png" alt="" class="img-fluid"></li>
-                    <li class="item"><img src="img/customer-3.png" alt="" class="img-fluid"></li>
-                    <li class="item"><img src="img/customer-4.png" alt="" class="img-fluid"></li>
-                    <li class="item"><img src="img/customer-5.png" alt="" class="img-fluid"></li>
-                    <li class="item"><img src="img/customer-6.png" alt="" class="img-fluid"></li>
+
+                    <li class="item" th:each="item : ${cooperations}"><img th:src="${{item.imageUrl}}" src="img/customer-1.png" alt="" class="img-fluid"></li>
+                    <!--<li class="item"><img src="img/customer-2.png" alt="" class="img-fluid"></li>-->
+                    <!--<li class="item"><img src="img/customer-3.png" alt="" class="img-fluid"></li>-->
+                    <!--<li class="item"><img src="img/customer-4.png" alt="" class="img-fluid"></li>-->
+                    <!--<li class="item"><img src="img/customer-5.png" alt="" class="img-fluid"></li>-->
+                    <!--<li class="item"><img src="img/customer-6.png" alt="" class="img-fluid"></li>-->
                 </ul>
                 </div>
             </section>