//package com.xiaopeng.account.service.impl; // //import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; //import com.baomidou.mybatisplus.extension.plugins.pagination.Page; //import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; //import com.xiaopeng.account.mapper.XpAppUserCollectAddrMapper; //import com.xiaopeng.account.model.dto.CollectAddrDTO; //import com.xiaopeng.account.model.query.XpUserCollectAddrListQuery; //import com.xiaopeng.account.model.vo.XpAppUserCollectAddrVO; //import com.xiaopeng.account.service.IXpAppUserCollectAddrService; //import com.xiaopeng.api.model.account.XpAppUserCollectAddr; //import com.xiaopeng.common.core.exception.ServiceException; //import com.xiaopeng.common.core.web.page.PageInfo; // ///** // *

// * 用户收藏地址 服务实现类 // *

// * // * @author ck // * @since 2026-04-10 // */ //public class XpAppUserCollectAddrServiceImpl extends ServiceImpl implements IXpAppUserCollectAddrService { // // /** // * 收藏地址 // * // * @param dto // * @param uid // * @return // */ // @Override // public Boolean collectAddr(CollectAddrDTO dto, String uid) { // if (dto.getType() == 1) { // Long count = this.count(new LambdaQueryWrapper() // .eq(XpAppUserCollectAddr::getAppUserId, Long.parseLong(uid)) // .eq(XpAppUserCollectAddr::getDeleted, 0)); // if (count >= 50) { // throw new ServiceException("收藏夹已满,请先删除旧地址"); // } // Long old = this.count(new LambdaQueryWrapper() // .eq(XpAppUserCollectAddr::getAppUserId, Long.parseLong(uid)) // .eq(XpAppUserCollectAddr::getDeleted, 0).eq(XpAppUserCollectAddr::getLongitude, dto.getLongitude()) // .eq(XpAppUserCollectAddr::getLatitude, dto.getLatitude())); // if (old > 0) { // return true; // } // XpAppUserCollectAddr xpAppUserCollectAddr = new XpAppUserCollectAddr(); // xpAppUserCollectAddr.setAppUserId(Long.parseLong(uid)); // xpAppUserCollectAddr.setLatitude(dto.getLatitude()); // xpAppUserCollectAddr.setLongitude(dto.getLongitude()); // return this.save(xpAppUserCollectAddr); // } else { // XpAppUserCollectAddr xpAppUserCollectAddr = this.getOne(new LambdaQueryWrapper() // .eq(XpAppUserCollectAddr::getAppUserId, Long.parseLong(uid)) // .eq(XpAppUserCollectAddr::getDeleted, 0).eq(XpAppUserCollectAddr::getLongitude, dto.getLongitude()) // .eq(XpAppUserCollectAddr::getLatitude, dto.getLatitude()).last("limit 1")); // // if (xpAppUserCollectAddr != null) { // return this.removeById(xpAppUserCollectAddr.getId()); // } // } // return false; // } // // /** // * 收藏地址列表 // * // * @param uid // * @return // */ // @Override // public PageInfo userCollectAddrList(XpUserCollectAddrListQuery query, String uid) { // Page page = new Page<>(query.getPageNum(), query.getPageSize()); // Page pageData = this.baseMapper.userCollectAddrPageList(page, query, Long.parseLong(uid)); // PageInfo resultPage = new PageInfo<>(query.getPageNum(), query.getPageSize()); // resultPage.setTotal(pageData.getTotal()); // resultPage.setRecords(pageData.getRecords()); // return resultPage; // } //}