You've already forked FrameTour-BE
feat(pricing): 实现优惠券打印功能
- 新增 AppVoucherController 控制器处理打印请求 - 实现 VoucherPrintService 接口和 VoucherPrintServiceImpl 实现类 - 添加 VoucherPrintReq 请求对象和 VoucherPrintResp 响应对象 - 创建 VoucherPrintRecord 实体和对应的 Mapper - 更新 PriceVoucherCodeMapper 接口,添加随机获取未打印券码的方法 - 实现分布式锁机制防止重复打印- 生成流水号并记录打印状态
This commit is contained in:
52
src/main/resources/mapper/VoucherPrintRecordMapper.xml
Normal file
52
src/main/resources/mapper/VoucherPrintRecordMapper.xml
Normal file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ycwl.basic.pricing.mapper.VoucherPrintRecordMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ycwl.basic.pricing.entity.VoucherPrintRecord">
|
||||
<id column="id" property="id" jdbcType="BIGINT"/>
|
||||
<result column="code" property="code" jdbcType="VARCHAR"/>
|
||||
<result column="face_id" property="faceId" jdbcType="BIGINT"/>
|
||||
<result column="broker_id" property="brokerId" jdbcType="BIGINT"/>
|
||||
<result column="scenic_id" property="scenicId" jdbcType="BIGINT"/>
|
||||
<result column="voucher_code_id" property="voucherCodeId" jdbcType="BIGINT"/>
|
||||
<result column="voucher_code" property="voucherCode" jdbcType="VARCHAR"/>
|
||||
<result column="print_status" property="printStatus" jdbcType="TINYINT"/>
|
||||
<result column="error_message" property="errorMessage" jdbcType="VARCHAR"/>
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="deleted" property="deleted" jdbcType="TINYINT"/>
|
||||
<result column="deleted_at" property="deletedAt" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, code, face_id, broker_id, scenic_id, voucher_code_id, voucher_code,
|
||||
print_status, error_message, create_time, update_time, deleted, deleted_at
|
||||
</sql>
|
||||
|
||||
<select id="selectByFaceBrokerScenic" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"/>
|
||||
FROM voucher_print_record
|
||||
WHERE face_id = #{faceId}
|
||||
AND broker_id = #{brokerId}
|
||||
AND scenic_id = #{scenicId}
|
||||
AND deleted = 0
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="selectByVoucherCodeId" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"/>
|
||||
FROM voucher_print_record
|
||||
WHERE voucher_code_id = #{voucherCodeId}
|
||||
AND deleted = 0
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<update id="updatePrintStatus">
|
||||
UPDATE voucher_print_record
|
||||
SET print_status = #{printStatus},
|
||||
error_message = #{errorMessage},
|
||||
update_time = NOW()
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user