完善c端接口
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<?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.ruoyi.system.mapper.MusicCollectMapper">
|
||||
|
||||
<resultMap type="MusicCollect" id="MusicCollectResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="musicId" column="music_id" />
|
||||
<result property="collectId" column="collect_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMusicCollectVo">
|
||||
select id, music_id, collect_id from music_collect
|
||||
</sql>
|
||||
|
||||
<select id="selectMusicCollectList" parameterType="MusicCollect" resultMap="MusicCollectResult">
|
||||
<include refid="selectMusicCollectVo"/>
|
||||
<where>
|
||||
<if test="musicId != null "> and music_id = #{musicId}</if>
|
||||
<if test="collectId != null "> and collect_id = #{collectId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMusicCollectById" parameterType="String" resultMap="MusicCollectResult">
|
||||
<include refid="selectMusicCollectVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertMusicCollect" parameterType="MusicCollect" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into music_collect
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="musicId != null">music_id,</if>
|
||||
<if test="collectId != null">collect_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="musicId != null">#{musicId},</if>
|
||||
<if test="collectId != null">#{collectId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateMusicCollect" parameterType="MusicCollect">
|
||||
update music_collect
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="musicId != null">music_id = #{musicId},</if>
|
||||
<if test="collectId != null">collect_id = #{collectId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMusicCollectById" parameterType="String">
|
||||
delete from music_collect where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMusicCollectByIds" parameterType="String">
|
||||
delete from music_collect where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="delBindMusic">
|
||||
delete from music_collect where music_id= #{musicId} and collect_id=#{collectId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -135,4 +135,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectRecommendMusic" resultMap="MusicInfoResult">
|
||||
SELECT mi.* FROM music_recommend mr LEFT JOIN music_info mi on mr.music_id = mi.music_id and mi.is_del=0
|
||||
</select>
|
||||
|
||||
<select id="selectMusicByCollectId" resultMap="MusicInfoResult">
|
||||
SELECT * FROM music_collect mc left join music_info mi on mi.music_id=mc.music_id WHERE mi.is_del=0 and mc.collect_id =#{collectId}
|
||||
</select>
|
||||
|
||||
<insert id="insertLikeMusic">
|
||||
INSERT INTO user_like_music(music_id, user_id) values (#{musicId},#{userId})
|
||||
</insert>
|
||||
|
||||
<select id="selectLikeMusicByUser" resultMap="MusicInfoResult">
|
||||
SELECT * FROM user_like_music ulm LEFT JOIN music_info mi on ulm.music_id=mi.music_id WHERE ulm.user_id=#{userId} and mi.is_del=0
|
||||
</select>
|
||||
|
||||
<delete id="delLikeMusic">
|
||||
DELETE FROM user_like_music where music_id=#{musicId} and user_id=#{userId}
|
||||
</delete>
|
||||
|
||||
<insert id="insertHistory">
|
||||
INSERT INTO user_history(user_id, music_id) value (#{userId},#{musicId})
|
||||
</insert>
|
||||
|
||||
<select id="selectHistoryMusicByUser" resultMap="MusicInfoResult">
|
||||
SELECT * FROM user_history ulm LEFT JOIN music_info mi on ulm.music_id=mi.music_id WHERE ulm.user_id=#{userId} and mi.is_del=0
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,110 @@
|
||||
<?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.ruoyi.system.mapper.ShareInfoMapper">
|
||||
|
||||
<resultMap type="ShareInfo" id="ShareInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="shareDecs" column="share_decs" />
|
||||
<result property="musicId" column="music_id" />
|
||||
<result property="shareAddr" column="share_addr" />
|
||||
<result property="sharePlat" column="share_plat" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="isDel" column="is_del" />
|
||||
<result property="review" column="review" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectShareInfoVo">
|
||||
select id, user_id, share_decs, music_id, share_addr, share_plat, create_time, update_time, is_del, review from share_info
|
||||
</sql>
|
||||
|
||||
<select id="selectShareInfoList" parameterType="ShareInfo" resultMap="ShareInfoResult">
|
||||
<include refid="selectShareInfoVo"/>
|
||||
<where>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="shareDecs != null and shareDecs != ''"> and share_decs = #{shareDecs}</if>
|
||||
<if test="musicId != null "> and music_id = #{musicId}</if>
|
||||
<if test="shareAddr != null and shareAddr != ''"> and share_addr = #{shareAddr}</if>
|
||||
<if test="sharePlat != null and sharePlat != ''"> and share_plat = #{sharePlat}</if>
|
||||
<if test="isDel != null "> and is_del = #{isDel}</if>
|
||||
<if test="review != null "> and review = #{review}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectShareInfoById" parameterType="String" resultMap="ShareInfoResult">
|
||||
<include refid="selectShareInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertShareInfo" parameterType="ShareInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into share_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="shareDecs != null">share_decs,</if>
|
||||
<if test="musicId != null">music_id,</if>
|
||||
<if test="shareAddr != null">share_addr,</if>
|
||||
<if test="sharePlat != null">share_plat,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="isDel != null">is_del,</if>
|
||||
<if test="review != null">review,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="shareDecs != null">#{shareDecs},</if>
|
||||
<if test="musicId != null">#{musicId},</if>
|
||||
<if test="shareAddr != null">#{shareAddr},</if>
|
||||
<if test="sharePlat != null">#{sharePlat},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="isDel != null">#{isDel},</if>
|
||||
<if test="review != null">#{review},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateShareInfo" parameterType="ShareInfo">
|
||||
update share_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="shareDecs != null">share_decs = #{shareDecs},</if>
|
||||
<if test="musicId != null">music_id = #{musicId},</if>
|
||||
<if test="shareAddr != null">share_addr = #{shareAddr},</if>
|
||||
<if test="sharePlat != null">share_plat = #{sharePlat},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="isDel != null">is_del = #{isDel},</if>
|
||||
<if test="review != null">review = #{review},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteShareInfoById" parameterType="String">
|
||||
delete from share_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteShareInfoByIds" parameterType="String">
|
||||
delete from share_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectShareInfoListPage" resultType="com.ruoyi.common.core.domain.entity.ShareInfo">
|
||||
SELECT
|
||||
su.username as username,
|
||||
su.nickname as nickname,
|
||||
su.head_img as headImg,
|
||||
si.share_decs as shareDecs,
|
||||
mi.name as `musicName`,
|
||||
mi.img_addr as musicImgAddr,
|
||||
mi.music_addr as musicAddr,
|
||||
mi.author as musicAuthor
|
||||
FROM share_info si
|
||||
left join shop_user su on si.user_id = su.user_id
|
||||
LEFT JOIN music_info mi on si.music_id = mi.music_id
|
||||
WHERE mi.is_del=0
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -2,17 +2,6 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.ruoyi.system.mapper.ShopUserMapper">
|
||||
|
||||
<select id="selectShopUserByPhone" resultType="com.ruoyi.common.core.domain.entity.ShopUser">
|
||||
SELECT * FROM shop_user where phone = #{phone}
|
||||
</select>
|
||||
|
||||
<select id="selectShopUserByUsername" resultType="com.ruoyi.common.core.domain.entity.ShopUser">
|
||||
SELECT * FROM shop_user where username = #{username}
|
||||
</select>
|
||||
|
||||
<select id="selectShopUserByUsernameAndPass" resultType="com.ruoyi.common.core.domain.entity.ShopUser">
|
||||
SELECT * FROM shop_user where username = #{username} and password = #{password}
|
||||
</select>
|
||||
|
||||
<!-- Insert -->
|
||||
<insert id="insert" parameterType="com.ruoyi.common.core.domain.entity.ShopUser" useGeneratedKeys="true" keyProperty="id">
|
||||
@@ -30,6 +19,9 @@
|
||||
<if test="status != null">status,</if>
|
||||
<if test="vip != null">vip,</if>
|
||||
<if test="online != null">online,</if>
|
||||
<if test="deviceId != null">device_id,</if>
|
||||
<if test="deviceType != null">device_type,</if>
|
||||
<if test="headImg != null">head_img,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">#{userId},</if>
|
||||
@@ -44,6 +36,9 @@
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="vip != null">#{vip},</if>
|
||||
<if test="online != null">#{online},</if>
|
||||
<if test="deviceId != null">#{deviceId},</if>
|
||||
<if test="deviceType != null">#{deviceType},</if>
|
||||
<if test="headImg != null">#{headImg},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -61,13 +56,16 @@
|
||||
<result property="status" column="status" />
|
||||
<result property="vip" column="vip" />
|
||||
<result property="online" column="online" />
|
||||
<result property="deviceId" column="device_id" />
|
||||
<result property="deviceType" column="device_type" />
|
||||
<result property="headImg" column="head_img" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="isDel" column="is_del" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectShopUserVo">
|
||||
select id, user_id, username, password, phone, nickname, sex, birthday, addr, register_time, status, vip, online, create_time, update_time, is_del from shop_user
|
||||
select id, user_id, username, password,device_type,device_id, phone, nickname, sex, birthday, addr, register_time, status, vip, online, create_time, update_time, is_del,head_img from shop_user
|
||||
</sql>
|
||||
|
||||
<select id="selectShopUserList" parameterType="ShopUser" resultMap="ShopUserResult">
|
||||
@@ -89,6 +87,20 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectShopUserByPhone" resultMap="ShopUserResult">
|
||||
SELECT * FROM shop_user where phone = #{phone}
|
||||
</select>
|
||||
|
||||
<select id="selectShopUserByUsername" resultMap="ShopUserResult">
|
||||
SELECT * FROM shop_user where username = #{username}
|
||||
</select>
|
||||
|
||||
<select id="selectShopUserByUsernameAndPass" resultMap="ShopUserResult">
|
||||
SELECT * FROM shop_user where username = #{username} and password = #{password}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectShopUserById" parameterType="String" resultMap="ShopUserResult">
|
||||
<include refid="selectShopUserVo"/>
|
||||
where id = #{id}
|
||||
|
||||
@@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<resultMap type="UserCollect" id="UserCollectResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="musicId" column="music_id" />
|
||||
<result property="collectId" column="collect_id" />
|
||||
<result property="collectName" column="collect_name" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
@@ -15,14 +15,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserCollectVo">
|
||||
select id, user_id, music_id, collect_name, create_time, update_time, collect_type from user_collect
|
||||
select id, user_id, collect_id, collect_name, create_time, update_time, collect_type from user_collect
|
||||
</sql>
|
||||
|
||||
<select id="selectUserCollectList" parameterType="UserCollect" resultMap="UserCollectResult">
|
||||
<include refid="selectUserCollectVo"/>
|
||||
<where>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="musicId != null "> and music_id = #{musicId}</if>
|
||||
<if test="collectId != null "> and collect_id = #{collectId}</if>
|
||||
<if test="collectName != null and collectName != ''"> and collect_name like concat('%', #{collectName}, '%')</if>
|
||||
<if test="collectType != null and collectType != ''"> and collect_type = #{collectType}</if>
|
||||
</where>
|
||||
@@ -38,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="musicId != null">music_id,</if>
|
||||
<if test="collectId != null">collect_id,</if>
|
||||
<if test="collectName != null">collect_name,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
@@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="musicId != null">#{musicId},</if>
|
||||
<if test="collectId != null">#{collectId},</if>
|
||||
<if test="collectName != null">#{collectName},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
@@ -59,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update user_collect
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="musicId != null">music_id = #{musicId},</if>
|
||||
<if test="collectId != null">collect_id = #{collectId},</if>
|
||||
<if test="collectName != null">collect_name = #{collectName},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
|
||||
@@ -58,4 +58,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUserHistoryByMusicId">
|
||||
delete from user_history where user_history.music_id in
|
||||
<foreach item="id" collection="musicIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
and user_id=#{userId}
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user