Bonus-Cloud-Material/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmQrBoxMapper.xml

62 lines
2.5 KiB
XML
Raw Normal View History

2024-12-11 13:26:02 +08:00
<?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.bonus.material.basic.mapper.BmQrBoxMapper">
<select id="find" resultType="com.bonus.material.basic.domain.BmQrBoxInfo">
select
qr_id as qrId,
qr_name as qrName,
qr_code as qrCode,
qr_type as qrType,
create_by as createBy,
create_time as createTime,
update_by as updateBy,
update_time as updateTime
from bm_qrcode_box
<where>
<if test="qrId != null">and qr_id = #{qrId}</if>
<if test="qrName != null and qrName != ''">and qr_name like concat('%',#{qrName},'%')</if>
<if test="qrCode != null and qrCode != ''">and qr_code like concat('%',#{qrCode},'%')</if>
<if test="qrType != null">and qr_type = #{qrType}</if>
</where>
</select>
<insert id="insertBmQrcodeInfo" parameterType="com.bonus.material.basic.domain.BmQrBoxInfo" useGeneratedKeys="true" keyProperty="qrId">
insert into bm_qrcode_box
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="qrCode != null">qr_code,</if>
<if test="qrName != null and qrName != ''">qr_name,</if>
<if test="qrType != null">qr_type,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="qrCode != null">#{qrCode},</if>
<if test="qrName != null and qrName != ''">#{qrName},</if>
<if test="qrType != null">#{qrType},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateBmQrcodeInfo" parameterType="com.bonus.material.basic.domain.BmQrBoxInfo">
update bm_qrcode_box
<trim prefix="SET" suffixOverrides=",">
<if test="qrCode != null">qr_code = #{qrCode},</if>
<if test="qrType != null">qr_type = #{qrType},</if>
<if test="qrName != null and qrName != ''">qr_name = #{qrName},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where qr_id = #{qrId}
</update>
<delete id="deleteById">
delete
from bm_qrcode_box
where qr_id = #{qrId}
</delete>
</mapper>