insert:添加标准问答功能
This commit is contained in:
@@ -0,0 +1,219 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.adc.da.slrs.StandardQA.dao.AskQuestionsDao">
|
||||
|
||||
<select id="getAskQuestions" resultType="com.adc.da.slrs.StandardQA.entity.AskQuestions">
|
||||
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
|
||||
LEFT JOIN ts_user t1 ON t1.USID = aq.QUESTIONER
|
||||
LEFT JOIN ts_user t2 ON t2.USID = reply.ANSWERER
|
||||
<where>
|
||||
<if test="askQuestions.questioner != null and askQuestions.questioner != ''">
|
||||
AND aq.QUESTIONER =#{askQuestions.questioner}
|
||||
</if>
|
||||
<if test="askQuestions.id != null and askQuestions.id != ''">
|
||||
AND aq.ID = #{askQuestions.id}
|
||||
</if>
|
||||
<if test="askQuestions.standardId !=null and askQuestions.standardId !=''">
|
||||
AND aq.STANDARD_ID = #{askQuestions.standardId}
|
||||
</if>
|
||||
<if test="askQuestions.classification != null and askQuestions.classification != ''">
|
||||
AND aq.CLASSIFICATION = #{askQuestions.classification}
|
||||
</if>
|
||||
<if test="askQuestions.standardEncdoing != null and askQuestions.standardEncdoing != ''">
|
||||
AND aq.STANDARD_ENCDOING LIKE concat(concat('%',#{askQuestions.standardEncdoing}),'%')
|
||||
</if>
|
||||
<if test="askQuestions.standardName != null and askQuestions.standardName !=''">
|
||||
AND aq.STANDARD_NAME LIKE concat(concat('%',#{askQuestions.standardName}),'%')
|
||||
</if>
|
||||
<if test="askQuestions.problemDescription != null and askQuestions.problemDescription != ''">
|
||||
AND aq.PROBLEM_DESCRIPTION LIKE concat(concat('%',#{askQuestions.problemDescription}),'%')
|
||||
</if>
|
||||
<if test="askQuestions.answerer !=null and askQuestions.answerer !=''">
|
||||
AND reply.ANSWERER = #{askQuestions.answerer}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getAskQuestionsByStandardId" 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
|
||||
FROM ask_questions aq
|
||||
LEFT JOIN ts_user t1 ON t1.USID = aq.QUESTIONER
|
||||
<where>
|
||||
<if test="standardId !=null and standardId !=''">
|
||||
AND aq.STANDARD_ID = #{standardId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getArchiveAskQuestions" resultType="com.adc.da.slrs.StandardQA.entity.AskQuestions">
|
||||
SELECT reply.REPLY,reply.REPLY_TIME,t2.UNAME ANSWERER,
|
||||
reply.APPENDIX,reply.APPENDIX_ID,reply.APPENDIX_NAME
|
||||
FROM reply
|
||||
LEFT JOIN ts_user t2 ON t2.USID = reply.ANSWERER
|
||||
<where>
|
||||
reply.STATE = 'yes'
|
||||
<if test="id != nll and id !=''">
|
||||
AND reply.ASK_ID = #{id}
|
||||
</if>
|
||||
</where>
|
||||
</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
|
||||
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="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
|
||||
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
|
||||
LEFT JOIN ts_user t2 ON t2.USID = reply.ANSWERER
|
||||
LEFT JOIN ask_user au ON au.ASK_ID = aq.ID
|
||||
<where>
|
||||
<if test="askQuestions.answerer != null and askQuestions.answerer != ''">
|
||||
AND au.USID = #{askQuestions.answerer}
|
||||
</if>
|
||||
<if test="askQuestions.classification !=null and askQuestions.classification !=''">
|
||||
AND aq.CLASSIFICATION = #{askQuestions.classification}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getReplyDetailsByStandId" 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
|
||||
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
|
||||
LEFT JOIN ts_user t2 ON t2.USID = reply.ANSWERER
|
||||
LEFT JOIN ask_user au ON au.ASK_ID = aq.ID
|
||||
<where>
|
||||
<if test="askQuestions.standardId !=null and askQuestions.standardId !=''">
|
||||
AND aq.STANDARD_ID = #{askQuestions.standardId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getAskQuestionsBySubscription" resultType="com.adc.da.slrs.StandardQA.entity.AskQuestions">
|
||||
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
|
||||
LEFT JOIN ts_user t1 ON t1.USID = aq.QUESTIONER
|
||||
LEFT JOIN ts_user t2 ON t2.USID = reply.ANSWERER
|
||||
LEFT JOIN subscription su ON su.ASK_ID = aq.ID
|
||||
<where>
|
||||
<if test="askQuestions.answerer !=null and askQuestions.answerer !=''">
|
||||
AND su.USID = #{askQuestions.answerer}
|
||||
</if>
|
||||
<if test="askQuestions.classification !=null and askQuestions.classification !=''">
|
||||
AND aq.CLASSIFICATION = #{askQuestions.classification}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="retrieve" resultType="com.adc.da.slrs.StandardQA.entity.AskQuestions">
|
||||
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
|
||||
LEFT JOIN ts_user t1 ON t1.USID = aq.QUESTIONER
|
||||
LEFT JOIN ts_user t2 ON t2.USID = reply.ANSWERER
|
||||
<if test="askQuestions.type == 'myAns'">
|
||||
LEFT JOIN ask_user au ON au.ASK_ID = aq.ID
|
||||
</if>
|
||||
<if test="askQuestions.type == 'mySub'">
|
||||
LEFT JOIN subscription su ON su.ASK_ID = aq.ID
|
||||
</if>
|
||||
<where>
|
||||
<if test="askQuestions.questioner != null and askQuestions.questioner != ''">
|
||||
AND aq.QUESTIONER =#{askQuestions.questioner}
|
||||
</if>
|
||||
<if test="askQuestions.id != null and askQuestions.id != ''">
|
||||
AND aq.ID = #{askQuestions.id}
|
||||
</if>
|
||||
<if test="askQuestions.standardId !=null and askQuestions.standardId !=''">
|
||||
AND aq.STANDARD_ID = #{askQuestions.standardId}
|
||||
</if>
|
||||
<if test="askQuestions.classification != null and askQuestions.classification != ''">
|
||||
AND aq.CLASSIFICATION = #{askQuestions.classification}
|
||||
</if>
|
||||
<if test="askQuestions.standardEncdoing != null and askQuestions.standardEncdoing != ''">
|
||||
AND aq.STANDARD_ENCDOING LIKE concat(concat('%',#{askQuestions.standardEncdoing}),'%')
|
||||
</if>
|
||||
<if test="askQuestions.standardName != null and askQuestions.standardName !=''">
|
||||
AND aq.STANDARD_NAME LIKE concat(concat('%',#{askQuestions.standardName}),'%')
|
||||
</if>
|
||||
<if test="askQuestions.subscription !=null and askQuestions.subscription !=''">
|
||||
AND su.USID = #{askQuestions.subscription}
|
||||
</if>
|
||||
<if test="askQuestions.answerer != null and askQuestions.answerer != ''">
|
||||
AND au.USID = #{askQuestions.answerer}
|
||||
</if>
|
||||
<if test="askQuestions.problemDescription != null and askQuestions.problemDescription != ''">
|
||||
AND aq.PROBLEM_DESCRIPTION LIKE concat(concat('%',#{askQuestions.problemDescription}),'%')
|
||||
</if>
|
||||
<if test="askQuestions.answerer !=null and askQuestions.answerer !=''">
|
||||
AND reply.ANSWERER = #{askQuestions.answerer}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getSubscriptionByStandId" 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
|
||||
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
|
||||
LEFT JOIN ts_user t2 ON t2.USID = reply.ANSWERER
|
||||
LEFT JOIN subscription su ON su.ASK_ID = aq.ID
|
||||
<where>
|
||||
<if test="askQuestions.answerer !=null and askQuestions.answerer !=''">
|
||||
AND su.USID = #{askQuestions.answerer}
|
||||
</if>
|
||||
<if test="askQuestions.classification !=null and askQuestions.classification !=''">
|
||||
AND aq.CLASSIFICATION = #{askQuestions.classification}
|
||||
</if>
|
||||
<if test="askQuestions.standardId !=null and askQuestions.standardId !=''">
|
||||
AND aq.STANDARD_ID = #{askQuestions.standardId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="resemblance" resultType="com.adc.da.slrs.StandardQA.entity.AskQuestions">
|
||||
SELECT *,
|
||||
<foreach item="item" collection="chars" separator="+" open="(" close=")" index="">
|
||||
(case when PROBLEM_DESCRIPTION like CONCAT('%',#{item},'%') then 1 else 0 end)
|
||||
</foreach>
|
||||
as num from ask_questions having num >1 order by num DESC
|
||||
</select>
|
||||
|
||||
<select id="getUId" resultType="java.lang.String">
|
||||
SELECT tu.USID
|
||||
FROM ts_user tu
|
||||
LEFT JOIN ts_institution ti ON ti.id = tu.INSTITUTION_ID
|
||||
WHERE
|
||||
ti.`name`='标准法规部'
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user