问答中心增加校验,如果是提问人或回答人可看全部数据,如不是只能看归档数据
This commit is contained in:
@@ -84,6 +84,7 @@ public class ReplyController extends BaseController<Reply> {
|
||||
return Result.error("-1","编辑失败",null);
|
||||
}
|
||||
for(Reply reply: replyList){
|
||||
reply.setAnswerer(reply.getAnswererId());
|
||||
reply.setState("yes");
|
||||
}
|
||||
replyService.updateBatchById(replyList);
|
||||
|
||||
@@ -71,4 +71,6 @@ public class Reply extends BaseEntity {
|
||||
|
||||
@TableField(exist = false)
|
||||
private String taskId;
|
||||
@TableField(exist = false)
|
||||
private String answererId;
|
||||
}
|
||||
|
||||
+12
-2
@@ -8,6 +8,8 @@ import com.adc.da.slrs.StandardQA.entity.AskQuestionsPage;
|
||||
import com.adc.da.slrs.StandardQA.entity.AskQuestionsReplyVO;
|
||||
import com.adc.da.slrs.StandardQA.entity.Reply;
|
||||
import com.adc.da.slrs.StandardQA.service.AskQuestionsService;
|
||||
import com.adc.da.slrs.sarUser.entity.UpDTO;
|
||||
import com.adc.da.slrs.sarUser.service.ITsUserService;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -39,6 +41,9 @@ public class AskQuestionsServiceImpl extends ServiceImpl<AskQuestionsDao, AskQue
|
||||
@Autowired
|
||||
private ReplyDao replyDao;
|
||||
|
||||
@Autowired
|
||||
private ITsUserService userService;
|
||||
|
||||
@Override
|
||||
public List<AskQuestions> getAskQuestions(AskQuestions askQuestions) {
|
||||
return askQuestionsDao.getAskQuestions(askQuestions);
|
||||
@@ -113,8 +118,13 @@ public class AskQuestionsServiceImpl extends ServiceImpl<AskQuestionsDao, AskQue
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Reply> getAskQuestionsByakId(String id,String state) {
|
||||
return askQuestionsDao.getAskQuestionsByakId(id,state);
|
||||
public List<Reply> getAskQuestionsByakId(String id,String state,String userId) {
|
||||
String questioner = askQuestionsDao.selectBYAQId(id);
|
||||
String answerer = askQuestionsDao.selectByRId(id);
|
||||
if (userId.equals(questioner)||userId.equals(answerer)){
|
||||
return askQuestionsDao.getAskQuestionsByakId(id,state);
|
||||
}
|
||||
return askQuestionsDao.getAskQuestionsById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getAskQuestionsByakId" resultType="com.adc.da.slrs.StandardQA.entity.Reply">
|
||||
SELECT reply.ID, reply.REPLY,reply.REPLY_TIME,t2.UNAME ANSWERER,reply.APPENDIX_ID,APPENDIX_NAME,reply.state
|
||||
SELECT reply.ID, reply.REPLY,reply.REPLY_TIME,t2.UNAME as ANSWERER,t2.USID as `answererId`,reply.APPENDIX_ID,APPENDIX_NAME,reply.state
|
||||
FROM reply
|
||||
LEFT JOIN ts_user t2 ON t2.USID = reply.ANSWERER
|
||||
<where>
|
||||
@@ -274,6 +274,7 @@
|
||||
<if test="id != null and id !=''">
|
||||
AND reply.ASK_ID = #{id}
|
||||
</if>
|
||||
limit 1
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -286,6 +287,7 @@
|
||||
<if test="id != null and id !=''">
|
||||
AND reply.ASK_ID = #{id}
|
||||
</if>
|
||||
limit 1
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -297,7 +299,7 @@
|
||||
<if test="id !=null and id !=''">
|
||||
AND reply.ASK_ID = #{id}
|
||||
</if>
|
||||
AND reply.state = '1'
|
||||
AND reply.state = 'yes'
|
||||
</where>
|
||||
order by reply.REPLY_TIME
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user