Browse Source

添加了查看问题详细

wuweihao 5 years ago
parent
commit
cacb09b021

+ 1 - 1
xiaoan-application/src/main/resources/application.properties

@@ -1,6 +1,6 @@
 server.port=8011
 
-spring.profiles.active=sit
+spring.profiles.active=dev
 
 #mybatis
 #mybatis.mapper-locations=classpath:mapper/*.xml

+ 4 - 0
xiaoan-dao/src/main/java/com/xiaoan/dao/backend/IssueRepository.java

@@ -36,4 +36,8 @@ public interface IssueRepository extends IBaseMapper<IssueEntity, Long> {
             "and l.user_id = #{userId} " +
             "order by create_time desc")
     List<IssueResponse> searchByUserId(String itemName, Long userId);
+
+    @Select(value = "select l.id, l.title, l.content, l.create_time, u.user_name, u.real_name from tb_issue l left join tb_user u on l.user_id = u.id " +
+            "where l.id = #{id} order by create_time desc")
+    IssueResponse ResponseFindById(Long id);
 }

+ 16 - 0
xiaoan-dao/src/main/java/com/xiaoan/dao/backend/ReplyMapper.java

@@ -0,0 +1,16 @@
+package com.xiaoan.dao.backend;
+
+import com.xiaoan.domain.backend.ReplyEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Component;
+
+
+
+/**
+ * Created by Hb_zzZ on 2020/2/27.
+ */
+@Mapper
+@Component
+public interface ReplyMapper extends IBaseMapper<ReplyEntity, Long> {
+    
+}

+ 4 - 4
xiaoan-domain/src/main/java/com/xiaoan/domain/backend/IssueEntity.java

@@ -27,10 +27,10 @@ public class IssueEntity extends BaseModel implements Serializable {
      */
     private String content;
 
-    /**
-     * 回复
-     */
-    private String reply;
+//    /**
+//     * 回复
+//     */
+//    private String reply;
 
     /**
      * 问题创建人

+ 42 - 0
xiaoan-domain/src/main/java/com/xiaoan/domain/backend/ReplyEntity.java

@@ -0,0 +1,42 @@
+package com.xiaoan.domain.backend;
+
+import com.xiaoan.common.model.BaseModel;
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import java.io.Serializable;
+
+/**
+ * Created by owen on 2020/3/4.
+ *
+ * 问题反馈实体
+ * 只有管理员才能回复
+ */
+@Data
+@Entity
+@Table(name = "tb_reply")
+public class ReplyEntity extends BaseModel implements Serializable {
+
+    /**
+     * 问题id
+     */
+    private Long issueId;
+
+    /**
+     * 回复
+     */
+    private String reply;
+
+//    /**
+//     * 回答者用户id
+//     */
+//    private Long userId;
+
+//    /**
+//     * 回复id
+//     */
+//    private Long parentId;
+
+
+}

+ 31 - 0
xiaoan-domain/src/main/java/com/xiaoan/domain/dto/request/ReplyRequest.java

@@ -0,0 +1,31 @@
+package com.xiaoan.domain.dto.request;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * Created by owen on 2020/3/4.
+ *
+ * 问题反馈实体
+ */
+@Data
+public class ReplyRequest implements Serializable {
+
+    /**
+     * 问题id
+     */
+    private Long issueId;
+
+    /**
+     * 回复
+     */
+    private String reply;
+
+//    /**
+//     * 回复id
+//     */
+//    private Long parentId;
+
+
+}

+ 4 - 0
xiaoan-service/src/main/java/com/xiaoan/service/backend/IssueService.java

@@ -14,4 +14,8 @@ public interface IssueService extends IBaseService<IssueEntity, Long> {
     List<IssueResponse> search(String itemName);
 
     List<IssueResponse> search(String itemName, Long userId);
+
+    IssueResponse ResponseFindById(Long id);
+
+
 }

+ 13 - 0
xiaoan-service/src/main/java/com/xiaoan/service/backend/ReplyService.java

@@ -0,0 +1,13 @@
+package com.xiaoan.service.backend;
+
+import com.xiaoan.domain.backend.ReplyEntity;
+import com.xiaoan.service.IBaseService;
+
+
+/**
+ * Created by owen on 2020/3/4 0004 17:15
+ */
+public interface ReplyService extends IBaseService<ReplyEntity, Long> {
+
+
+}

+ 5 - 10
xiaoan-service/src/main/java/com/xiaoan/service/backend/impl/IssueServiceImpl.java

@@ -39,15 +39,10 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueEntity, Long> impleme
         return entityMapper.searchByUserId(itemName, userId);
     }
 
+    @Override
+    public IssueResponse ResponseFindById(Long id) {
+        return entityMapper.ResponseFindById(id);
+    }
+
 
-//    @Override
-//    public List<LogResponse> findAllToUserName() {
-//        return entityMapper.findAllToUserName();
-//    }
-//
-//    @Override
-//    public List<LogResponse> search(String itemName) {
-//        itemName = "%" + itemName + "%";
-//        return entityMapper.search(itemName);
-//    }
 }

+ 36 - 0
xiaoan-service/src/main/java/com/xiaoan/service/backend/impl/ReplyServiceImpl.java

@@ -0,0 +1,36 @@
+package com.xiaoan.service.backend.impl;
+
+import com.xiaoan.dao.backend.IBaseMapper;
+import com.xiaoan.dao.backend.IssueRepository;
+import com.xiaoan.dao.backend.ReplyMapper;
+import com.xiaoan.domain.backend.IssueEntity;
+import com.xiaoan.domain.backend.ReplyEntity;
+import com.xiaoan.domain.dto.response.IssueResponse;
+import com.xiaoan.service.BaseServiceImpl;
+import com.xiaoan.service.backend.IssueService;
+import com.xiaoan.service.backend.ReplyService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * Created by Hb_zzZ on 2020/2/27.
+ */
+@Service
+@Transactional
+public class ReplyServiceImpl extends BaseServiceImpl<ReplyEntity, Long> implements ReplyService {
+
+    @Autowired
+    private ReplyMapper entityMapper;
+
+    @Override
+    public IBaseMapper<ReplyEntity, Long> getBaseMapper() {
+        return this.entityMapper;
+    }
+
+
+
+
+}

+ 1 - 1
xiaoan-web/src/main/java/com/xiaoan/web/backend/IndexController.java

@@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit;
 /**
  * Created by owen on 2020/2/19 0019 15:53
  */
-@Api(value = "IndexController",tags = "后台登录管理")
+@Api(value = "IndexController",tags = "登录管理")
 @RestController
 //@RequestMapping("api/manage/user")
 @Transactional

+ 43 - 7
xiaoan-web/src/main/java/com/xiaoan/web/backend/IssueController.java

@@ -6,9 +6,11 @@ import com.xiaoan.common.constant.MsgCode;
 import com.xiaoan.common.model.PageDto;
 import com.xiaoan.common.util.ResultJson;
 import com.xiaoan.domain.backend.IssueEntity;
+import com.xiaoan.domain.backend.ReplyEntity;
 import com.xiaoan.domain.dto.request.IssueRequest;
 import com.xiaoan.domain.dto.response.IssueResponse;
 import com.xiaoan.service.backend.IssueService;
+import com.xiaoan.service.backend.ReplyService;
 import com.xiaoan.web.aop.WebControllerLog;
 import com.xiaoan.web.shiro.JwtUtil2;
 import io.swagger.annotations.Api;
@@ -18,9 +20,10 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
+import tk.mybatis.mapper.entity.Condition;
 
 import javax.validation.Valid;
-import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 
 
@@ -36,6 +39,9 @@ public class IssueController extends BaseController {
     @Autowired
     private IssueService issueService;
 
+    @Autowired
+    private ReplyService replyService;
+
     /**
      * 全部人都可以看
      * @param param
@@ -80,15 +86,18 @@ public class IssueController extends BaseController {
         if (entity == null) {
             return new ResultJson(MsgCode.e_COMMON_3001, MsgCode.msg_COMMON_3001);
         }
-
-        entity.setReply(item);
-        entity.setUpdateTime(new Date());
-
-        issueService.update(entity);
+        ReplyEntity replyEntity = new ReplyEntity();
+        replyEntity.setIssueId(id);
+        replyEntity.setReply(item);
+        replyService.save(replyEntity);
 
         return new ResultJson(MsgCode.SUCCESS_CODE, MsgCode.msg_SUCCESS);
     }
 
+
+
+
+
     /**
      * 只有管理员才能删除问题
      */
@@ -96,7 +105,7 @@ public class IssueController extends BaseController {
     @WebControllerLog(description = "问题反馈-删除问题")
     @ApiOperation("删除问题")
     @GetMapping("delete/{id}")
-    public ResultJson save(@PathVariable Long id){
+    public ResultJson delete(@PathVariable Long id){
         issueService.deleteById(id);
         return new ResultJson(MsgCode.SUCCESS_CODE, MsgCode.msg_SUCCESS);
     }
@@ -111,6 +120,33 @@ public class IssueController extends BaseController {
     }
 
 
+    @RequiresPermissions("admin:issue:list")
+    @WebControllerLog(description = "问题反馈-查看详情")
+    @ApiOperation("查看详情")
+    @GetMapping("detail/{id}")
+    public ResultJson detail(@PathVariable Long id){
+        IssueEntity issueEntity = issueService.findById(id);
+        if (issueEntity == null) {
+            return new ResultJson(MsgCode.e_COMMON_3001, MsgCode.msg_COMMON_3001);
+        }
+
+        IssueResponse issueResponse = issueService.ResponseFindById(id);
+
+
+        Condition condition = new Condition(ReplyEntity.class);
+        condition.and().andEqualTo("issueId", id);
+
+        List<ReplyEntity> replyEntityList = replyService.findAll(condition);
+
+        HashMap<String, Object> resultMap = new HashMap<>();
+        resultMap.put("issue", issueResponse);
+        resultMap.put("reply", replyEntityList);
+
+
+        return new ResultJson(MsgCode.SUCCESS_CODE, resultMap);
+    }
+
+