xiaoyong931011
2021-07-14 32169b0b5af53ae87ccde57c31c1d6ad6e44a055
gc-user/src/main/resources/mapper/user/AccountMapper.xml
@@ -133,4 +133,73 @@
    </select>
    <insert id="insertScoreDetailsRet">
        insert into xzx_score_details (CREATED_TIME, user_id, type, original_score, change_score, current_score)
        values (
                   #{createdTime}, #{userId}, #{type}, #{originalScore}, #{changeScore}, #{currentScore}
               )
    </insert>
    <select id="selectOneByUserId" resultType="com.xzx.gc.entity.AccountInfo">
        select * from  xzx_account_info where user_id = #{userId}
    </select>
    <select id="selectDsitribListByQueryCol" resultType="com.xzx.gc.user.vo.DistribListVo">
        SELECT
        a.account_id id,
        a.is_head isHead,
        b.nick_name nickname,
        b.regist_time registTime,
        b.mobile_phone phone
        FROM
        xzx_account_info a
        LEFT JOIN xzx_user_info b on a.user_id = b.user_id
        <where>
            1=1
            <if test="record.queryCol != null and record.queryCol != ''">
                and (b.nick_name like concat('%',#{record.name},'%')
                or b.mobile_phone like concat('%',#{record.phone},'%') )
            </if>
        </where>
        order by id desc
    </select>
    <select id="selectDsitribInfoListByQueryCol" resultType="com.xzx.gc.user.vo.DistribInfoListVo">
        SELECT
        a.account_id id,
        b.nick_name nickname,
        b.mobile_phone phone,
        b.regist_time registTime,
        a.is_head isHead,
        (select IFNULL(count(1), 0) from xzx_user_head_relate where head_user_id = a.user_id GROUP BY head_user_id) cnt,
        (select IFNULL(count(1), 0) from xzx_user_head_details where head_user_id = a.user_id GROUP BY head_user_id) orderCnt,
        (select IFNULL(sum(amount), 0) from xzx_user_head_relate where head_user_id = a.user_id GROUP BY head_user_id) amount,
        (select IFNULL(sum(score), 0) from xzx_user_head_relate where head_user_id = a.user_id GROUP BY head_user_id) score,
        a.is_prohibit isProhibit
        FROM
        xzx_account_info a
        LEFT JOIN xzx_user_info b on a.user_id = b.user_id
        <where>
            1=1
            and a.is_head = 1
            <if test="record.name != null and record.name != ''">
                and b.nick_name like concat('%',#{record.name},'%')
            </if>
            <if test="record.phone != null and record.phone != ''">
                and b.mobile_phone like concat('%',#{record.phone},'%')
            </if>
            <if test="record.reserveTimeStart != null">
                and b.regist_time >= #{record.reserveTimeStart}
            </if>
            <if test="record.reserveTimeEnd != null">
                and b.regist_time &lt;= #{record.reserveTimeEnd}
            </if>
        </where>
         order by id desc
    </select>
</mapper>