歌曲订单管理

This commit is contained in:
2024-07-09 15:17:30 +08:00
parent 8ad974bfa4
commit abc13bcf69
9 changed files with 618 additions and 0 deletions

View File

@@ -0,0 +1,148 @@
<?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="cn.ysk.cashier.mybatis.mapper.TbShopSongOrderMapper">
<resultMap type="cn.ysk.cashier.mybatis.entity.TbShopSongOrder" id="TbShopSongOrderMap">
<result 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="NUMERIC"/>
<result property="state" column="state" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="clientType" column="client_type" jdbcType="INTEGER"/>
<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"/>
</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 </sql>
<!--查询单个-->
<select id="queryById" resultMap="TbShopSongOrderMap">
select
<include refid="Base_Column_List"/>
from tb_shop_song_order
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAll" resultMap="TbShopSongOrderMap">
select
<include refid="Base_Column_List"/>
from tb_shop_song_order
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="songId != null">
and song_id = #{songId}
</if>
<if test="songName != null and songName != ''">
and song_name = #{songName}
</if>
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="payMoney != null">
and pay_money = #{payMoney}
</if>
<if test="state != null">
and state = #{state}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="clientType != null">
and client_type = #{clientType}
</if>
<if test="orderNo != null and orderNo != ''">
and order_no = #{orderNo}
</if>
<if test="fromName != null and fromName != ''">
and from_name = #{fromName}
</if>
<if test="toName != null and toName != ''">
and to_name = #{toName}
</if>
<if test="note != null and note != ''">
and note = #{note}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into tb_shop_song_order(song_id, song_name, user_id, pay_money, state, create_time, client_type,
order_no, from_name, to_name, note)
values (#{songId}, #{songName}, #{userId}, #{payMoney}, #{state}, #{createTime}, #{clientType}, #{orderNo},
#{fromName}, #{toName}, #{note})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into tb_shop_song_order(song_id, song_name, user_id, pay_money, state, create_time, client_type,
order_no, from_name, to_name, note)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.songId}, #{entity.songName}, #{entity.userId}, #{entity.payMoney}, #{entity.state},
#{entity.createTime}, #{entity.clientType}, #{entity.orderNo}, #{entity.fromName}, #{entity.toName},
#{entity.note})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update tb_shop_song_order
<set>
<if test="songId != null">
song_id = #{songId},
</if>
<if test="songName != null and songName != ''">
song_name = #{songName},
</if>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="payMoney != null">
pay_money = #{payMoney},
</if>
<if test="state != null">
state = #{state},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="clientType != null">
client_type = #{clientType},
</if>
<if test="orderNo != null and orderNo != ''">
order_no = #{orderNo},
</if>
<if test="fromName != null and fromName != ''">
from_name = #{fromName},
</if>
<if test="toName != null and toName != ''">
to_name = #{toName},
</if>
<if test="note != null and note != ''">
note = #{note},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from tb_shop_song_order
where id = #{id}
</delete>
</mapper>