|
@@ -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;
|
|
|
}
|