package com.bonus.canteen.core.account.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bonus.canteen.core.account.domain.AccountInfo;
import com.bonus.canteen.core.account.domain.AccInfoVo;
import com.bonus.canteen.core.account.domain.param.AccountInfoQueryParam;
import com.bonus.canteen.core.account.domain.vo.AccInfoDetailsVO;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 账户资料Mapper接口
 * 
 * @author xsheng
 * @date 2025-04-05
 */
public interface AccInfoMapper extends BaseMapper<AccountInfo> {
    /**
     * 查询账户资料
     * 
     * @param accId 账户资料主键
     * @return 账户资料
     */
    public AccountInfo selectAccInfoById(@Param("accId") Long accId);

    /**
     * 查询账户资料列表
     * 
     * @param accountInfo 账户资料
     * @return 账户资料集合
     */
    public List<AccountInfo> selectAccInfoList(AccountInfo accountInfo);

    public AccInfoVo selectAccInfoVo(AccountInfo accountInfo);

    /**
     * 新增账户资料
     * 
     * @param accountInfo 账户资料
     * @return 结果
     */
    public int insertAccInfo(AccountInfo accountInfo);

    /**
     * 修改账户资料
     * 
     * @param accountInfo 账户资料
     * @return 结果
     */
    public int updateAccInfo(AccountInfo accountInfo);

    /**
     * 删除账户资料
     * 
     * @param id 账户资料主键
     * @return 结果
     */
    public int deleteAccInfoByUserId(Long id);

    /**
     * 批量删除账户资料
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteAccInfoByIds(Long[] ids);

    Integer queryAccInfoInvalidSum(@Param("startDateTime") LocalDateTime startDateTime, @Param("endDateTime") LocalDateTime endDateTime, @Param("accStatus") Integer accStatus);

    List<AccInfoDetailsVO> queryAccInfoDetails(@Param("accountInfoQueryParam") AccountInfoQueryParam accountInfoQueryParam,
                                               @Param("encryptedSearchValue") String encryptedSearchValue);

    AccInfoDetailsVO queryAccInfoBalanceSum(@Param("accountInfoQueryParam") AccountInfoQueryParam accountInfoQueryParam,
                                            @Param("encryptedSearchValue") String encryptedSearchValue);

    void updateAccInfoEndDateByUserId(@Param("endDate") LocalDate endDate,
                                      @Param("userIds") List<Long> userIds,
                                      @Param("updateBy") String updateBy);
    List<AccInfoDetailsVO> queryAccInfoByUserIds(@Param("userIds") List<Long> userIds);
    AccInfoDetailsVO queryAccInfoByUserId(@Param("userId") Long userId);

}
