问答中心增加校验,如果是提问人或回答人可看全部数据,如不是只能看归档数据

This commit is contained in:
SUNJIABIN
2023-04-10 16:48:26 +08:00
parent 27aba2ad1f
commit 983fa9a1f2
4 changed files with 45 additions and 3 deletions
@@ -157,8 +157,8 @@ public class AskQuestionsController extends BaseController<AskQuestions> {
* @return
*/
@GetMapping("/getAskQuestionsByakId")
public ResponseMessage getAskQuestionsByakId(String id,String state){
List<Reply> askQuestionsList = askQuestionsService.getAskQuestionsByakId(id,state);
public ResponseMessage getAskQuestionsByakId(String id,String state,String userId){
List<Reply> askQuestionsList = askQuestionsService.getAskQuestionsByakId(id,state,userId);
return Result.success(askQuestionsList);
}
@@ -39,4 +39,10 @@ public interface AskQuestionsDao extends BaseMapper<AskQuestions> {
List<Reply> getAskQuestionsByakId (@Param("id") String id,@Param("state") String state);
List<String> getUId();
String selectByRId(@Param("id") String id);
String selectBYAQId(@Param("id") String id);
List<Reply> getAskQuestionsById(@Param("id") String id);
}
@@ -29,7 +29,7 @@ public interface AskQuestionsService extends IService<AskQuestions> {
List<AskQuestions> getAskQuestionsByStandardId(String standardId);
List<AskQuestions> getArchiveAskQuestions(String id);
List<Reply> getAskQuestionsByakId(String id,String state);
List<Reply> getAskQuestionsByakId(String id,String state,String userId);
}
@@ -266,5 +266,41 @@
order by QUESTION_TIME desc
</select>
<select id="selectByRId" resultType="java.lang.String">
SELECT reply.ANSWERER
FROM reply
LEFT JOIN ts_user t2 ON t2.USID = reply.ANSWERER
<where>
<if test="id != null and id !=''">
AND reply.ASK_ID = #{id}
</if>
</where>
</select>
<select id="selectBYAQId" resultType="java.lang.String">
SELECT ask_questions.QUESTIONER
FROM ask_questions
LEFT JOIN ts_user t2 ON t2.USID = ask_questions.QUESTIONER
left join reply on reply.ASK_ID = ask_questions.ID
<where>
<if test="id != null and id !=''">
AND reply.ASK_ID = #{id}
</if>
</where>
</select>
<select id="getAskQuestionsById" 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
FROM reply
LEFT JOIN ts_user t2 ON t2.USID = reply.ANSWERER
<where>
<if test="id !=null and id !=''">
AND reply.ASK_ID = #{id}
</if>
AND reply.state = '1'
</where>
order by reply.REPLY_TIME
</select>
</mapper>