Ver código fonte

优化objId 抒写错误问题

java110 5 anos atrás
pai
commit
ef0b698b68

+ 9 - 0
java110-bean/src/main/java/com/java110/dto/questionAnswer/QuestionAnswerDto.java

@@ -25,6 +25,7 @@ public class QuestionAnswerDto extends PageDto implements Serializable {
     private String storeId;
     private String storeId;
     private String objType;
     private String objType;
     private String objId;
     private String objId;
+    private String[] objIds;
     private String qaId;
     private String qaId;
 
 
 
 
@@ -113,4 +114,12 @@ public class QuestionAnswerDto extends PageDto implements Serializable {
     public void setStatusCd(String statusCd) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
         this.statusCd = statusCd;
     }
     }
+
+    public String[] getObjIds() {
+        return objIds;
+    }
+
+    public void setObjIds(String[] objIds) {
+        this.objIds = objIds;
+    }
 }
 }

+ 12 - 0
java110-db/src/main/resources/mapper/user/QuestionAnswerServiceDaoImplMapper.xml

@@ -46,6 +46,12 @@
         <if test="objId !=null and objId != ''">
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
             and t.obj_id= #{objId}
         </if>
         </if>
+        <if test="objIds !=null">
+            and t.obj_id in
+            <foreach collection="objIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="qaId !=null and qaId != ''">
         <if test="qaId !=null and qaId != ''">
             and t.qa_id= #{qaId}
             and t.qa_id= #{qaId}
         </if>
         </if>
@@ -120,6 +126,12 @@
         <if test="objId !=null and objId != ''">
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
             and t.obj_id= #{objId}
         </if>
         </if>
+        <if test="objIds !=null">
+            and t.obj_id in
+            <foreach collection="objIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="qaId !=null and qaId != ''">
         <if test="qaId !=null and qaId != ''">
             and t.qa_id= #{qaId}
             and t.qa_id= #{qaId}
         </if>
         </if>

+ 10 - 5
service-user/src/main/java/com/java110/user/api/QuestionAnswerApi.java

@@ -21,6 +21,7 @@ import com.java110.user.bmo.questionAnswerTitleValue.ISaveQuestionAnswerTitleVal
 import com.java110.user.bmo.questionAnswerTitleValue.IUpdateQuestionAnswerTitleValueBMO;
 import com.java110.user.bmo.questionAnswerTitleValue.IUpdateQuestionAnswerTitleValueBMO;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
@@ -140,7 +141,7 @@ public class QuestionAnswerApi {
      */
      */
     @RequestMapping(value = "/queryQuestionAnswer", method = RequestMethod.GET)
     @RequestMapping(value = "/queryQuestionAnswer", method = RequestMethod.GET)
     public ResponseEntity<String> queryQuestionAnswer(
     public ResponseEntity<String> queryQuestionAnswer(
-            @RequestHeader(value = "store-id") String storeId,
+            @RequestHeader(value = "store-id",required = false) String storeId,
             @RequestParam(value = "communityId", required = false) String communityId,
             @RequestParam(value = "communityId", required = false) String communityId,
             @RequestParam(value = "objType", required = false) String objType,
             @RequestParam(value = "objType", required = false) String objType,
             @RequestParam(value = "page") int page,
             @RequestParam(value = "page") int page,
@@ -148,8 +149,12 @@ public class QuestionAnswerApi {
         QuestionAnswerDto questionAnswerDto = new QuestionAnswerDto();
         QuestionAnswerDto questionAnswerDto = new QuestionAnswerDto();
         questionAnswerDto.setPage(page);
         questionAnswerDto.setPage(page);
         questionAnswerDto.setRow(row);
         questionAnswerDto.setRow(row);
-        questionAnswerDto.setObjType(objType);
-        questionAnswerDto.setObjId(QuestionAnswerDto.QA_TYPE_COMMUNITY.endsWith(objType) ? communityId : storeId);
+        if (!StringUtil.isEmpty(objType)) {
+            questionAnswerDto.setObjType(objType);
+            questionAnswerDto.setObjId(QuestionAnswerDto.QA_TYPE_COMMUNITY.equals(objType) ? communityId : storeId);
+        } else {
+            questionAnswerDto.setObjIds(new String[]{storeId, communityId});
+        }
         return getQuestionAnswerBMOImpl.get(questionAnswerDto);
         return getQuestionAnswerBMOImpl.get(questionAnswerDto);
     }
     }
 
 
@@ -235,7 +240,7 @@ public class QuestionAnswerApi {
         questionAnswerTitleDto.setPage(page);
         questionAnswerTitleDto.setPage(page);
         questionAnswerTitleDto.setRow(row);
         questionAnswerTitleDto.setRow(row);
         questionAnswerTitleDto.setObjType(objType);
         questionAnswerTitleDto.setObjType(objType);
-        questionAnswerTitleDto.setObjId(QuestionAnswerDto.QA_TYPE_COMMUNITY.endsWith(objType) ? communityId : storeId);
+        questionAnswerTitleDto.setObjId(QuestionAnswerDto.QA_TYPE_COMMUNITY.equals(objType) ? communityId : storeId);
         return getQuestionAnswerTitleBMOImpl.get(questionAnswerTitleDto);
         return getQuestionAnswerTitleBMOImpl.get(questionAnswerTitleDto);
     }
     }
 
 
@@ -319,7 +324,7 @@ public class QuestionAnswerApi {
         questionAnswerTitleValueDto.setPage(page);
         questionAnswerTitleValueDto.setPage(page);
         questionAnswerTitleValueDto.setRow(row);
         questionAnswerTitleValueDto.setRow(row);
         questionAnswerTitleValueDto.setObjType(objType);
         questionAnswerTitleValueDto.setObjType(objType);
-        questionAnswerTitleValueDto.setObjId(QuestionAnswerDto.QA_TYPE_COMMUNITY.endsWith(objType) ? communityId : storeId);
+        questionAnswerTitleValueDto.setObjId(QuestionAnswerDto.QA_TYPE_COMMUNITY.equals(objType) ? communityId : storeId);
         return getQuestionAnswerTitleValueBMOImpl.get(questionAnswerTitleValueDto);
         return getQuestionAnswerTitleValueBMOImpl.get(questionAnswerTitleValueDto);
     }
     }
 }
 }