Files
wx-cashier-service/src/main/resources/mapper/TbShopSongOrderMapper.xml
2024-07-09 17:16:11 +08:00

166 lines
8.1 KiB
XML

<?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.chaozhanggui.system.cashierservice.dao.TbShopSongOrderMapper">
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="songId" column="song_id" jdbcType="INTEGER"/>
<result property="songName" column="song_name" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="payMoney" column="pay_money" jdbcType="DECIMAL"/>
<result property="state" column="state" jdbcType="TINYINT"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="clientType" column="client_type" jdbcType="TINYINT"/>
<result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
<result property="fromName" column="from_name" jdbcType="VARCHAR"/>
<result property="toName" column="to_name" jdbcType="VARCHAR"/>
<result property="note" column="note" jdbcType="VARCHAR"/>
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
<result property="realMoney" column="real_money" jdbcType="DECIMAL"/>
</resultMap>
<sql id="Base_Column_List">
id,song_id,song_name,
user_id,pay_money,state,
create_time,client_type,order_no,
from_name,to_name,note,
shop_id,real_money
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tb_shop_song_order
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from tb_shop_song_order
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder" useGeneratedKeys="true">
insert into tb_shop_song_order
( id,song_id,song_name
,user_id,pay_money,state
,create_time,client_type,order_no
,from_name,to_name,note
,shop_id,real_money)
values (#{id,jdbcType=INTEGER},#{songId,jdbcType=INTEGER},#{songName,jdbcType=VARCHAR}
,#{userId,jdbcType=INTEGER},#{payMoney,jdbcType=DECIMAL},#{state,jdbcType=TINYINT}
,#{createTime,jdbcType=TIMESTAMP},#{clientType,jdbcType=TINYINT},#{orderNo,jdbcType=VARCHAR}
,#{fromName,jdbcType=VARCHAR},#{toName,jdbcType=VARCHAR},#{note,jdbcType=VARCHAR}
,#{shopId,jdbcType=INTEGER},#{realMoney,jdbcType=DECIMAL})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder" useGeneratedKeys="true">
insert into tb_shop_song_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="songId != null">song_id,</if>
<if test="songName != null">song_name,</if>
<if test="userId != null">user_id,</if>
<if test="payMoney != null">pay_money,</if>
<if test="state != null">state,</if>
<if test="createTime != null">create_time,</if>
<if test="clientType != null">client_type,</if>
<if test="orderNo != null">order_no,</if>
<if test="fromName != null">from_name,</if>
<if test="toName != null">to_name,</if>
<if test="note != null">note,</if>
<if test="shopId != null">shop_id,</if>
<if test="realMoney != null">real_money,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id,jdbcType=INTEGER},</if>
<if test="songId != null">#{songId,jdbcType=INTEGER},</if>
<if test="songName != null">#{songName,jdbcType=VARCHAR},</if>
<if test="userId != null">#{userId,jdbcType=INTEGER},</if>
<if test="payMoney != null">#{payMoney,jdbcType=DECIMAL},</if>
<if test="state != null">#{state,jdbcType=TINYINT},</if>
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
<if test="clientType != null">#{clientType,jdbcType=TINYINT},</if>
<if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if>
<if test="fromName != null">#{fromName,jdbcType=VARCHAR},</if>
<if test="toName != null">#{toName,jdbcType=VARCHAR},</if>
<if test="note != null">#{note,jdbcType=VARCHAR},</if>
<if test="shopId != null">#{shopId,jdbcType=INTEGER},</if>
<if test="realMoney != null">#{realMoney,jdbcType=DECIMAL},</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder">
update tb_shop_song_order
<set>
<if test="songId != null">
song_id = #{songId,jdbcType=INTEGER},
</if>
<if test="songName != null">
song_name = #{songName,jdbcType=VARCHAR},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="payMoney != null">
pay_money = #{payMoney,jdbcType=DECIMAL},
</if>
<if test="state != null">
state = #{state,jdbcType=TINYINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="clientType != null">
client_type = #{clientType,jdbcType=TINYINT},
</if>
<if test="orderNo != null">
order_no = #{orderNo,jdbcType=VARCHAR},
</if>
<if test="fromName != null">
from_name = #{fromName,jdbcType=VARCHAR},
</if>
<if test="toName != null">
to_name = #{toName,jdbcType=VARCHAR},
</if>
<if test="note != null">
note = #{note,jdbcType=VARCHAR},
</if>
<if test="shopId != null">
shop_id = #{shopId,jdbcType=INTEGER},
</if>
<if test="realMoney != null">
real_money = #{realMoney,jdbcType=DECIMAL},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopSongOrder">
update tb_shop_song_order
set
song_id = #{songId,jdbcType=INTEGER},
song_name = #{songName,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=INTEGER},
pay_money = #{payMoney,jdbcType=DECIMAL},
state = #{state,jdbcType=TINYINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
client_type = #{clientType,jdbcType=TINYINT},
order_no = #{orderNo,jdbcType=VARCHAR},
from_name = #{fromName,jdbcType=VARCHAR},
to_name = #{toName,jdbcType=VARCHAR},
note = #{note,jdbcType=VARCHAR},
shop_id = #{shopId,jdbcType=INTEGER},
real_money = #{realMoney,jdbcType=DECIMAL}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectByUserIdAndId" resultType="java.util.Map">
SELECT
*
FROM
tb_shop_song_order AS a
LEFT JOIN tb_shop_song AS b ON a.song_id = b.id
WHERE
a.user_id = #{userId}
AND a.id=#{id}
</select>
</mapper>