101captain
2022-03-07 da8cca4d320908b672f439369e65e9e6a95374e3
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/mapper/UserDao.xml
@@ -38,6 +38,7 @@
        <result property="workStartTime" column="work_start_time"/>
        <result property="workEndTime" column="work_end_time"/>
        <result property="bigAgeTips" column="big_age_tips"/>
        <result property="plaintextPassword" column="plaintext_password"/>
    </resultMap>
    <sql id="columns">
@@ -48,14 +49,14 @@
    <select id="indexDataCommunityBackstage" resultType="com.panzhihua.common.model.vos.IndexDataVO">
        SELECT
        COUNT(DISTINCT u.user_id)allUser,
        (select COUNT(m.id) from com_mng_volunteer_mng m where m.community_id=#{communityId} and m.`state`=2)volunteerUser,
        (select COUNT(m.id) from com_mng_volunteer_mng m where m.community_id = #{communityId} and m.`state`=2)volunteerUser,
         (select count(id) from com_pb_member cpm where cpm.audit_result = 1 and cpm.community_id = #{communityId}) partymemberUser,
        COUNT(h.id)house
        FROM
        sys_user u
        JOIN com_act c ON u.community_id = c.community_id
        LEFT JOIN com_mng_struct_house_user h on u.user_id=h.user_id
        WHERE u.community_id =#{communityId} and u.type=1
        WHERE u.community_id = #{communityId} and u.type=1
    </select>
    <update id="timedTaskContinuousLandingDays">
@@ -78,7 +79,7 @@
        FROM
             com_pb_member_role a
        WHERE
             a.phone = #{phone} and community_id=#{userCommunityId}
             a.phone = #{phone} and community_id = #{userCommunityId}
    </select>
    <select id="pageUserAppletsBackstage" resultType="com.panzhihua.common.model.vos.user.SysUserVO">
@@ -100,7 +101,10 @@
            and u.phone=#{pageUserAppletsBackstageDTO.phone}
        </if>
        <if test='pageUserAppletsBackstageDTO.communityId != null and pageUserAppletsBackstageDTO.communityId != 0'>and
            u.community_id=#{pageUserAppletsBackstageDTO.communityId}
            u.community_id = #{pageUserAppletsBackstageDTO.communityId}
        </if>
        <if test='pageUserAppletsBackstageDTO.areaCode != null'>and
            a.area_code = #{pageUserAppletsBackstageDTO.areaCode}
        </if>
        <if test='pageUserAppletsBackstageDTO.status != null and pageUserAppletsBackstageDTO.status != 0'>and
            u.status=#{pageUserAppletsBackstageDTO.status}
@@ -120,10 +124,10 @@
        COUNT(user_id)allUser,
        COUNT(case WHEN DATE_FORMAT(t.create_at,'%m-%d-%Y')=DATE_FORMAT(SYSDATE(),'%m-%d-%Y') then user_id else null end )addUser,
        COUNT(case WHEN DATE_FORMAT(last_login_time,'%m-%d-%Y')=DATE_FORMAT(SYSDATE(),'%m-%d-%Y') then user_id else null end )activeDayUser,
        (SELECT count(user_id) FROM sys_user t left join com_act t1 on t.community_id = t1.community_id WHERE type = 1 and t1.area_code = '510423' AND last_login_time > date_sub(SYSDATE(), INTERVAL 7 DAY))activeWeekUser
        (SELECT count(user_id) FROM sys_user t left join com_act t1 on t.community_id = t1.community_id WHERE type = 1 and t1.area_code = #{areaCode} AND last_login_time > date_sub(SYSDATE(), INTERVAL 7 DAY))activeWeekUser
        FROM
        sys_user t LEFT JOIN com_act t1 on t.community_id = t1.community_id
        where t.type=1 and t.community_id is not null and t1.area_code ='510423'
        where t.type=1 and t.community_id is not null and t1.area_code = #{areaCode}
            </select>
    <select id="selectCommunityUserOrder" resultType="com.panzhihua.service_user.model.dtos.DataKanbanDTO">
@@ -135,7 +139,7 @@
        AND last_login_time > DATE_FORMAT( date_sub( SYSDATE(), INTERVAL 0 DAY ), '%Y-%m-%d 00:00:00')) as dayNum
        FROM
        com_act a
        LEFT JOIN sys_user u ON a.community_id = u.community_id and u.type=1 where a.area_code = '510423'
        LEFT JOIN sys_user u ON a.community_id = u.community_id and u.type=1 where a.area_code = #{areaCode}
        GROUP BY a.community_id)t ORDER BY t.num desc
    </select>
@@ -149,7 +153,7 @@
        FROM
        com_act a
        LEFT JOIN sys_user u ON a.community_id = u.community_id
        and u.type=1 and u.create_at >= DATE_ADD(curdate(),interval -day(curdate())+1 day) where a.area_code = '510423'
        and u.type=1 and u.create_at >= DATE_ADD(curdate(),interval -day(curdate())+1 day) where a.area_code = #{areaCode}
        GROUP BY a.community_id)t ORDER BY t.num desc
    </select>
@@ -169,10 +173,12 @@
        sys_user u
        JOIN sys_user_role r ON u.user_id = r.user_id
        JOIN sys_role e ON r.role_id = e.role_id
        left join com_act ca on u.community_id = ca.community_id
        <if test='administratorsUserVO.roleId != null and administratorsUserVO.roleId!=0'>and
            e.role_id=#{administratorsUserVO.roleId}
        </if>
        <where>
            u.type=3
            <if test='administratorsUserVO.communityId != null '>AND u.community_id =
                #{administratorsUserVO.communityId}
            </if>
@@ -181,6 +187,9 @@
            </if>
            <if test='administratorsUserVO.phone != null and administratorsUserVO.phone.trim() != &quot;&quot;'>AND
                u.phone like concat(#{administratorsUserVO.phone},'%')
            </if>
            <if test='administratorsUserVO.areaCode != null '>
                AND ca.area_code = #{administratorsUserVO.areaCode}
            </if>
            <if test='administratorsUserVO.account != null and administratorsUserVO.account.trim() != &quot;&quot;'>AND
                u.account like concat(#{administratorsUserVO.account},'%')
@@ -200,12 +209,12 @@
    <select id="selectCommunityAddUserOrder" resultType="com.panzhihua.service_user.model.dtos.DataKanbanDTO">
        select count(user_id) as num,
        (SELECT count( user_id ) FROM sys_user t LEFT JOIN com_act t1 on t.community_id=t1.community_id WHERE t.type = 1 and t1.area_code = '510423'
        (SELECT count( user_id ) FROM sys_user t LEFT JOIN com_act t1 on t.community_id=t1.community_id WHERE t.type = 1 and t1.area_code = #{areaCode}
        AND last_login_time <![CDATA[ >= ]]> DATE_FORMAT( #{date1}, '%Y-%m-%d 00:00:00')
        AND last_login_time <![CDATA[ <= ]]> DATE_FORMAT( #{date1}, '%Y-%m-%d 23:59:59')) as dayNum from sys_user as su LEFT JOIN com_act t1 on su.community_id = t1.community_id
        where su.create_at <![CDATA[ >= ]]> DATE_SUB(DATE_FORMAT(#{date1},'%Y-%m-%d 00:00:00'),INTERVAL 0 DAY)
        and su.create_at <![CDATA[ <= ]]> DATE_SUB(DATE_FORMAT(#{date1},'%Y-%m-%d 23:59:59'),INTERVAL 0 DAY)
        and su.type = 1 and t1.area_code='510423'
        and su.type = 1 and t1.area_code=#{areaCode}
    </select>
    <update id="gridMemberEditStatus">
@@ -266,7 +275,7 @@
        FROM
             sys_user u LEFT JOIN sys_user_role ur ON u.user_id = ur.user_id
             LEFT JOIN sys_role r ON ur.role_id = r.role_id
        WHERE ur.role_id IS  NOT NULL AND  u.phone = #{phone}  and r.community_id=#{userCommunityId}
        WHERE ur.role_id IS  NOT NULL AND  u.phone = #{phone}  and r.community_id = #{userCommunityId}
    </select>
    <delete id="delGridMemberRelation">
@@ -307,7 +316,7 @@
        <if test='loginUserInfoVO.communityName != null and loginUserInfoVO.communityName.trim() != &quot;&quot;'>
            AND c.`area_name` like concat(#{loginUserInfoVO.communityName},'%')
        </if>
        where u.face_state is not null and u.type=1 and u.community_id=#{loginUserInfoVO.communityId}
        where u.face_state is not null and u.type=1 and u.community_id = #{loginUserInfoVO.communityId}
        <if test='loginUserInfoVO.name != null and loginUserInfoVO.name.trim() != &quot;&quot;'>
            and u.`name` like concat(#{loginUserInfoVO.name},'%')
        </if>
@@ -331,7 +340,7 @@
        FROM
             com_pb_service_team a
        WHERE
             a.phone = #{phone} and community_id=#{userCommunityId}
             a.phone = #{phone} and community_id = #{userCommunityId}
    </select>
    <select id="selectExport" resultType="com.panzhihua.common.model.dtos.user.EexcelUserDTO">
@@ -372,7 +381,7 @@
        <if test='exportUserDTO.areaName != null and exportUserDTO.areaName.trim() != &quot;&quot;'>AND c.`area_name`
            like concat(#{exportUserDTO.areaName},'%')
        </if>
        where u.community_id=#{exportUserDTO.communityId} and u.type=1
        where u.community_id = #{exportUserDTO.communityId} and u.type=1
        <if
                test='exportUserDTO.name != null and exportUserDTO.name.trim() != &quot;&quot;'>and u.`name` like
            concat(#{exportUserDTO.name},'%')
@@ -429,7 +438,7 @@
    </update>
    <select id="selectCommunity" resultType="com.panzhihua.common.model.vos.community.ComActVO">
       select name from com_act where community_id=#{communityId}
       select * from com_act where community_id = #{communityId}
    </select>
    <delete id="delLcMember">
@@ -470,7 +479,7 @@
                AND ca.street_id = cs.street_id
            ) AS userNum
        FROM
            `com_street` AS cs where area_code='510423'
            `com_street` AS cs where area_code=#{areaCode}
            order by userNum desc
    </select>
@@ -511,7 +520,7 @@
            LEFT JOIN com_street AS cs ON cs.street_id = ca.street_id
        WHERE
            su.type = 1
            AND su.community_id IS NOT NULL and ca.area_code = '510423'
            AND su.community_id IS NOT NULL and ca.area_code = #{areaCode}
        GROUP BY
            ca.community_id
        ORDER BY
@@ -532,4 +541,9 @@
        select count(id) from com_act_social_org where user_id = #{userId}
    </select>
    <select id="countFmsMember" resultType="integer">
        SELECT COUNT(id) FROM com_fms_team_member
        WHERE phone = #{phone} AND community_id = #{communityId}
    </select>
</mapper>