Selaa lähdekoodia

添加资产编号

5 vuotta sitten
vanhempi
commit
1deffcefe2

+ 37 - 0
pcbms/src/main/java/com/hssx/pcbms/controller/ScoreController.java

@@ -6,6 +6,7 @@ import com.hssx.pcbms.entity.Score;
 import com.hssx.pcbms.entity.vo.IdeaVO;
 import com.hssx.pcbms.service.ScoreService;
 import com.hssx.pcbms.util.HttpRespMsg;
+import com.hssx.pcbms.util.PageUtil;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -50,6 +51,42 @@ public class ScoreController {
         }
         return msg;
     }
+    /**
+     * 我的评分
+     * 参数:
+     * uid :被打分人的id
+     * @return
+     */
+    @ApiOperation(value = "我的评分", notes = "我的评分方法")
+    @RequestMapping("/myList")
+    @ResponseBody
+    public HttpRespMsg myList(Score score, PageUtil page) {
+        HttpRespMsg msg = new HttpRespMsg();
+        try {
+             msg = scoreService.getList(score,page);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return msg;
+    }
+    /**
+     * 评分详情
+     * 参数:
+     * scoreId :打分id
+     * @return
+     */
+    @ApiOperation(value = "评分详情", notes = "评分详情方法")
+    @RequestMapping("/detail")
+    @ResponseBody
+    public HttpRespMsg detail(Score score) {
+        HttpRespMsg msg = new HttpRespMsg();
+        try {
+             msg = scoreService.detail(score);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return msg;
+    }
 
 }
 

+ 4 - 0
pcbms/src/main/java/com/hssx/pcbms/entity/vo/ScoreVO.java

@@ -1,8 +1,11 @@
 package com.hssx.pcbms.entity.vo;
 
+import com.hssx.pcbms.entity.Idea;
 import com.hssx.pcbms.entity.Score;
 import lombok.Data;
 
+import java.util.List;
+
 /**
  * Author: 吴涛涛 cuiyi@itany.com
  * Date : 2019 - 11 - 04 10:07
@@ -12,5 +15,6 @@ import lombok.Data;
 @Data
 public class ScoreVO extends Score {
     private String time;
+    private List<IdeaVO> ideaVO;
 
 }

+ 5 - 0
pcbms/src/main/java/com/hssx/pcbms/service/ScoreService.java

@@ -3,6 +3,7 @@ package com.hssx.pcbms.service;
 import com.hssx.pcbms.entity.Score;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.hssx.pcbms.util.HttpRespMsg;
+import com.hssx.pcbms.util.PageUtil;
 
 import java.text.ParseException;
 
@@ -17,4 +18,8 @@ import java.text.ParseException;
 public interface ScoreService extends IService<Score> {
 
     HttpRespMsg add(Score score) throws ParseException;
+
+    HttpRespMsg getList(Score score,PageUtil page);
+
+    HttpRespMsg detail(Score score);
 }

+ 37 - 3
pcbms/src/main/java/com/hssx/pcbms/service/impl/ScoreServiceImpl.java

@@ -1,16 +1,21 @@
 package com.hssx.pcbms.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.hssx.pcbms.constant.Constant;
+import com.hssx.pcbms.entity.Idea;
 import com.hssx.pcbms.entity.Parameter;
 import com.hssx.pcbms.entity.Score;
 import com.hssx.pcbms.entity.User;
-import com.hssx.pcbms.mapper.ParameterMapper;
-import com.hssx.pcbms.mapper.ScoreMapper;
-import com.hssx.pcbms.mapper.UserMapper;
+import com.hssx.pcbms.entity.vo.IdeaVO;
+import com.hssx.pcbms.entity.vo.ScoreVO;
+import com.hssx.pcbms.mapper.*;
 import com.hssx.pcbms.service.ScoreService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.hssx.pcbms.util.HttpRespMsg;
+import com.hssx.pcbms.util.PageUtil;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.web.bind.annotation.RequestParam;
 
@@ -20,6 +25,7 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
+import java.util.List;
 
 /**
  * @author 吴涛涛
@@ -33,6 +39,10 @@ public class ScoreServiceImpl extends ServiceImpl<ScoreMapper, Score> implements
     private ParameterMapper parameterMapper;
     @Resource
     private UserMapper userMapper;
+    @Resource
+    private IdeaMapper ideaMapper;
+    @Resource
+    private IdeaCommentMapper ideaCommentMapper;
 
     @Override
     public HttpRespMsg add(Score score) throws ParseException {
@@ -75,6 +85,30 @@ public class ScoreServiceImpl extends ServiceImpl<ScoreMapper, Score> implements
         return msg;
     }
 
+    @Override
+    public HttpRespMsg getList(Score score,PageUtil page) {
+        HttpRespMsg msg = new HttpRespMsg();
+        PageHelper.startPage(page.getPageNum(),page.getPageSize());
+        List<Score> scores = scoreMapper.selectList(new QueryWrapper<Score>().eq("uid",score.getUid()).orderByDesc("score_id"));
+        PageInfo<Score> info = new PageInfo<>(scores);
+        msg.data = info;
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg detail(Score score) {
+        HttpRespMsg msg = new HttpRespMsg();
+        ScoreVO vo = new ScoreVO();
+        Score oldScore = scoreMapper.selectById(score.getScoreId());
+        BeanUtils.copyProperties(oldScore,vo);
+        Idea idea = new Idea();
+        idea.setScoreId(score.getScoreId());
+        List<IdeaVO> ideaVos = ideaMapper.getIdeaListByUid(idea, null);
+        vo.setIdeaVO(ideaVos);
+        msg.data = vo;
+        return msg;
+    }
+
     private HttpRespMsg addScore(Date yearMonth, Date nowDate, Integer type, Score score,Score oldScore) {
         HttpRespMsg msg = new HttpRespMsg();
         //评分上个月

+ 7 - 2
pcbms/src/main/resources/mapper/IdeaMapper.xml

@@ -48,10 +48,15 @@
         left join idea_comment ic
         on i.id = ic.idea_id
         <where>
-            i.uid = #{idea.uid,jdbcType=INTEGER}
+            <if test="idea.uid != null">
+                i.uid = #{idea.uid,jdbcType=INTEGER}
+            </if>
             <if test="time != null">
                and date_format(i.indate,'%Y-%m') = #{time}
             </if>
+            <if test="idea.scoreId != null">
+                and score_id = #{idea.scoreId}
+            </if>
         </where>
         order by i.indate desc
     </select>
@@ -67,7 +72,7 @@
                and date_format(i.indate,'%Y-%m') = #{time}
             </if>
             <if test="ideaVO.scoreId != null">
-               and date_format(i.indate,'%Y-%m') = #{time}
+               and score_id = #{ideaVO.scoreId}
             </if>
         </where>
         order by i.indate desc