update:修改标准问答bug

This commit is contained in:
qk
2022-06-09 14:03:21 +08:00
parent 582b34c909
commit 0508232730
2 changed files with 24 additions and 12 deletions
@@ -10,6 +10,7 @@ import com.adc.da.util.http.Result;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@@ -37,18 +38,26 @@ public class ReplyController extends BaseController<Reply> {
@PostMapping("/insertReply")
public ResponseMessage insertReply(@RequestBody Reply reply){
reply.setAppendixId(reply.getFileList().get(0).getAttId());
reply.setAppendixName(reply.getFileList().get(0).getName());
if(StringUtils.isEmpty(reply.getReply())){
return Result.error("-1","请输入回答内容");
}
if(reply.getFileList().size() >0) {
reply.setAppendixId(reply.getFileList().get(0).getAttId());
reply.setAppendixName(reply.getFileList().get(0).getName());
}
reply.setReplyTime(new Date());
reply.setId(UUIDUtils.randomUUID20());
if(replyService.save(reply)){
return Result.success("200","添加成功");
return Result.success("200","提交成功");
}else {
return Result.error("200","添加失败");
return Result.error("-1","添加失败");
}
}
@PostMapping("/updateReply")
public ResponseMessage updateReply(String id){
if(StringUtils.isEmpty(id)){
return Result.error("-1","请选择要归档的回答");
}
List<String> list = Arrays.asList(id.split(","));
for (String s: list) {
UpdateWrapper updateWrapper = new UpdateWrapper();
@@ -68,17 +68,20 @@
SELECT reply.ID, reply.REPLY,reply.REPLY_TIME,t2.UNAME ANSWERER,reply.APPENDIX_ID,APPENDIX_NAME
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>
<where>
<if test="id !=null and id !=''">
AND reply.ASK_ID = #{id}
</if>
</where>
order by reply.REPLY_TIME
</select>
<select id="getReplyDetails" resultType="com.adc.da.slrs.StandardQA.entity.AskQuestions">
SELECT aq.ID,aq.CLASSIFICATION,aq.PROBLEM_DESCRIPTION,t1.UNAME QUESTIONER,aq.QUESTION_TIME,aq.STANDARD_ENCDOING,
aq.STANDARD_NAME,aq.STANDARD_ID,reply.REPLY,reply.REPLY_TIME,t2.UNAME ANSWERER,
reply.APPENDIX,reply.APPENDIX_ID,reply.APPENDIX_NAME
SELECT
DISTINCT
aq.STANDARD_ID,aq.CLASSIFICATION,aq.STANDARD_ENCDOING,
aq.STANDARD_NAME
FROM ask_questions aq
LEFT JOIN reply ON aq.ID = reply.ASK_ID AND reply.STATE = '0'
LEFT JOIN ts_user t1 ON t1.USID = aq.QUESTIONER