package com.xhpc.user.mapper;

import com.xhpc.common.domain.XhpcRechargeOrder;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author yuyang
 * @date 2021/12/20 14:36
 */
public interface MechanismMapper {

    /**
     * 获取登陆用户信息
     */
    Map<String, Object> getLandUser(@Param("userId") Long userId);

    /**
     * 通过登录用户查询省地址
     * @param userId
     * @return 结果
     */
    public List<Map<String, Object>> groupProvinceById(@Param("userId") Long userId, @Param("type") Integer type, @Param("operatorId")Long operatorId);

    /**
     * 通过登录用户分组查询市地址
     * @return 结果
     */
    public List<Map<String, Object>> groupCityById(@Param("userId") Long userId, @Param("type") Integer type,@Param("provinceCode") String provinceCode, @Param("operatorId")Long operatorId);
    /**
     * 通过登录用户分组查询区地址
     * @return 结果
     */
    public List<Map<String, Object>> groupAreaById(@Param("userId") Long userId, @Param("type") Integer type,@Param("cityCode") String cityCode, @Param("operatorId")Long operatorId);

    /**
     * 通过登录用户分组查询运营商
     * @return 结果
     */
    public List<Map<String, Object>> groupOperatorById(@Param("userId") Long userId, @Param("type") Integer type,@Param("code") String cityCode,@Param("tenantId") String tenantId);

    /**
     * 通过登录用户分组查询场站
     * @return 结果
     */
    public List<Map<String, Object>> dataCodeById(@Param("userId") Long userId, @Param("type") Integer type,@Param("code") String cityCode);

    /**
     * 通过登录用户分组查询场站
     * @return 结果
     */
    public List<Map<String, Object>> dataChargingStationId(@Param("userId") Long userId, @Param("type") Integer type,@Param("operatorId") String operatorId,@Param("code") String cityCode,@Param("tenantId") String tenantId);


    /**
     * 删除该社区组的数据维度
     */
    int updateMechanism(@Param("mechanismId")Long mechanismId,@Param("source")Integer source);
    /**
     * 添加数据维度
     */
    int insertMechanism(@Param("chargingStationIds") List<String> chargingStationIds,@Param("mechanismId")Long mechanismId,@Param("source")Integer source);

    /**
     * 增加一条平台充值记录
     * @return
     */
    int insertRechargeOrder(XhpcRechargeOrder xhpcRechargeOrder);


    int insertUserAccount(@Param("userId")Long userId,@Param("amount")BigDecimal amount,@Param("remainingSum")BigDecimal remainingSum,@Param("chargeOrderId")Long chargeOrderId,@Param("rechargeOrderId")Long rechargeOrderId,@Param("refundOrderId")Long refundOrderId,@Param("type")Integer type,@Param("tenantId")String tenantId,@Param("source")Integer source,@Param("createTime") Date createTime);

    //获取租户
    List<Map<String, Object>> getTenantList(@Param("userId")Long userId,@Param("number")Integer number);

}
