修改查询语句

This commit is contained in:
wans 2020-12-01 14:40:46 +08:00
parent c6d82a4451
commit 3d3c90b6fa
6 changed files with 22 additions and 12 deletions

View File

@ -163,9 +163,10 @@
t2.telephone t2.telephone
FROM FROM
gen_addicts t1 gen_addicts t1
LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number AND t2.is_delete = '0' LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
AND t2.is_delete = 0
<if test="addictsId != null and addictsId != ''"> <if test="addictsId != null and addictsId != ''">
AND t1.addicts_id = #{addictsId} AND t1.addicts_id = #{addictsId}
</if> </if>
@ -197,9 +198,10 @@
CONCAT(t2.current_residence,t2.current_residence_addr) current_residence CONCAT(t2.current_residence,t2.current_residence_addr) current_residence
FROM FROM
gen_addicts t1 gen_addicts t1
LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number AND t2.is_delete = '0' LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
AND t2.is_delete = 0
<if test="keywords != null and keywords != ''"> <if test="keywords != null and keywords != ''">
AND ( AND (
t1.id_card_number LIKE CONCAT('%', #{keywords}, '%') t1.id_card_number LIKE CONCAT('%', #{keywords}, '%')

View File

@ -157,9 +157,10 @@
t2.telephone t2.telephone
FROM FROM
gen_aids t1 gen_aids t1
LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number AND t2.is_delete = '0' LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
AND t2.is_delete = 0
<if test="aidsId != null and aidsId != ''"> <if test="aidsId != null and aidsId != ''">
AND t1.aids_id = #{aidsId} AND t1.aids_id = #{aidsId}
</if> </if>
@ -190,9 +191,10 @@
CONCAT(t2.current_residence,t2.current_residence_addr) current_residence CONCAT(t2.current_residence,t2.current_residence_addr) current_residence
FROM FROM
gen_aids t1 gen_aids t1
LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number AND t2.is_delete = '0' LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
AND t2.is_delete = 0
<if test="keywords != null and keywords != ''"> <if test="keywords != null and keywords != ''">
AND ( AND (
t1.id_card_number LIKE CONCAT('%', #{keywords}, '%') t1.id_card_number LIKE CONCAT('%', #{keywords}, '%')

View File

@ -320,9 +320,9 @@
t1.is_delete = 0 t1.is_delete = 0
<if test="keywords != null and keywords != ''"> <if test="keywords != null and keywords != ''">
AND ( AND (
t1.id LIKE CONCAT('%', #{keywords}, '%') t1.full_name LIKE CONCAT('%', #{keywords}, '%')
OR OR
t1.base_population_info_id LIKE CONCAT('%', #{keywords}, '%') t1.id_card_number LIKE CONCAT('%', #{keywords}, '%')
<!-- 这里添加其他条件 --> <!-- 这里添加其他条件 -->
) )
</if> </if>

View File

@ -295,9 +295,10 @@
t2.telephone t2.telephone
FROM FROM
gen_community_correction t1 gen_community_correction t1
LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number AND t2.is_delete = '0' LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
AND t2.is_delete = 0
<if test="communityCorrectionId != null and communityCorrectionId != ''"> <if test="communityCorrectionId != null and communityCorrectionId != ''">
AND AND
t1.community_correction_id = #{communityCorrectionId} t1.community_correction_id = #{communityCorrectionId}
@ -348,9 +349,10 @@
CONCAT(t2.current_residence,t2.current_residence_addr) current_residence CONCAT(t2.current_residence,t2.current_residence_addr) current_residence
FROM FROM
gen_community_correction t1 gen_community_correction t1
LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number AND t2.is_delete = '0' LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
AND t2.is_delete = 0
<if test="keywords != null and keywords != ''"> <if test="keywords != null and keywords != ''">
AND ( AND (
t1.id_card_number LIKE CONCAT('%', #{keywords}, '%') t1.id_card_number LIKE CONCAT('%', #{keywords}, '%')

View File

@ -207,9 +207,10 @@
t2.telephone t2.telephone
FROM FROM
gen_mental_disorders t1 gen_mental_disorders t1
LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number AND t2.is_delete = '0' LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
AND t2.is_delete = 0
<if test="mentalDisordersId != null and mentalDisordersId != ''"> <if test="mentalDisordersId != null and mentalDisordersId != ''">
AND AND
t1.mental_disorders_id = #{mentalDisordersId} t1.mental_disorders_id = #{mentalDisordersId}
@ -248,9 +249,10 @@
CONCAT(t2.current_residence,t2.current_residence_addr) current_residence CONCAT(t2.current_residence,t2.current_residence_addr) current_residence
FROM FROM
gen_mental_disorders t1 gen_mental_disorders t1
LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number AND t2.is_delete = '0' LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
AND t2.is_delete = 0
<if test="keywords != null and keywords != ''"> <if test="keywords != null and keywords != ''">
AND ( AND (
t1.id_card_number LIKE CONCAT('%', #{keywords}, '%') t1.id_card_number LIKE CONCAT('%', #{keywords}, '%')

View File

@ -186,9 +186,10 @@
t2.telephone t2.telephone
FROM FROM
gen_release_after_sentence t1 gen_release_after_sentence t1
LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number AND t2.is_delete = '0' LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
AND t2.is_delete = 0
<if test="releaseAfterSentenceId != null and releaseAfterSentenceId != ''"> <if test="releaseAfterSentenceId != null and releaseAfterSentenceId != ''">
AND t1.release_after_sentence_id = #{releaseAfterSentenceId} AND t1.release_after_sentence_id = #{releaseAfterSentenceId}
</if> </if>
@ -223,9 +224,10 @@
CONCAT(t2.current_residence,t2.current_residence_addr) current_residence CONCAT(t2.current_residence,t2.current_residence_addr) current_residence
FROM FROM
gen_release_after_sentence t1 gen_release_after_sentence t1
LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number AND t2.is_delete = '0' LEFT JOIN gen_base_population_info t2 ON t1.id_card_number = t2.id_card_number
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
AND t2.is_delete = 0
<if test="keywords != null and keywords != ''"> <if test="keywords != null and keywords != ''">
AND ( AND (
t1.id_card_number LIKE CONCAT('%', #{keywords}, '%') t1.id_card_number LIKE CONCAT('%', #{keywords}, '%')