浏览代码

建议、建议打分、回复

5 年之前
父节点
当前提交
ea8a5a1b33
共有 25 个文件被更改,包括 1059 次插入45 次删除
  1. 7 26
      pcbms/src/main/java/com/hssx/pcbms/controller/GoodsController.java
  2. 59 0
      pcbms/src/main/java/com/hssx/pcbms/controller/IdeaCommentController.java
  3. 86 0
      pcbms/src/main/java/com/hssx/pcbms/controller/IdeaController.java
  4. 46 0
      pcbms/src/main/java/com/hssx/pcbms/controller/ScoreController.java
  5. 156 0
      pcbms/src/main/java/com/hssx/pcbms/entity/Idea.java
  6. 126 0
      pcbms/src/main/java/com/hssx/pcbms/entity/IdeaComment.java
  7. 167 0
      pcbms/src/main/java/com/hssx/pcbms/entity/Score.java
  8. 18 0
      pcbms/src/main/java/com/hssx/pcbms/entity/vo/IdeaVO.java
  9. 1 1
      pcbms/src/main/java/com/hssx/pcbms/mapper/GoodsMapper.java
  10. 16 0
      pcbms/src/main/java/com/hssx/pcbms/mapper/IdeaCommentMapper.java
  11. 21 0
      pcbms/src/main/java/com/hssx/pcbms/mapper/IdeaMapper.java
  12. 16 0
      pcbms/src/main/java/com/hssx/pcbms/mapper/ScoreMapper.java
  13. 1 3
      pcbms/src/main/java/com/hssx/pcbms/service/GoodsService.java
  14. 20 0
      pcbms/src/main/java/com/hssx/pcbms/service/IdeaCommentService.java
  15. 25 0
      pcbms/src/main/java/com/hssx/pcbms/service/IdeaService.java
  16. 18 0
      pcbms/src/main/java/com/hssx/pcbms/service/ScoreService.java
  17. 2 14
      pcbms/src/main/java/com/hssx/pcbms/service/impl/GoodsServiceImpl.java
  18. 69 0
      pcbms/src/main/java/com/hssx/pcbms/service/impl/IdeaCommentServiceImpl.java
  19. 79 0
      pcbms/src/main/java/com/hssx/pcbms/service/impl/IdeaServiceImpl.java
  20. 20 0
      pcbms/src/main/java/com/hssx/pcbms/service/impl/ScoreServiceImpl.java
  21. 1 1
      pcbms/src/main/java/com/hssx/pcbms/util/CodeGenerator.java
  22. 3 0
      pcbms/src/main/resources/mapper/GoodsMapper.xml
  23. 20 0
      pcbms/src/main/resources/mapper/IdeaCommentMapper.xml
  24. 59 0
      pcbms/src/main/resources/mapper/IdeaMapper.xml
  25. 23 0
      pcbms/src/main/resources/mapper/ScoreMapper.xml

+ 7 - 26
pcbms/src/main/java/com/hssx/pcbms/controller/GoodsController.java

@@ -4,9 +4,7 @@ package com.hssx.pcbms.controller;
 import com.hssx.pcbms.entity.*;
 import com.hssx.pcbms.entity.vo.GoodsVO;
 import com.hssx.pcbms.entity.vo.MaintainRecordVO;
-import com.hssx.pcbms.entity.vo.OperateRecordVO;
 import com.hssx.pcbms.service.GoodsService;
-import com.hssx.pcbms.util.FileUtil;
 import com.hssx.pcbms.util.HttpRespMsg;
 import com.hssx.pcbms.util.PageUtil;
 import com.hssx.pcbms.util.UploadFileToFileNameUtil;
@@ -15,15 +13,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
-
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
-import javax.annotation.Resource;
-import java.io.File;
-
 /**
  * @author 吴涛涛
  * @since 2019-10-25
@@ -102,13 +95,16 @@ public class GoodsController {
      * 参数:
      * name :名称,keyName:关键字,pageNum:当前页,pageSize:每页多少条
      * tagId:标签id(单个标签)(查看全部不传)
+     * uid :查看我的资产时传当前人的id
      * @return
      */
     @ApiOperation(value = "资产列表", notes = "资产列表方法")
     @RequestMapping("/list")
     @ResponseBody
-    public HttpRespMsg list(PageUtil page, @RequestParam(required = false) String keyName, @RequestParam(required = false)Integer tagId) {
-        HttpRespMsg msg = goodsService.getList(page, keyName, tagId);
+    public HttpRespMsg list(PageUtil page, @RequestParam(required = false) String keyName,
+                            @RequestParam(required = false)Integer tagId,
+                            @RequestParam(required = false)Integer uid) {
+        HttpRespMsg msg = goodsService.getList(page, keyName, tagId,uid);
         return msg;
     }
 
@@ -199,21 +195,6 @@ public class GoodsController {
         return msg;
     }
 
-    /**
-     * 资产编号删除
-     * 参数:
-     * id:对应编号的id
-     *
-     * @return
-     */
-    @ApiOperation(value = "资产编号删除", notes = "资产编号删除方法")
-    @RequestMapping("/goodsNodel")
-    @ResponseBody
-    public HttpRespMsg goodsNodel(GoodsNo goodsNo) {
-        HttpRespMsg msg = goodsService.goodsNodel(goodsNo);
-        return msg;
-    }
-
     /**
      * 资产编号添加
      * 参数:
@@ -232,7 +213,7 @@ public class GoodsController {
     /**
      * 处置资产操作记录
      * 参数:
-     * id:资产id,
+     * id:资产id,pageNum:当前页,pageSize:每页多少条
      *
      * @return
      */
@@ -275,7 +256,7 @@ public class GoodsController {
     /**
      * 维护资产记录
      * 参数:
-     * id:资产id
+     * id:资产id,pageNum:当前页,pageSize:每页多少条
      *
      * @return
      */

+ 59 - 0
pcbms/src/main/java/com/hssx/pcbms/controller/IdeaCommentController.java

@@ -0,0 +1,59 @@
+package com.hssx.pcbms.controller;
+
+
+import com.hssx.pcbms.entity.Idea;
+import com.hssx.pcbms.entity.IdeaComment;
+import com.hssx.pcbms.service.IdeaCommentService;
+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;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-11-02
+ */
+@Controller
+@RequestMapping("/ideacomment")
+public class IdeaCommentController {
+    @Autowired
+    private IdeaCommentService ideaCommentService;
+
+    /**
+     * 添加/修改回复建议(给建议打分)
+     * 参数:ideaId:建议的id,content:回复的内容(没有内容默认传“暂无回复”),responderId:回复人的id,score 建议打分数(-10.0-10.0)
+     *  注:修改时 id:回复建议的id(以上参数不修改的不传)
+     * @return
+     */
+    @ApiOperation(value = "添加/修改回复建议", notes = "添加/修改回复建议方法")
+    @RequestMapping("/addOrUpdate")
+    @ResponseBody
+    public HttpRespMsg addOrUpdate(IdeaComment ideaComment,@RequestParam(required = false) Double score) {
+        HttpRespMsg msg = ideaCommentService.addOrUpdate(ideaComment,score);
+        return msg;
+    }
+    /**
+     * 删除建议回复
+     * 参数:id:回复建议的id
+     * @return
+     */
+    @ApiOperation(value = "删除建议回复", notes = "删除建议回复方法")
+    @RequestMapping("/del")
+    @ResponseBody
+    public HttpRespMsg del(IdeaComment ideaComment) {
+        HttpRespMsg msg = ideaCommentService.del(ideaComment);
+        return msg;
+    }
+
+}
+

+ 86 - 0
pcbms/src/main/java/com/hssx/pcbms/controller/IdeaController.java

@@ -0,0 +1,86 @@
+package com.hssx.pcbms.controller;
+
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.hssx.pcbms.entity.Idea;
+import com.hssx.pcbms.entity.vo.GoodsVO;
+import com.hssx.pcbms.service.IdeaService;
+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;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author 吴涛涛
+ * @since 2019-11-02
+ */
+@Controller
+@RequestMapping("/idea")
+public class IdeaController {
+
+    @Autowired
+    private IdeaService ideaService;
+    /**
+     * 建议的发表/修改
+     * 参数:
+     * uid :当前发表人的id,content:建议的内容,isDraft:(提交传0 退出传1)
+     * 注:修改时传 id:建议的id(以上参数isDraft也需要传)
+     * @return
+     */
+    @ApiOperation(value = "建议的发表/修改", notes = "建议的发表/修改方法")
+    @RequestMapping("/addOrUpdate")
+    @ResponseBody
+    public HttpRespMsg addOrUpdate(Idea idea) {
+        HttpRespMsg msg = ideaService.add(idea);
+        return msg;
+    }
+
+    /**
+     * 删除建议
+     * 参数:
+     * id:建议的id
+     * @return
+     */
+    @ApiOperation(value = "删除建议", notes = "删除建议方法")
+    @RequestMapping("/del")
+    @ResponseBody
+    public HttpRespMsg del(Idea idea) {
+        HttpRespMsg msg = ideaService.del(idea);
+        return msg;
+    }
+
+    /**
+     * 建议列表
+     * 参数:
+     * uid:用户id,pageNum:当前页,pageSize:每页多少条
+     * @return
+     */
+    @ApiOperation(value = "建议列表", notes = "建议列表方法")
+    @RequestMapping("/ideaList")
+    @ResponseBody
+    public HttpRespMsg ideaList(Idea idea, PageUtil page) {
+        HttpRespMsg msg = ideaService.ideaList(idea,page);
+        return msg;
+    }
+    /**
+     * 打分根据年月去获取他的建议列表
+     * 参数:
+     * uid:用户id,time:时间 如:2019-8
+     * @return
+     */
+    @ApiOperation(value = "打分根据年月去获取他的建议列表", notes = "打分根据年月去获取他的建议列表方法")
+    @RequestMapping("/ideaListByTime")
+    @ResponseBody
+    public HttpRespMsg ideaListByTime(Idea idea,String time) {
+        HttpRespMsg msg = ideaService.ideaListByTime(idea,time);
+        return msg;
+    }
+
+
+}
+

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

@@ -0,0 +1,46 @@
+package com.hssx.pcbms.controller;
+
+
+import com.hssx.pcbms.entity.Idea;
+import com.hssx.pcbms.entity.Score;
+import com.hssx.pcbms.service.ScoreService;
+import com.hssx.pcbms.util.HttpRespMsg;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-11-02
+ */
+@Controller
+@RequestMapping("/score")
+public class ScoreController {
+    @Autowired
+    private ScoreService scoreService;
+
+    /**
+     * 打分/修改打分
+     * 参数:
+     * uid :当前发表人的id,personalScore:个人分,ideaScore:建议分
+     * 注:修改时传 id:建议的id(以上参数isDraft也需要传)
+     * @return
+     */
+    @ApiOperation(value = "打分/修改打分", notes = "打分/修改打分方法")
+    @RequestMapping("/addOrUpdate")
+    @ResponseBody
+    public HttpRespMsg addOrUpdate(Score score) {
+        HttpRespMsg msg = scoreService.add(score);
+        return msg;
+    }
+
+}
+

+ 156 - 0
pcbms/src/main/java/com/hssx/pcbms/entity/Idea.java

@@ -0,0 +1,156 @@
+package com.hssx.pcbms.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-11-02
+ */
+public class Idea extends Model<Idea> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 建议表主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 用户id
+     */
+    @TableField("uid")
+    private Integer uid;
+
+    /**
+     * 发表时间
+     */
+    @TableField("indate")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime indate;
+
+    /**
+     * 建议内容
+     */
+    @TableField("content")
+    private String content;
+
+    /**
+     * 得分
+     */
+    @TableField("score")
+    private Double score;
+
+    /**
+     * 是否是草稿0-不是 1-是
+     */
+    @TableField("is_draft")
+    private Integer isDraft;
+
+    /**
+     * 是否已评分 0-否 1-是
+     */
+    @TableField("is_evaluated")
+    private Integer isEvaluated;
+
+    /**
+     * 评分外键
+     */
+    @TableField("score_id")
+    private Integer scoreId;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getUid() {
+        return uid;
+    }
+
+    public void setUid(Integer uid) {
+        this.uid = uid;
+    }
+
+    public LocalDateTime getIndate() {
+        return indate;
+    }
+
+    public void setIndate(LocalDateTime indate) {
+        this.indate = indate;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public Double getScore() {
+        return score;
+    }
+
+    public void setScore(Double score) {
+        this.score = score;
+    }
+
+    public Integer getIsDraft() {
+        return isDraft;
+    }
+
+    public void setIsDraft(Integer isDraft) {
+        this.isDraft = isDraft;
+    }
+
+    public Integer getIsEvaluated() {
+        return isEvaluated;
+    }
+
+    public void setIsEvaluated(Integer isEvaluated) {
+        this.isEvaluated = isEvaluated;
+    }
+
+    public Integer getScoreId() {
+        return scoreId;
+    }
+
+    public void setScoreId(Integer scoreId) {
+        this.scoreId = scoreId;
+    }
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+    @Override
+    public String toString() {
+        return "Idea{" +
+        "id=" + id +
+        ", uid=" + uid +
+        ", indate=" + indate +
+        ", content=" + content +
+        ", score=" + score +
+        ", isDraft=" + isDraft +
+        ", isEvaluated=" + isEvaluated +
+        ", scoreId=" + scoreId +
+        "}";
+    }
+}

+ 126 - 0
pcbms/src/main/java/com/hssx/pcbms/entity/IdeaComment.java

@@ -0,0 +1,126 @@
+package com.hssx.pcbms.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-11-02
+ */
+public class IdeaComment extends Model<IdeaComment> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 建议回复表主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 建议表外键
+     */
+    @TableField("idea_id")
+    private Integer ideaId;
+
+    /**
+     * 对于建议的回复
+     */
+    @TableField("content")
+    private String content;
+
+    /**
+     * 回复人的id
+     */
+    @TableField("responder_id")
+    private Integer responderId;
+
+    /**
+     * 回复人的名字
+     */
+    @TableField("responder")
+    private String responder;
+
+    /**
+     * 回复时间
+     */
+    @TableField("indate")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime indate;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getIdeaId() {
+        return ideaId;
+    }
+
+    public void setIdeaId(Integer ideaId) {
+        this.ideaId = ideaId;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public Integer getResponderId() {
+        return responderId;
+    }
+
+    public void setResponderId(Integer responderId) {
+        this.responderId = responderId;
+    }
+
+    public String getResponder() {
+        return responder;
+    }
+
+    public void setResponder(String responder) {
+        this.responder = responder;
+    }
+
+    public LocalDateTime getIndate() {
+        return indate;
+    }
+
+    public void setIndate(LocalDateTime indate) {
+        this.indate = indate;
+    }
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+    @Override
+    public String toString() {
+        return "IdeaComment{" +
+        "id=" + id +
+        ", ideaId=" + ideaId +
+        ", content=" + content +
+        ", responderId=" + responderId +
+        ", responder=" + responder +
+        ", indate=" + indate +
+        "}";
+    }
+}

+ 167 - 0
pcbms/src/main/java/com/hssx/pcbms/entity/Score.java

@@ -0,0 +1,167 @@
+package com.hssx.pcbms.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-11-02
+ */
+public class Score extends Model<Score> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 评分表主键
+     */
+    @TableId(value = "score_id", type = IdType.AUTO)
+    private Integer scoreId;
+
+    /**
+     * 个人分
+     */
+    @TableField("personal_score")
+    private Double personalScore;
+
+    /**
+     * 建议分
+     */
+    @TableField("idea_score")
+    private Double ideaScore;
+
+    /**
+     * 总得分
+     */
+    @TableField("total")
+    private Double total;
+
+    /**
+     * 评分原因
+     */
+    @TableField("reason")
+    private String reason;
+
+    /**
+     * 评分人id
+     */
+    @TableField("rater_id")
+    private Integer raterId;
+
+    /**
+     * 评分人姓名
+     */
+    @TableField("rater")
+    private String rater;
+
+    /**
+     * 被评分者的id
+     */
+    @TableField("uid")
+    private Integer uid;
+
+    /**
+     * 年-月份如:2019-10
+     */
+    @TableField("year_month")
+    private String yearMonth;
+
+
+    public Integer getScoreId() {
+        return scoreId;
+    }
+
+    public void setScoreId(Integer scoreId) {
+        this.scoreId = scoreId;
+    }
+
+    public Double getPersonalScore() {
+        return personalScore;
+    }
+
+    public void setPersonalScore(Double personalScore) {
+        this.personalScore = personalScore;
+    }
+
+    public Double getIdeaScore() {
+        return ideaScore;
+    }
+
+    public void setIdeaScore(Double ideaScore) {
+        this.ideaScore = ideaScore;
+    }
+
+    public Double getTotal() {
+        return total;
+    }
+
+    public void setTotal(Double total) {
+        this.total = total;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+
+    public Integer getRaterId() {
+        return raterId;
+    }
+
+    public void setRaterId(Integer raterId) {
+        this.raterId = raterId;
+    }
+
+    public String getRater() {
+        return rater;
+    }
+
+    public void setRater(String rater) {
+        this.rater = rater;
+    }
+
+    public Integer getUid() {
+        return uid;
+    }
+
+    public void setUid(Integer uid) {
+        this.uid = uid;
+    }
+
+    public String getYearMonth() {
+        return yearMonth;
+    }
+
+    public void setYearMonth(String yearMonth) {
+        this.yearMonth = yearMonth;
+    }
+
+    @Override
+    protected Serializable pkVal() {
+        return this.scoreId;
+    }
+
+    @Override
+    public String toString() {
+        return "Score{" +
+        "scoreId=" + scoreId +
+        ", personalScore=" + personalScore +
+        ", ideaScore=" + ideaScore +
+        ", total=" + total +
+        ", reason=" + reason +
+        ", raterId=" + raterId +
+        ", rater=" + rater +
+        ", uid=" + uid +
+        ", yearMonth=" + yearMonth +
+        "}";
+    }
+}

+ 18 - 0
pcbms/src/main/java/com/hssx/pcbms/entity/vo/IdeaVO.java

@@ -0,0 +1,18 @@
+package com.hssx.pcbms.entity.vo;
+
+import com.hssx.pcbms.entity.Idea;
+import com.hssx.pcbms.entity.IdeaComment;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * Author: 吴涛涛 cuiyi@itany.com
+ * Date : 2019 - 11 - 02 14:25
+ * Description:<描述>
+ * Version: 1.0
+ */
+@Data
+public class IdeaVO extends Idea {
+    private IdeaComment ideaComment;
+}

+ 1 - 1
pcbms/src/main/java/com/hssx/pcbms/mapper/GoodsMapper.java

@@ -13,7 +13,7 @@ import java.util.List;
  */
 public interface GoodsMapper extends BaseMapper<Goods> {
 
-    List<GoodsVO> getListBycondition(@Param("keyName") String keyName, @Param("tagId") Integer tagId);
+    List<GoodsVO> getListBycondition(@Param("keyName") String keyName, @Param("tagId") Integer tagId,@Param("uid")Integer uid);
 
     GoodsVO getDetail(@Param("id")Integer id);
 }

+ 16 - 0
pcbms/src/main/java/com/hssx/pcbms/mapper/IdeaCommentMapper.java

@@ -0,0 +1,16 @@
+package com.hssx.pcbms.mapper;
+
+import com.hssx.pcbms.entity.IdeaComment;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-11-02
+ */
+public interface IdeaCommentMapper extends BaseMapper<IdeaComment> {
+
+}

+ 21 - 0
pcbms/src/main/java/com/hssx/pcbms/mapper/IdeaMapper.java

@@ -0,0 +1,21 @@
+package com.hssx.pcbms.mapper;
+
+import com.hssx.pcbms.entity.Idea;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.hssx.pcbms.entity.vo.IdeaVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-11-02
+ */
+public interface IdeaMapper extends BaseMapper<Idea> {
+
+    List<IdeaVO> getIdeaListByUid(@Param("idea") Idea idea,@Param("time") String time);
+}

+ 16 - 0
pcbms/src/main/java/com/hssx/pcbms/mapper/ScoreMapper.java

@@ -0,0 +1,16 @@
+package com.hssx.pcbms.mapper;
+
+import com.hssx.pcbms.entity.Score;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-11-02
+ */
+public interface ScoreMapper extends BaseMapper<Score> {
+
+}

+ 1 - 3
pcbms/src/main/java/com/hssx/pcbms/service/GoodsService.java

@@ -24,7 +24,7 @@ public interface GoodsService extends IService<Goods> {
 
     HttpRespMsg updateInfo(Goods goods, MultipartFile file);
 
-    HttpRespMsg getList(PageUtil page,String keyName,Integer tagId);
+    HttpRespMsg getList(PageUtil page,String keyName,Integer tagId,Integer uid);
 
     HttpRespMsg del(Goods goods);
 
@@ -38,8 +38,6 @@ public interface GoodsService extends IService<Goods> {
 
     HttpRespMsg goodsNoDetailById(GoodsNo goodsNo);
 
-    HttpRespMsg goodsNodel(GoodsNo goodsNo);
-
     HttpRespMsg goodsNoAdd(GoodsNo goodsNo,Integer count);
 
     HttpRespMsg distribute(GoodsNo goodsNo);

+ 20 - 0
pcbms/src/main/java/com/hssx/pcbms/service/IdeaCommentService.java

@@ -0,0 +1,20 @@
+package com.hssx.pcbms.service;
+
+import com.hssx.pcbms.entity.IdeaComment;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.hssx.pcbms.util.HttpRespMsg;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-11-02
+ */
+public interface IdeaCommentService extends IService<IdeaComment> {
+
+    HttpRespMsg addOrUpdate(IdeaComment ideaComment,Double score);
+
+    HttpRespMsg del(IdeaComment ideaComment);
+}

+ 25 - 0
pcbms/src/main/java/com/hssx/pcbms/service/IdeaService.java

@@ -0,0 +1,25 @@
+package com.hssx.pcbms.service;
+
+import com.hssx.pcbms.entity.Idea;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.hssx.pcbms.util.HttpRespMsg;
+import com.hssx.pcbms.util.PageUtil;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-11-02
+ */
+public interface IdeaService extends IService<Idea> {
+
+    HttpRespMsg add(Idea idea);
+
+    HttpRespMsg del(Idea idea);
+
+    HttpRespMsg ideaList(Idea idea,PageUtil page);
+
+    HttpRespMsg ideaListByTime(Idea idea,String time);
+}

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

@@ -0,0 +1,18 @@
+package com.hssx.pcbms.service;
+
+import com.hssx.pcbms.entity.Score;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.hssx.pcbms.util.HttpRespMsg;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-11-02
+ */
+public interface ScoreService extends IService<Score> {
+
+    HttpRespMsg add(Score score);
+}

+ 2 - 14
pcbms/src/main/java/com/hssx/pcbms/service/impl/GoodsServiceImpl.java

@@ -96,11 +96,11 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
     }
 
     @Override
-    public HttpRespMsg getList(PageUtil page, String keyName, Integer tagId) {
+    public HttpRespMsg getList(PageUtil page, String keyName, Integer tagId,Integer uid) {
         System.out.println("页数:" + page.getPageNum());
         HttpRespMsg msg = new HttpRespMsg();
         PageHelper.startPage(page.getPageNum(), page.getPageSize());
-        List<GoodsVO> list = goodsMapper.getListBycondition(keyName, tagId);
+        List<GoodsVO> list = goodsMapper.getListBycondition(keyName, tagId,uid);
         PageInfo<GoodsVO> info = new PageInfo<>(list);
         msg.data = info;
         return msg;
@@ -195,18 +195,6 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         return msg;
     }
 
-    @Override
-    public HttpRespMsg goodsNodel(GoodsNo goodsNo) {
-        HttpRespMsg msg = new HttpRespMsg();
-        GoodsNo oldGoodsNo = goodsNoMapper.selectById(goodsNo.getId());
-        if (oldGoodsNo.getState() != 0) {
-            msg.setError("当前编号的资产状态非空闲,不支持该操作。");
-            return msg;
-        }
-        goodsNoMapper.deleteById(goodsNo.getId());
-        return msg;
-    }
-
     @Override
     public HttpRespMsg goodsNoAdd(GoodsNo goodsNo,Integer count) {
         HttpRespMsg msg = new HttpRespMsg();

+ 69 - 0
pcbms/src/main/java/com/hssx/pcbms/service/impl/IdeaCommentServiceImpl.java

@@ -0,0 +1,69 @@
+package com.hssx.pcbms.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.hssx.pcbms.entity.Idea;
+import com.hssx.pcbms.entity.IdeaComment;
+import com.hssx.pcbms.mapper.IdeaCommentMapper;
+import com.hssx.pcbms.mapper.IdeaMapper;
+import com.hssx.pcbms.service.IdeaCommentService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.hssx.pcbms.util.HttpRespMsg;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * @author 吴涛涛
+ * @since 2019-11-02
+ */
+@Service
+public class IdeaCommentServiceImpl extends ServiceImpl<IdeaCommentMapper, IdeaComment> implements IdeaCommentService {
+
+    @Resource
+    private IdeaCommentMapper ideaCommentMapper;
+    @Resource
+    private IdeaMapper ideaMapper;
+
+    @Override
+    public HttpRespMsg addOrUpdate(IdeaComment ideaComment,Double score) {
+        HttpRespMsg msg = new HttpRespMsg();
+        if (null == ideaComment.getId()) {
+            ideaCommentMapper.insert(ideaComment);
+            Idea idea = new Idea();
+            idea.setId(ideaComment.getId());
+            idea.setScore(score);
+            ideaMapper.update(idea,new QueryWrapper<Idea>().eq("id",ideaComment.getIdeaId()));
+        } else {
+            Idea idea = ideaMapper.selectOne(new QueryWrapper<Idea>().eq("id", ideaComment.getIdeaId()));
+            if (idea != null) {
+                ideaCommentMapper.updateById(ideaComment);
+                if(null != score){
+                    idea.setScore(score);
+                    ideaMapper.updateById(idea);
+                }
+            } else {
+                msg.setError("该建议数据不存在。");
+                return msg;
+            }
+        }
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg del(IdeaComment ideaComment) {
+        HttpRespMsg msg = new HttpRespMsg();
+        IdeaComment oldIdeaComment = ideaCommentMapper.selectById(ideaComment.getId());
+        if (oldIdeaComment != null) {
+            Idea idea = ideaMapper.selectOne(new QueryWrapper<Idea>().eq("id", ideaComment.getIdeaId()));
+            if (idea != null && null == idea.getScore()) {
+                ideaCommentMapper.deleteById(ideaComment.getId());
+            } else {
+                msg.setError("该回复对应的建议已被打分,不提供删除操作。");
+                return msg;
+            }
+        }else{
+            msg.setError("想要删除的回复数据不存在。");
+        }
+        return msg;
+    }
+}

+ 79 - 0
pcbms/src/main/java/com/hssx/pcbms/service/impl/IdeaServiceImpl.java

@@ -0,0 +1,79 @@
+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.entity.Idea;
+import com.hssx.pcbms.entity.IdeaComment;
+import com.hssx.pcbms.entity.vo.IdeaVO;
+import com.hssx.pcbms.mapper.IdeaCommentMapper;
+import com.hssx.pcbms.mapper.IdeaMapper;
+import com.hssx.pcbms.service.IdeaService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.hssx.pcbms.util.HttpRespMsg;
+import com.hssx.pcbms.util.PageUtil;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author 吴涛涛
+ * @since 2019-11-02
+ */
+@Service
+public class IdeaServiceImpl extends ServiceImpl<IdeaMapper, Idea> implements IdeaService {
+    @Resource
+    private IdeaMapper ideaMapper;
+    @Resource
+    private IdeaCommentMapper ideaCommentMapper;
+
+    @Override
+    public HttpRespMsg add(Idea idea) {
+        HttpRespMsg msg = new HttpRespMsg();
+        if(null == idea.getId()){
+            ideaMapper.insert(idea);
+        }else{
+            Idea oldIdea = ideaMapper.selectById(idea.getId());
+            if(null == oldIdea.getScore()){
+                ideaMapper.updateById(idea);
+            }else{
+                msg.setError("当前建议已被评分,不可进行修改");
+            }
+        }
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg del(Idea idea) {
+        HttpRespMsg msg = new HttpRespMsg();
+        Idea oldIdea = ideaMapper.selectById(idea.getId());
+        if(null == oldIdea.getScore()){
+            ideaMapper.deleteById(idea.getId());
+            //删除该建议的评论
+            ideaCommentMapper.delete(new QueryWrapper<IdeaComment>().eq("idea_id",idea.getId()));
+        }else{
+            msg.setError("当前建议已被评分,不可进行删除");
+        }
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg ideaList(Idea idea, PageUtil page) {
+        HttpRespMsg msg = new HttpRespMsg();
+        PageHelper.startPage(page.getPageNum(),page.getPageSize());
+        List<IdeaVO> list =  ideaMapper.getIdeaListByUid(idea,null);
+        PageInfo<IdeaVO> info = new PageInfo<>(list);
+        msg.data = info;
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg ideaListByTime(Idea idea, String time) {
+        HttpRespMsg msg = new HttpRespMsg();
+        List<IdeaVO> list =  ideaMapper.getIdeaListByUid(idea,time);
+        msg.data = list;
+        return msg;
+    }
+
+}

+ 20 - 0
pcbms/src/main/java/com/hssx/pcbms/service/impl/ScoreServiceImpl.java

@@ -0,0 +1,20 @@
+package com.hssx.pcbms.service.impl;
+
+import com.hssx.pcbms.entity.Score;
+import com.hssx.pcbms.mapper.ScoreMapper;
+import com.hssx.pcbms.service.ScoreService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-11-02
+ */
+@Service
+public class ScoreServiceImpl extends ServiceImpl<ScoreMapper, Score> implements ScoreService {
+
+}

+ 1 - 1
pcbms/src/main/java/com/hssx/pcbms/util/CodeGenerator.java

@@ -204,7 +204,7 @@ public class CodeGenerator {
         //若想要生成的实体类继承某个Controller,则可打开下面注释。写上需要继承的Controller的位置即可
 //        strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
         //此处user是表名,多个英文逗号分割
-        strategy.setInclude("maintain_record");
+        strategy.setInclude("score");
 //        strategy.setExclude();//数据库表全生成
 //        strategy.setInclude(scanner("user").split(","));//表名,多个英文逗号分割
         strategy.setControllerMappingHyphenStyle(true);

+ 3 - 0
pcbms/src/main/resources/mapper/GoodsMapper.xml

@@ -79,6 +79,9 @@
             <if test="tagId != null">
                 and tag_id = #{tagId}
             </if>
+            <if test="uid != null">
+                and creator_id = #{uid}
+            </if>
         </where>
     </select>
     <select id="selectGoodsNoByGoodsId" resultType="com.hssx.pcbms.entity.GoodsNo">

+ 20 - 0
pcbms/src/main/resources/mapper/IdeaCommentMapper.xml

@@ -0,0 +1,20 @@
+<?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.pcbms.mapper.IdeaCommentMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.pcbms.entity.IdeaComment">
+        <id column="id" property="id" />
+        <result column="idea_id" property="ideaId" />
+        <result column="content" property="content" />
+        <result column="responder_id" property="responderId" />
+        <result column="responder" property="responder" />
+        <result column="indate" property="indate" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, idea_id, content, responder_id, responder, indate
+    </sql>
+
+</mapper>

+ 59 - 0
pcbms/src/main/resources/mapper/IdeaMapper.xml

@@ -0,0 +1,59 @@
+<?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.pcbms.mapper.IdeaMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.pcbms.entity.Idea">
+        <id column="id" property="id" />
+        <result column="uid" property="uid" />
+        <result column="indate" property="indate" />
+        <result column="content" property="content" />
+        <result column="score" property="score" />
+        <result column="is_draft" property="isDraft" />
+        <result column="is_evaluated" property="isEvaluated" />
+        <result column="score_id" property="scoreId" />
+    </resultMap>
+    <resultMap id="BaseResultIdeaCommentMap" type="com.hssx.pcbms.entity.IdeaComment">
+        <id column="cid" property="id" />
+        <result column="idea_id" property="ideaId" />
+        <result column="content" property="content" />
+        <result column="responder_id" property="responderId" />
+        <result column="responder" property="responder" />
+        <result column="indate" property="indate" />
+    </resultMap>
+    <resultMap id="BaseResultMapVO" type="com.hssx.pcbms.entity.vo.IdeaVO">
+        <id column="id" property="id" />
+        <result column="uid" property="uid" />
+        <result column="indate" property="indate" />
+        <result column="content" property="content" />
+        <result column="score" property="score" />
+        <result column="is_draft" property="isDraft" />
+        <result column="is_evaluated" property="isEvaluated" />
+        <result column="score_id" property="scoreId" />
+        <association property="ideaComment" resultMap="BaseResultIdeaCommentMap" >
+        </association>
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, uid, indate, content, score, is_draft, is_evaluated, score_id
+    </sql>
+    
+    <select id="getIdeaListByUid" resultMap="BaseResultMapVO">
+        select
+            i.id, i.uid, i.indate, i.content, i.score, i.is_draft, i.is_evaluated, i.score_id,
+            ic.id cid,ic.idea_id, ic.content, ic.responder_id, ic.responder, ic.indate
+        from
+            idea i
+        left join idea_comment ic
+        on i.id = ic.idea_id
+        <where>
+            i.uid = #{idea.uid,jdbcType=INTEGER}
+            <if test="time != null">
+               and date_format(i.indate,'%Y-%m') = #{time}
+            </if>
+        </where>
+        order by i.indate desc
+    </select>
+
+</mapper>

+ 23 - 0
pcbms/src/main/resources/mapper/ScoreMapper.xml

@@ -0,0 +1,23 @@
+<?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.pcbms.mapper.ScoreMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.pcbms.entity.Score">
+        <id column="score_id" property="scoreId" />
+        <result column="personal_score" property="personalScore" />
+        <result column="idea_score" property="ideaScore" />
+        <result column="total" property="total" />
+        <result column="reason" property="reason" />
+        <result column="rater_id" property="raterId" />
+        <result column="rater" property="rater" />
+        <result column="uid" property="uid" />
+        <result column="year_month" property="yearMonth" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        score_id, personal_score, idea_score, total, reason, rater_id, rater, uid, year_month
+    </sql>
+
+</mapper>