| | |
| | | jhs.building, |
| | | jhs.district_code aoiCode, |
| | | jh.volunteer_org, |
| | | case |
| | | when TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) < 18 then 2 |
| | | when TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) >= 18 then 1 |
| | | end as minors, |
| | | jhs.unit |
| | | FROM |
| | | jczz_household jh |
| | |
| | | <if test="household.houseCode!=null and household.houseCode !=''"> |
| | | and jh.house_code = #{household.houseCode} |
| | | </if> |
| | | |
| | | <if test="household.communityCode!=null and household.communityCode !=''"> |
| | | and jg.community_code = #{household.communityCode} |
| | | </if> |
| | | <!-- 等于18 就是租户 --> |
| | | <if test="household.relationship!=null and household.relationship == 18"> |
| | | and jh.relationship = #{household.relationship} |
| | | |
| | | <if test="household.minors!=null and household.minors ==2"> |
| | | and TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) < 18 |
| | | </if> |
| | | <if test="household.minors!=null and household.minors ==1"> |
| | | and TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) >= 18 |
| | | </if> |
| | | </if> |
| | | <!-- 不等于18 就是非租户 --> |
| | | <if test="household.relationship!=null and household.relationship != 18"> |