feat:饭卡支付

This commit is contained in:
dzc committed 2026-03-20 16:52:10 +08:00
1 parent 23bb5fa2f9
commit a42caa090e
14 files changed
+320 -47

No files matched your search

@@ -72,7 +72,8 @@ public enum HardPayTypeEnum {
// 简单支付(没有购物车)
public static final List<HardPayTypeEnum> isSimplePayList = List.of(
WALLET_QR_CODE_SCAN,
ACT_CANCEL
ACT_CANCEL,
WALLET_CARD
);
public static HardPayTypeEnum valueOfByType(String type) {
@@ -17,6 +17,11 @@ public class HardXfjFastCreateOrderDto {
*/
private Long hardId;
/**
* 订单编号
*/
private String orderNo;
/**
* 支付金额(分)
*/
@@ -13,11 +13,11 @@ public class XfjWhiteListDto {
/**
* 页数
*/
private Integer Page;
private Long Page;
/**
* 页个数(一页最多有多少个名单)
*/
private Integer PageNumber;
private Long PageNumber;
}
@@ -35,7 +35,7 @@ public class HardOrderEntity extends Model<HardOrderEntity> {
/**
* 订单编号
*/
@Schema(description = "订单编号 目前正元、微信支付、支付宝支付正在使用")
@Schema(description = "订单编号 目前正元、微信支付、云消费机、支付宝支付正在使用")
private String orderNo;
/**
@@ -8,17 +8,17 @@ public class XfjWhiteListVo extends XfjBaseVo {
/**
* 返回设备提交的序号
*/
private String CommID;
private Integer CommID;
/**
* 页数(获取那一页的数据)
*/
private String Page;
private Long Page;
/**
* 名单个数
*/
private String PageLen;
private Long PageLen;
/**
* 白名单数据(1|0000000001|1,序号|卡号|操作)
@@ -113,7 +113,7 @@ public class HardXfjController {
return hardXfjService.offLines(httpEntity.getBody(), headers);
}
@Operation(summary = "获取白名单接口")
@Operation(summary = "获取卡号白名单接口")
@PostMapping("/v1/WhiteList")
@Inner(value = false)
public Object whiteList(HttpEntity<String> httpEntity, @RequestHeader Map<String, String> headers) {
@@ -824,6 +824,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
// 添加硬件订单
HardOrderEntity orderObj = HardOrderEntity.builder()
.userId(dto.getUserId())
.orderNo(dto.getOrderNo())
.userDeptId(userDetail.getSysUser().getDeptId())
.merchantId(mch.getId())
.merchantType(mch.getTypes())
@@ -8,14 +8,12 @@ import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.admin.api.dto.UserInfo;
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
import com.bsd.pjcloud.hard.api.constant.xfj.HardXfjTypeEnum;
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
import com.bsd.pjcloud.hard.api.dto.order.xfj.HardXfjFastCreateOrderDto;
import com.bsd.pjcloud.hard.api.dto.xfj.XfjQRCodeTransactionDto;
import com.bsd.pjcloud.hard.api.dto.xfj.XfjTransactionDto;
import com.bsd.pjcloud.hard.api.dto.xfj.XfjTransactionInquiryDto;
import com.bsd.pjcloud.hard.api.dto.xfj.XfjOrderRefundDto;
import com.bsd.pjcloud.hard.api.dto.xfj.*;
import com.bsd.pjcloud.hard.api.entity.manager.HardManagerEntity;
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
import com.bsd.pjcloud.hard.api.entity.xfj.HardXfjLogEntity;
@@ -26,7 +24,9 @@ import com.bsd.pjcloud.hard.api.vo.xfj.*;
import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
import com.bsd.pjcloud.hard.service.*;
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletCodeUseEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
import com.bsd.pjcloud.wallet.api.feign.RemoteCodeUseService;
import com.bsd.pjcloud.wallet.api.feign.RemoteWalletService;
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
@@ -39,8 +39,11 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Validated
@Slf4j
@@ -124,6 +127,7 @@ public class HardXfjServiceImpl implements HardXfjService {
@Override
public XfjServerTimeVo serverTime(String body, Map<String, String> headers) {
HardXfjLogEntity logger = initLogger(body, headers, "获取服务器时间接口");
XfjServerTimeVo result = new XfjServerTimeVo();
try {
HardManagerEntity entity = checkSignAndReturnConfig(body, headers);
logger.setUniqueCode(entity.getUniqueCode());
@@ -137,8 +141,6 @@ public class HardXfjServiceImpl implements HardXfjService {
}
timeStr += dayOfWeek;
XfjServerTimeVo result = new XfjServerTimeVo();
result.setTime(timeStr);
result.setWLUptate(1);
result.setWLPage(0);
@@ -148,10 +150,12 @@ public class HardXfjServiceImpl implements HardXfjService {
logger.setError(e.getMessage());
e.printStackTrace();
log.error("|获取服务器时间接口|意外的错误error:{}", e.getMessage());
result.setStatus(XfjBaseVo.STATUS_FAIL);
result.setMsg(e.getMessage());
return result;
} finally {
saveLogger(logger);
}
return null;
}
/**
@@ -159,14 +163,116 @@ public class HardXfjServiceImpl implements HardXfjService {
*/
@Override
public XfjConsumTransactionsVo consumTransactions(String body, Map<String, String> headers) {
HardManagerEntity entity = checkSignAndReturnConfig(body, headers);
HardXfjLogEntity logger = initLogger(body, headers, "用户刷卡综合接口");
XfjConsumTransactionsVo result = new XfjConsumTransactionsVo();
try {
HardManagerEntity entity = checkSignAndReturnConfig(body, headers);
logger.setUniqueCode(entity.getUniqueCode());
// 获取参数
XfjConsumTransactionsDto dto = JSONUtil.toBean(body, XfjConsumTransactionsDto.class);
if (ObjectUtil.isEmpty(dto)) {
throw new RuntimeException("解析参数为空");
}
if (!ObjectUtil.isAllNotEmpty(dto.getMode(), dto.getCardNo(), dto.getCardMode(), dto.getOrder())) {
throw new RuntimeException("解析参数错误");
}
// 刷卡扣费
if (ObjectUtil.equals(dto.getMode(), 0)) {
WalletManageEntity wallet = walletService.getWalletByCardNumber(dto.getCardNo()).getData();
if (ObjectUtil.isEmpty(wallet)) {
throw new RuntimeException("非本单位饭卡");
}
// 查询用户
String username = "未知用户";
UserInfo user = remoteUserService.getInnerByUserId(wallet.getUserId()).getData();
if (ObjectUtil.isNotEmpty(user) && ObjectUtil.isNotEmpty(user.getSysUser().getName())) {
username = user.getSysUser().getName();
}
// 解析金额
int price = BigDecimal.valueOf(Double.valueOf(dto.getAmount())).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).intValue();
HardXfjFastCreateOrderDto payDto = new HardXfjFastCreateOrderDto();
payDto.setUserId(user.getSysUser().getUserId());
payDto.setHardId(entity.getId());
payDto.setPrice(price);
payDto.setOrderNo(dto.getOrder());
payDto.setWalletType(WalletTypeEnum.EAT);
payDto.setXfjPayType(HardXfjTypeEnum.CARD_PAY);
Long orderId = hardOrderService.xfjFastCreateOrder(payDto);
result.setName(username);
result.setCardNo(wallet.getCardNumber());
result.setMoney(fenToYuan(BigDecimal.valueOf(wallet.getBalance())));
result.setSubsidy("0");
result.setTimes("0");
result.setIntegral("0");
result.setInTime("");
result.setOutTime("");
result.setCumulativeTime("");
result.setAmount(dto.getAmount());
result.setVoiceID("");
result.setText("购买成功\r\n总消费" + dto.getAmount() + "元");
return result;
}
// 现金充值
else if (ObjectUtil.equals(dto.getMode(), 1)) {
result.setStatus(XfjBaseVo.STATUS_FAIL);
result.setMsg("不支持现金充值");
return result;
}
// 余额查询
else if (ObjectUtil.equals(dto.getMode(), 2)) {
WalletManageEntity wallet = walletService.getWalletByCardNumber(dto.getCardNo()).getData();
if (ObjectUtil.isEmpty(wallet)) {
throw new RuntimeException("非本单位饭卡");
}
// 查询用户
String username = "未知用户";
UserInfo user = remoteUserService.getInnerByUserId(wallet.getUserId()).getData();
if (ObjectUtil.isNotEmpty(user) && ObjectUtil.isNotEmpty(user.getSysUser().getName())) {
username = user.getSysUser().getName();
}
result.setName(username);
result.setCardNo(wallet.getCardNumber());
result.setMoney(fenToYuan(BigDecimal.valueOf(wallet.getBalance())));
result.setSubsidy("0");
result.setTimes("0");
result.setIntegral("0");
result.setInTime("");
result.setOutTime("");
result.setCumulativeTime("");
result.setAmount("");
result.setVoiceID("");
result.setText("购买成功\r\n总消费" + dto.getAmount() + "元");
return result;
}
// 钱包转账
else if (ObjectUtil.equals(dto.getMode(), 3)) {
result.setStatus(XfjBaseVo.STATUS_FAIL);
result.setMsg("不支持钱包转账");
return result;
}
// 现金退款
else if (ObjectUtil.equals(dto.getMode(), 4)) {
result.setStatus(XfjBaseVo.STATUS_FAIL);
result.setMsg("不支持现金退款");
return result;
} else {
result.setStatus(XfjBaseVo.STATUS_FAIL);
result.setMsg("不支持的操作");
return result;
}
} catch (Exception e) {
logger.setError(e.getMessage());
e.printStackTrace();
log.error("|用户刷卡综合接口|意外的错误error:{}", e.getMessage());
result.setStatus(XfjBaseVo.STATUS_FAIL);
result.setMsg(e.getMessage());
return result;
} finally {
logger.setRes(JSONUtil.toJsonStr(result));
saveLogger(logger);
}
return null;
}
/**
@@ -231,11 +337,13 @@ public class HardXfjServiceImpl implements HardXfjService {
logger.setError(e.getMessage());
e.printStackTrace();
log.error("|终端查询日统计接口|意外的错误error:{}", e.getMessage());
result.setStatus(XfjBaseVo.STATUS_FAIL);
result.setMsg(e.getMessage());
return result;
} finally {
logger.setRes(JSONUtil.toJsonStr(result));
saveLogger(logger);
}
return null;
}
/**
@@ -339,12 +447,14 @@ public class HardXfjServiceImpl implements HardXfjService {
} catch (Exception e) {
logger.setError(e.getMessage());
e.printStackTrace();
log.error("|终端设备待查状态,按上翻/下翻键向服务器请求,服务器返回一条消费明细(或者退款接口)|意外的错误error:{}", e.getMessage());
log.error("|终端设备待查状态,按上翻/下翻键向服务器请求,服务器返回一条消费明细|意外的错误error:{}", e.getMessage());
result.setStatus(XfjBaseVo.STATUS_FAIL);
result.setMsg(e.getMessage());
return result;
} finally {
logger.setRes(JSONUtil.toJsonStr(result));
saveLogger(logger);
}
return null;
}
/**
@@ -573,17 +683,66 @@ public class HardXfjServiceImpl implements HardXfjService {
}
/**
* 获取白名单接口
* 获取卡号白名单接口
*/
@Override
public XfjWhiteListVo whiteList(String body, Map<String, String> headers) {
HardManagerEntity entity = checkSignAndReturnConfig(body, headers);
HardXfjLogEntity logger = initLogger(body, headers, "获取卡号白名单接口");
XfjWhiteListVo result = new XfjWhiteListVo();
try {
HardManagerEntity entity = checkSignAndReturnConfig(body, headers);
logger.setUniqueCode(entity.getUniqueCode());
// 获取参数
XfjWhiteListDto dto = JSONUtil.toBean(body, XfjWhiteListDto.class);
if (ObjectUtil.isEmpty(dto)) {
throw new RuntimeException("解析参数为空");
}
if (!ObjectUtil.isAllNotEmpty(dto.getPage(), dto.getPageNumber(), dto.getCommID())) {
throw new RuntimeException("解析参数错误");
}
// 查询开卡数据
Page<WalletActiveEntity> walletActivePage = walletService.remoteOpenCardList(dto.getPage(), dto.getPageNumber()).getData();
if (ObjectUtil.isEmpty(walletActivePage) || ObjectUtil.isEmpty(walletActivePage.getRecords())) {
throw new RuntimeException("查询开卡数据为空");
}
List<WalletActiveEntity> walletActiveRecords = walletActivePage.getRecords();
List<String> whiteCarList = new ArrayList<>();
// 是否查询结束
boolean isSelectEnd = false;
if (walletActiveRecords.size() < dto.getPageNumber()) {
isSelectEnd = true;
}
for (WalletActiveEntity item : walletActiveRecords) {
String whiteCarNumber = generateWhiteCarNumber(String.valueOf(item.getCardSort()), item.getCardNumber(), ObjectUtil.equals(item.getDelFlag(), YesNoEnum.YES.getCode()) ? "0" : "1");
whiteCarList.add(whiteCarNumber);
}
result.setCommID(dto.getCommID());
result.setPage(dto.getPage());
result.setPageLen(dto.getPageNumber());
result.setUptate(isSelectEnd ? "0" : "1");
result.setWLData(whiteCarList.stream().collect(Collectors.joining(",")));
return result;
} catch (Exception e) {
logger.setError(e.getMessage());
e.printStackTrace();
log.error("|获取白名单接口|意外的错误error:{}", e.getMessage());
log.error("|获取卡号白名单接口|意外的错误error:{}", e.getMessage());
result.setStatus(XfjBaseVo.STATUS_FAIL);
result.setMsg(e.getMessage());
return result;
} finally {
saveLogger(logger);
}
return null;
}
/**
* 生成白名单需要的卡号格式
*
* @param serialNumber 序号(1、2、3)
* @param carNumber 卡号(0000000001)
* @param operationType 操作类型(1:添加;0:删除;)
*/
private String generateWhiteCarNumber(String serialNumber, String carNumber, String operationType) {
return String.format("%s|%s|%s", serialNumber, carNumber, operationType);
}
}
@@ -1,11 +1,13 @@
package com.bsd.pjcloud.wallet.api.feign;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.feign.annotation.NoToken;
import com.bsd.pjcloud.wallet.api.constant.WalletCodeBizEnum;
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
import com.bsd.pjcloud.wallet.api.vo.WalletActiveVo;
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
@@ -64,4 +66,8 @@ public interface RemoteWalletService {
@GetMapping("/wallet-manage/inner/is-use-door")
R<String> innserIsUseDoor(@RequestParam Long userId);
@NoToken
@GetMapping("/wallet-active/remote/open-card-list")
R<Page<WalletActiveEntity>> remoteOpenCardList(@RequestParam Long current, @RequestParam Long pageSize);
}
@@ -9,6 +9,7 @@ import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.core.validation.Group;
import com.bsd.pjcloud.common.idempotent.annotation.Idempotent;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.common.security.annotation.Inner;
import com.bsd.pjcloud.common.security.service.PjcloudUser;
import com.bsd.pjcloud.common.security.util.SecurityUtils;
import com.bsd.pjcloud.wallet.api.dto.WalletActiveBindCardDto;
@@ -46,6 +47,22 @@ public class WalletActiveController {
private final WalletActiveService walletActiveService;
/* ************************************* start 远程调用 start ************************************* */
@Inner()
@GetMapping("/remote/open-card-list")
@Operation(summary = "远程调用开卡并且绑定用户的列表")
public R<Page<WalletActiveEntity>> remoteOpenCardList(@RequestParam Long current, @RequestParam Long pageSize) {
Page page = new Page();
page.setCurrent(current);
page.setSize(pageSize);
WalletActiveDto dto = new WalletActiveDto();
return R.ok(walletActiveService.openCardList(page, dto));
}
/* ************************************* end 远程调用 end ************************************* */
/* ************************************* start android start ************************************* */
@GetMapping("/ad/open-card-list")
@Operation(summary = "android开卡列表")
@@ -151,7 +168,7 @@ public class WalletActiveController {
@PutMapping
@PreAuthorize("@pms.hasPermission('wallet_walletActive_edit')")
public R updateById(@RequestBody WalletActiveEntity walletActive) {
return R.ok(walletActiveService.updateById(walletActive));
return R.ok(walletActiveService.edit(walletActive));
}
@Operation(summary = "通过id删除钱包开卡", description = "通过id删除钱包开卡")
@@ -12,6 +12,7 @@ import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
import com.bsd.pjcloud.wallet.api.vo.WalletActiveVo;
import com.github.yulichang.query.MPJLambdaQueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface WalletActiveMapper extends PjcloudBaseMapper<WalletActiveEntity> {
@@ -56,4 +57,6 @@ public interface WalletActiveMapper extends PjcloudBaseMapper<WalletActiveEntity
}
WalletActiveEntity getLast();
Page<WalletActiveEntity> openCardList(Page page, @Param("dto") WalletActiveDto dto);
}
@@ -67,4 +67,14 @@ public interface WalletActiveService extends IService<WalletActiveEntity> {
Page<WalletActiveVo> pageJoin(Page page, WalletActiveDto dto);
Page<WalletActiveVo> scopePageList(Page page, WalletActiveDto dto);
/**
* 远程调用开卡并且绑定用户的列表
*/
Page<WalletActiveEntity> openCardList(Page page, WalletActiveDto dto);
/**
* 更新
*/
Long edit(WalletActiveEntity walletActive);
}
@@ -26,6 +26,7 @@ import com.bsd.pjcloud.wallet.api.entity.mch.MchManageEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRulePriceConfigEntity;
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import com.bsd.pjcloud.wallet.api.vo.WalletActiveVo;
@@ -84,7 +85,7 @@ public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, Wal
for (int i = 0; i < count; i++) {
startNum += 1;
WalletActiveEntity item = new WalletActiveEntity();
String cardNumber = "hq" + String.format("%06d", startNum) + RandomUtil.randomString(RandomUtil.BASE_CHAR, 4);
String cardNumber = String.format("%06d", startNum) + RandomUtil.randomString(RandomUtil.BASE_NUMBER, 4);
item.setCardSort(startNum);
item.setCardNumber(cardNumber);
item.setWalletTypeId(walletType.getId());
@@ -298,6 +299,54 @@ public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, Wal
return list;
}
/**
* 远程调用开卡并且绑定用户的列表
*/
@Override
public Page<WalletActiveEntity> openCardList(Page page, WalletActiveDto dto) {
return baseMapper.openCardList(page, dto);
}
/**
* 更新
*/
@Override
public Long edit(WalletActiveEntity walletActive) {
// 查询详情
WalletActiveEntity detail = baseMapper.selectById(walletActive.getId());
if (ObjectUtil.isEmpty(detail)) {
throw new RuntimeException("饭卡不存在");
}
if (ObjectUtil.isNotEmpty(walletActive.getCardNumber())) {
if (existWalletCarNumber(walletActive.getCardNumber(), walletActive.getId())) {
throw new RuntimeException("饭卡<" + walletActive.getCardNumber() + ">已存在");
}
if (ObjectUtil.notEqual(walletActive.getCardNumber(), detail.getCardNumber()) && ObjectUtil.isNotEmpty(detail.getUserId()) && ObjectUtil.isNotEmpty(detail.getWalletId())) {
// 查询钱包
WalletManageEntity wallet = walletManageService.getWallet(walletActive.getWalletId());
if (ObjectUtil.isNotEmpty(wallet)) {
WalletManageEntity updateWallet = new WalletManageEntity();
updateWallet.setId(wallet.getId());
updateWallet.setCardNumber(walletActive.getCardNumber());
walletManageService.updateById(updateWallet);
}
}
}
baseMapper.updateById(walletActive);
return walletActive.getId();
}
private boolean existWalletCarNumber(String cardNumber, Long id) {
Long count = baseMapper.selectCount(new LambdaQueryWrapper<WalletActiveEntity>()
.eq(ObjectUtil.isNotEmpty(cardNumber), WalletActiveEntity::getCardNumber, cardNumber)
.ne(ObjectUtil.isNotEmpty(id), WalletActiveEntity::getId, id)
);
if (ObjectUtil.isNotEmpty(id)) {
return count >= 1;
}
return count > 0;
}
private WalletActiveServiceImpl getSelf() {
return SpringUtil.getBean(getClass());
}
@@ -2,25 +2,47 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bsd.pjcloud.wallet.mapper.WalletActiveMapper">
<sql id="selectA">
select a.id,
a.user_id,
a.wallet_id,
a.wallet_type_id,
a.dept_id,
a.merchant_id,
a.card_number,
a.card_sort,
a.is_active_hardware,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.del_flag,
a.tenant_id
</sql>
<resultMap id="walletActiveMap" type="com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity">
<id property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="walletId" column="wallet_id"/>
<result property="walletTypeId" column="wallet_type_id"/>
<result property="deptId" column="dept_id"/>
<result property="merchantId" column="merchant_id"/>
<result property="cardNumber" column="card_number"/>
<result property="isActiveHardware" column="is_active_hardware"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
<sql id="whereA">
</sql>
<select id="getLast" resultType="com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity">
select *
from wallet_active
order by card_sort desc limit 1
</select>
<select id="openCardList" resultType="com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity">
<include refid="selectA"/>
from wallet_active a
<where>
a.user_id is not null
and a.wallet_id is not null
<if test="dto.cardNumber != null and dto.cardNumber != '' ">
and a.act_id = #{dto.cardNumber}
</if>
<if test="dto.isActiveHardware != null and dto.isActiveHardware != '' ">
and a.is_active_hardware = #{dto.isActiveHardware}
</if>
</where>
order by a.card_sort asc, a.id asc
</select>
<select id="getLast" resultMap="walletActiveMap">
select * from wallet_active order by card_sort desc limit 1
</select>
</mapper>