admin
2025-02-25 30d8e227e8d823b6c38c3b9c90ac2df03b63befe
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserInfoMapper.java
@@ -1,252 +1,228 @@
package com.yeshi.fanli.dao.mybatis;
import java.math.BigDecimal;
import java.util.List;
import com.yeshi.fanli.entity.SystemEnum;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dto.ChartTDO;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.vo.user.UserInfoVO;
public interface UserInfoMapper {
    int deleteByPrimaryKey(Long id);
    int insert(UserInfo record);
    int insertSelective(UserInfo record);
    UserInfo selectByPrimaryKey(Long id);
    /**
     * 查询有效的
     *
     * @param id
     * @return
     */
    UserInfo selectAvailableByPrimaryKey(Long id);
    UserInfo selectByPrimaryKeyForUpdate(Long id);
    int updateByPrimaryKeySelective(UserInfo record);
    int updateByPrimaryKey(UserInfo record);
    // 减掉用户红包金额
    int subHongBaoByUid(@Param("uid") long uid, @Param("money") BigDecimal money);
    // 增加用户红包金额
    int addHongBaoByUid(@Param("uid") long uid, @Param("money") BigDecimal money);
    void cleanPassword(long id);
    BigDecimal getNewPeopleHB(Long id);
    BigDecimal getMyHB(Long id);
    // 根据AppId与微信unionID获取用户
    /**
     * 根据系统与微信unionId获取用户
     *
     * @param system
     * @param unionId
     * @return
     */
    List<UserInfo> listBySystemAndWXUnionId(@Param("system") SystemEnum system, @Param("unionId") String unionId);
    /**
     * 根据系统与淘宝的openid获取用户
     *
     * @param system
     * @param openId
     * @return
     */
    List<UserInfo> listBySystemAndTaoBaoOpenId(@Param("system") SystemEnum system, @Param("openId") String openId);
    /**
     * 根据系统与电话号码获取用户
     *
     * @param system
     * @param phone
     * @return
     */
    List<UserInfo> listBySystemAndPhone(@Param("system") SystemEnum system, @Param("phone") String phone);
    // 根据获取电话号码有效用户
    UserInfo getEffectiveUserInfoByPhone(@Param("phone") String phone, @Param("system") SystemEnum system);
    // 根据获WXUnionId有效用户
    UserInfo getEffectiveUserInfoByWXUnionId(@Param("unionId") String unionId, @Param("system") SystemEnum system);
    //根据微信openid查询
    UserInfo getEffectiveUserInfoByWXOpenId(@Param("wxOpenId") String wxOpenId, @Param("system") SystemEnum system);
    Long getMaxUid();
    List<UserInfoVO> queryInfo(@Param("start") long start, @Param("count") int count, @Param("userState") Integer userState,
                               @Param("key") String key, @Param("keyType") Integer keyType, @Param("userRank") String userRank,
                               @Param("days") Integer days, @Param("startTime") String startTime, @Param("endTime") String endTime,
                               @Param("userType") Integer userType, @Param("level") String level, @Param("activeCode") Integer activeCode, @Param("system") SystemEnum system);
    long countInfo(@Param("userState") Integer userState, @Param("key") String key, @Param("keyType") Integer keyType,
                   @Param("userRank") String userRank, @Param("days") Integer days, @Param("startTime") String startTime,
                   @Param("endTime") String endTime, @Param("userType") Integer userType, @Param("level") String level,
                   @Param("activeCode") Integer activeCode, @Param("system") SystemEnum system);
    /**
     * @param start
     * @param count
     * @param key       查询条件
     * @param userType  用户类型
     * @param days      天数
     * @param startTime 注册时间 -小
     * @param endTime   注册时间 -大
     * @param orderMode 排序方式
     * @return
     */
    List<UserInfoVO> query(@Param("start") long start, @Param("count") int count, @Param("userState") Integer userState,
                           @Param("key") String key, @Param("keyType") Integer keyType, @Param("userRank") String userRank,
                           @Param("days") Integer days, @Param("startTime") String startTime, @Param("endTime") String endTime,
                           @Param("orderField") Integer orderField, @Param("orderMode") Integer orderMode,
                           @Param("userType") Integer userType, @Param("level") String level, @Param("activeCode") Integer activeCode, @Param("system") SystemEnum system);
    long queryCount(@Param("userState") Integer userState, @Param("key") String key, @Param("keyType") Integer keyType,
                    @Param("userRank") String userRank, @Param("days") Integer days, @Param("startTime") String startTime,
                    @Param("endTime") String endTime, @Param("userType") Integer userType, @Param("level") String level,
                    @Param("activeCode") Integer activeCode, @Param("system") SystemEnum system);
    /**
     * 统计当前查询结果总金额
     *
     * @param title
     * @param userType
     * @param days
     * @param startTime
     * @param endTime
     * @return
     */
    double querySumMoney(@Param("key") String key, @Param("userType") Integer userType, @Param("days") Integer days,
                         @Param("startTime") String startTime, @Param("endTime") String endTime);
    /**
     * 统计用户数量
     *
     * @param isToday 统计今日
     * @param isMonth 统计当月 二则不可同时存在
     * @return
     */
    long countNewUser(@Param("isToday") Integer isToday, @Param("isMonth") Integer isMonth);
    /**
     * 根据等级统计用户数量
     *
     * @param rank
     * @return
     */
    long countRank(@Param("rank") Integer rank);
    /**
     * 统计所有用户总金额 或 可提现金额
     *
     * @param minMoney
     * @return
     */
    BigDecimal countAllMoney(@Param("minMoney") Double minMoney);
    /**
     * 超过 daysNum 天未登陆的用户
     *
     * @param minMoney
     * @return
     */
    List<Long> longTimeNoLogin(@Param("daysNum") int daysNum, @Param("list") List<Long> list);
    /**
     * 统计流失用户数量:( num 天未使用登录并且无任何资金流动的账号数量)
     *
     * @param num 180
     * @return
     */
    long countLoseUser(@Param("num") int num);
    /**
     * 累计有购买用户数
     *
     * @return
     */
    long countHasOrderUser();
    /**
     * 统计新增用户
     *
     * @return
     */
    List<ChartTDO> countNewUserByDate(@Param("channel") String channel, @Param("type") Integer type,
                                      @Param("years") String years, @Param("startTime") String startTime, @Param("endTime") String endTime);
    /**
     * 统计新增用户当日产生订单用户数量
     *
     * @return
     */
    List<ChartTDO> getTodayHasOrder(@Param("channel") String channel, @Param("type") Integer type,
                                    @Param("years") String years, @Param("startTime") String startTime, @Param("endTime") String endTime);
    /**
     * 统计新增用户一周产生订单用户数量
     *
     * @return
     */
    ChartTDO getWeekHasOrder(@Param("channel") String channel, @Param("startTime") String startTime,
                             @Param("endTime") String endTime, @Param("orderNum") Integer orderNum);
    /**
     * 根据电话号码、邀请码获取邀请用户
     *
     * @param phone
     * @param inviteCode
     * @return
     */
    UserInfo getUserInfoByInviteCode(@Param("inviteCode") String inviteCode);
    // 根据AppId与电话号码获取用户
    List<UserInfo> listByClosed(@Param("appId") String appId, @Param("phone") String phone);
    long countAvaiableUser();
    /**
     * 查询满足自动提现用户
     *
     * @param start
     * @param count
     * @return
     */
    List<UserInfo> getAutoExtractUser(@Param("start") int start, @Param("count") int count,
                                      @Param("money") BigDecimal money, @Param("beganDate") String beganDate, @Param("endDate") String endDate);
    /**
     * 根据type检索
     *
     * @param type
     * @param start
     * @param count
     * @return
     */
    List<UserInfo> listByType(@Param("type") int type, @Param("start") long start, @Param("count") int count);
    long countByType(int type);
    /**
     * 查询满足自动提现用户
     *
     * @param start
     * @param count
     * @return
     */
    List<UserInfo> getAutoExtractUserTo1212(@Param("start") int start, @Param("count") int count);
package com.yeshi.fanli.dao.mybatis;
import java.math.BigDecimal;
import java.util.List;
import com.ks.lijin.query.BaseDaoQuery;
import com.yeshi.fanli.entity.SystemEnum;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dto.ChartTDO;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.vo.user.UserInfoVO;
public interface UserInfoMapper {
    int deleteByPrimaryKey(Long id);
    int insert(UserInfo record);
    int insertSelective(UserInfo record);
    UserInfo selectByPrimaryKey(Long id);
    /**
     * 查询有效的
     *
     * @param id
     * @return
     */
    UserInfo selectAvailableByPrimaryKey(Long id);
    UserInfo selectByPrimaryKeyForUpdate(Long id);
    int updateByPrimaryKeySelective(UserInfo record);
    int updateByPrimaryKey(UserInfo record);
    // 减掉用户红包金额
    int subHongBaoByUid(@Param("uid") long uid, @Param("money") BigDecimal money);
    // 增加用户红包金额
    int addHongBaoByUid(@Param("uid") long uid, @Param("money") BigDecimal money);
    void cleanPassword(long id);
    BigDecimal getNewPeopleHB(Long id);
    BigDecimal getMyHB(Long id);
    List<UserInfo> list(@Param("query") DaoQuery query);
    Long getMaxUid();
    List<UserInfoVO> queryInfo(@Param("start") long start, @Param("count") int count, @Param("userState") Integer userState,
                               @Param("key") String key, @Param("keyType") Integer keyType, @Param("userRank") String userRank,
                               @Param("days") Integer days, @Param("startTime") String startTime, @Param("endTime") String endTime,
                               @Param("userType") Integer userType, @Param("level") String level, @Param("activeCode") Integer activeCode, @Param("system") SystemEnum system);
    long countInfo(@Param("userState") Integer userState, @Param("key") String key, @Param("keyType") Integer keyType,
                   @Param("userRank") String userRank, @Param("days") Integer days, @Param("startTime") String startTime,
                   @Param("endTime") String endTime, @Param("userType") Integer userType, @Param("level") String level,
                   @Param("activeCode") Integer activeCode, @Param("system") SystemEnum system);
    /**
     * @param start
     * @param count
     * @param key       查询条件
     * @param userType  用户类型
     * @param days      天数
     * @param startTime 注册时间 -小
     * @param endTime   注册时间 -大
     * @param orderMode 排序方式
     * @return
     */
    List<UserInfoVO> query(@Param("start") long start, @Param("count") int count, @Param("userState") Integer userState,
                           @Param("key") String key, @Param("keyType") Integer keyType, @Param("userRank") String userRank,
                           @Param("days") Integer days, @Param("startTime") String startTime, @Param("endTime") String endTime,
                           @Param("orderField") Integer orderField, @Param("orderMode") Integer orderMode,
                           @Param("userType") Integer userType, @Param("level") String level, @Param("activeCode") Integer activeCode, @Param("system") SystemEnum system);
    long queryCount(@Param("userState") Integer userState, @Param("key") String key, @Param("keyType") Integer keyType,
                    @Param("userRank") String userRank, @Param("days") Integer days, @Param("startTime") String startTime,
                    @Param("endTime") String endTime, @Param("userType") Integer userType, @Param("level") String level,
                    @Param("activeCode") Integer activeCode, @Param("system") SystemEnum system);
    /**
     * 统计当前查询结果总金额
     *
     * @param title
     * @param userType
     * @param days
     * @param startTime
     * @param endTime
     * @return
     */
    double querySumMoney(@Param("key") String key, @Param("userType") Integer userType, @Param("days") Integer days,
                         @Param("startTime") String startTime, @Param("endTime") String endTime);
    /**
     * 统计用户数量
     *
     * @param isToday 统计今日
     * @param isMonth 统计当月 二则不可同时存在
     * @return
     */
    long countNewUser(@Param("isToday") Integer isToday, @Param("isMonth") Integer isMonth);
    /**
     * 根据等级统计用户数量
     *
     * @param rank
     * @return
     */
    long countRank(@Param("rank") Integer rank);
    /**
     * 统计所有用户总金额 或 可提现金额
     *
     * @param minMoney
     * @return
     */
    BigDecimal countAllMoney(@Param("minMoney") Double minMoney);
    /**
     * 超过 daysNum 天未登陆的用户
     *
     * @param minMoney
     * @return
     */
    List<Long> longTimeNoLogin(@Param("daysNum") int daysNum, @Param("list") List<Long> list);
    /**
     * 统计流失用户数量:( num 天未使用登录并且无任何资金流动的账号数量)
     *
     * @param num 180
     * @return
     */
    long countLoseUser(@Param("num") int num);
    /**
     * 累计有购买用户数
     *
     * @return
     */
    long countHasOrderUser();
    /**
     * 统计新增用户
     *
     * @return
     */
    List<ChartTDO> countNewUserByDate(@Param("channel") String channel, @Param("type") Integer type,
                                      @Param("years") String years, @Param("startTime") String startTime, @Param("endTime") String endTime);
    /**
     * 统计新增用户当日产生订单用户数量
     *
     * @return
     */
    List<ChartTDO> getTodayHasOrder(@Param("channel") String channel, @Param("type") Integer type,
                                    @Param("years") String years, @Param("startTime") String startTime, @Param("endTime") String endTime);
    /**
     * 统计新增用户一周产生订单用户数量
     *
     * @return
     */
    ChartTDO getWeekHasOrder(@Param("channel") String channel, @Param("startTime") String startTime,
                             @Param("endTime") String endTime, @Param("orderNum") Integer orderNum);
    /**
     * 根据电话号码、邀请码获取邀请用户
     *
     * @param phone
     * @param inviteCode
     * @return
     */
    UserInfo getUserInfoByInviteCode(@Param("inviteCode") String inviteCode);
    // 根据AppId与电话号码获取用户
    List<UserInfo> listByClosed(@Param("appId") String appId, @Param("phone") String phone);
    long countAvaiableUser();
    /**
     * 查询满足自动提现用户
     *
     * @param start
     * @param count
     * @return
     */
    List<UserInfo> getAutoExtractUser(@Param("start") int start, @Param("count") int count,
                                      @Param("money") BigDecimal money, @Param("beganDate") String beganDate, @Param("endDate") String endDate);
    /**
     * 根据type检索
     *
     * @param type
     * @param start
     * @param count
     * @return
     */
    List<UserInfo> listByType(@Param("type") int type, @Param("start") long start, @Param("count") int count);
    long countByType(int type);
    /**
     * 查询满足自动提现用户
     *
     * @param start
     * @param count
     * @return
     */
    List<UserInfo> getAutoExtractUserTo1212(@Param("start") int start, @Param("count") int count);
    public static class DaoQuery extends BaseDaoQuery {
        public String phone;
        public String wxUnionId;
        public String openId;
        public String qqOpenId;
        public SystemEnum system;
        public Integer state;
    }
}