瀏覽代碼

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

ZhouRuiTing 5 年之前
父節點
當前提交
7518be55a4

+ 7 - 0
official_backend/src/main/java/com/hssx/ysofficial/controller/CooperationsController.java

@@ -33,6 +33,13 @@ public class CooperationsController {
         return cooperationsService.getCooperations();
     }
 
+    /**
+     * 添加合作者
+     * name 合作者名称
+     * description 合作者描述
+     * type 合作者种类 0-联合开发 1-材料供应商 2-芯片及PCB版合作伙伴 3-软件合作伙伴 4-投融资服务机构
+     * multipartFile 合作者图片
+     */
     @RequestMapping("/addCooperation")
     public HttpRespMsg addCooperation(
             Cooperations cooperations,

+ 1 - 1
official_backend/src/main/java/com/hssx/ysofficial/service/impl/CooperationsServiceImpl.java

@@ -59,7 +59,7 @@ public class CooperationsServiceImpl extends ServiceImpl<CooperationsMapper, Coo
             cooperations.setImageUrl("/upload/" + storedFileName);
             cooperationsMapper.insert(cooperations);
         }else{
-            httpRespMsg.setError("lack of file or information");
+            httpRespMsg.setError("缺少数据");
         }
         return httpRespMsg;
     }

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

@@ -37,6 +37,7 @@ public class ArticleController {
     private CommentService commentService;
     @Autowired
     private OnlineApplicationService onlineApplicationService;
+
     @ApiOperation("案例")
     @GetMapping("/index")
     public String index(Model model) {
@@ -47,7 +48,6 @@ public class ArticleController {
     @ApiOperation("公司产品")
     @GetMapping("/goods")
     public String goods(Model model) {
-        System.out.println("开始加载接口");
         model = articleService.getGoodsList(model);
         return "goods";
     }
@@ -65,16 +65,18 @@ public class ArticleController {
     public HttpRespMsg addComment(Comment comment) {
         return commentService.saveCommit(comment);
     }
+
     @ApiOperation("在线申请")
     @PostMapping("/onlineApply")
     @ResponseBody
     public HttpRespMsg onlineApply(OnlineApplication onlineApplication) {
         onlineApplicationService.save(onlineApplication);
-        return  new HttpRespMsg();
+        return new HttpRespMsg();
     }
 
     /**
      * 参数:pageNum 当前页码,pageSize 每页条数
+     *
      * @param page
      * @return
      */
@@ -84,7 +86,5 @@ public class ArticleController {
     public HttpRespMsg onlineApplyList(PageUtil page) {
         return onlineApplicationService.getList(page);
     }
-
-
 }
 

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

@@ -28,7 +28,7 @@ public class Cooperations extends Model<Cooperations> {
     private String name;
 
     /**
-     * 合作者描述
+     * 合作者描述
      */
     @TableField("description")
     private String description;
@@ -40,13 +40,13 @@ public class Cooperations extends Model<Cooperations> {
     private String imageUrl;
 
     /**
-     * 合作者种类: 学校或公司
+     * 合作者种类 0-联合开发 1-材料供应商 2-芯片及PCB版合作伙伴 3-软件合作伙伴 4-投融资服务机构
      */
     @TableField("type")
     private Integer type;
 
     /**
-     * 是否显示于首页 0为不显示 1为显示
+     * 是否显示于首页 0-不显示 1-显示
      */
     @TableField("sticky")
     private Integer sticky;

+ 9 - 0
website/src/main/java/com/hssx/website/entity/vo/CooperationsVO.java

@@ -0,0 +1,9 @@
+package com.hssx.website.entity.vo;
+
+import com.hssx.website.entity.Cooperations;
+import lombok.Data;
+
+@Data
+public class CooperationsVO extends Cooperations {
+    private String typeName;
+}

+ 1 - 1
website/src/main/java/com/hssx/website/service/ArticleService.java

@@ -6,7 +6,7 @@ import org.springframework.ui.Model;
 
 /**
  * <p>
- *  服务类
+ * 服务类
  * </p>
  *
  * @author 吴涛涛

+ 3 - 4
website/src/main/java/com/hssx/website/service/impl/ArticleServiceImpl.java

@@ -1,11 +1,10 @@
 package com.hssx.website.service.impl;
-import	java.lang.ref.Reference;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.hssx.website.entity.*;
 import com.hssx.website.mapper.*;
 import com.hssx.website.service.ArticleService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 import org.springframework.ui.Model;
 
@@ -14,7 +13,7 @@ import java.util.List;
 
 /**
  * <p>
- *  服务实现类
+ * 服务实现类
  * </p>
  *
  * @author 吴涛涛
@@ -52,7 +51,7 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> impl
 
     @Override
     public Model getGoodsList(Model model) {
-        model.addAttribute("companyProducts",companyProductsMapper.selectList(new QueryWrapper<CompanyProducts>().orderByDesc("id")));
+        model.addAttribute("companyProducts", companyProductsMapper.selectList(new QueryWrapper<CompanyProducts>().orderByDesc("id")));
         return model;
     }
 }

+ 45 - 5
website/src/main/java/com/hssx/website/service/impl/UserServiceImpl.java

@@ -2,14 +2,19 @@ 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.Cooperations;
 import com.hssx.website.entity.User;
+import com.hssx.website.entity.vo.CooperationsVO;
 import com.hssx.website.mapper.*;
 import com.hssx.website.service.UserService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.ui.Model;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * <p>
@@ -31,27 +36,62 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
     private CommentMapper commentMapper;
 
     @Override
-    public Model getAdvantage(Model model){
+    public Model getAdvantage(Model model) {
         model.addAttribute("advantage", articleMapper.selectOne(
                 new QueryWrapper<Article>().eq("type", "advantage")));
         return model;
     }
 
     @Override
-    public Model getCooperation(Model model){
-        model.addAttribute("partners", cooperationsMapper.selectList(new QueryWrapper<>()));
+    public Model getCooperation(Model model) {
+        List<Cooperations> list = cooperationsMapper.selectList(new QueryWrapper<>());
+        List<CooperationsVO> resultList = new ArrayList<>();
+        for (Cooperations cooperations : list) {
+            CooperationsVO cooperationsVO = new CooperationsVO();
+            BeanUtils.copyProperties(cooperations, cooperationsVO);
+            Integer type = cooperations.getType();
+            String typeName;
+            switch (type) {
+                case 0: {
+                    typeName = "联合开发";
+                    break;
+                }
+                case 1: {
+                    typeName = "材料供应商";
+                    break;
+                }
+                case 2: {
+                    typeName = "芯片及PCB版合作伙伴";
+                    break;
+                }
+                case 3: {
+                    typeName = "软件合作伙伴";
+                    break;
+                }
+                case 4: {
+                    typeName = "投融资服务机构";
+                    break;
+                }
+                default: {
+                    typeName = "联合开发";
+                }
+            }
+            cooperationsVO.setTypeName(typeName);
+            resultList.add(cooperationsVO);
+        }
+        model.addAttribute("partners", resultList);
         return model;
     }
 
     @Override
-    public Model getCase(Model model){
+    public Model getCase(Model model) {
         model.addAttribute("cases", articleMapper.selectList(new QueryWrapper<Article>()
                 .eq("type", "case").orderByAsc("position")));
         return model;
     }
 
     @Override
-    public Model getDetail(Model model, Integer id){
+    public Model getDetail(Model model, Integer id) {
         model.addAttribute("detail", articleMapper.selectById(id));
         return model;
     }

+ 1 - 1
website/src/main/resources/templates/partner.html

@@ -87,7 +87,7 @@
                                     </div>
                                     <div class="content">
                                         <h4><span href="#" th:text="${item.name}">Print</span></h4>
-                                        <p th:text="${item.description}"></p>
+                                        <p th:text="${item.typeName}"></p>
                                     </div>
                                 </div>
                             </div>