Files
gofly-platform-services/zlt-business/order-center/src/main/resources/mapper/QrCodeMapper.xml
T

72 lines
2.5 KiB
XML
Raw Normal View History

<?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.central.order.mapper.QrCodeMapper">
<select id="findList" resultType="com.central.order.model.QrCode">
SELECT * FROM qrcodes q
<where>
<if test="p.tourismId != null and p.tourismId != ''">
AND q.tourism_id = #{p.tourismId}
</if>
<if test="p.waylineId != null and p.waylineId != ''">
AND q.wayline_id = #{p.waylineId}
</if>
<if test="p.status != null">
AND q.status = #{p.status}
</if>
<if test="p.isTest != null">
AND q.is_test = #{p.isTest}
</if>
<if test="p.tenantId != null and p.tenantId != ''">
AND q.tenant_id = #{p.tenantId}
</if>
<if test="p.name != null and p.name != ''">
AND q.name LIKE CONCAT('%', #{p.name}, '%')
</if>
<if test="p.codeId != null and p.codeId != ''">
AND q.code_id LIKE CONCAT('%', #{p.codeId}, '%')
</if>
<if test="p.deviceSn != null and p.deviceSn != ''">
AND q.device_sn = #{p.deviceSn}
</if>
<if test="p.qrcodeType != null">
AND q.qrcode_type = #{p.qrcodeType}
</if>
<if test="p.showVideoEditOnly != null">
AND q.show_video_edit_only = #{p.showVideoEditOnly}
</if>
</where>
ORDER BY q.create_time DESC
</select>
<resultMap id="QrCodeResultMap" type="com.central.order.model.QrCode">
</resultMap>
<select id="getByCodeId" resultMap="QrCodeResultMap">
SELECT * FROM qrcodes WHERE code_id = #{codeId}
</select>
<insert id="insertQrCode">
INSERT INTO qrcodes (code_id, tourism_id, device_sn)
VALUES (#{codeId}, #{tourismId}, #{deviceSn})
</insert>
<select id="getByDeviceIdAndType" resultMap="QrCodeResultMap">
SELECT * FROM qrcodes
WHERE device_sn = #{deviceId}
AND qrcode_type = #{qrcodeType}
AND is_del = 0
ORDER BY create_time DESC
LIMIT 1
</select>
<select id="getByCodeIds" resultMap="QrCodeResultMap">
SELECT * FROM qrcodes
WHERE code_id IN
<foreach collection="codeIds" item="codeId" open="(" separator="," close=")">
#{codeId}
</foreach>
AND is_del = 0
</select>
</mapper>