158 lines
7.0 KiB
XML
158 lines
7.0 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.ruoyi.bookmark.mapper.SqBookmarkMapper">
|
|
|
|
<resultMap type="SqBookmark" id="SqBookmarkResult">
|
|
<result property="bookmarkId" column="bookmark_id" />
|
|
<result property="userid" column="userid" />
|
|
<result property="title" column="title" />
|
|
<result property="url" column="url" />
|
|
<result property="urls" column="urls" />
|
|
<result property="description" column="description" />
|
|
<result property="image" column="image" />
|
|
<result property="label" column="label" />
|
|
<result property="menuId" column="menu_id" />
|
|
<result property="zcount" column="zcount" />
|
|
<result property="idelete" column="idelete" />
|
|
<result property="start" column="start" />
|
|
<result property="createTime" column="create_time" />
|
|
<!-- <collection property="sqTags"-->
|
|
<!-- javaType="java.util.ArrayList"-->
|
|
<!-- ofType="java.util.Map"-->
|
|
<!-- select="com.ruoyi.bookmark.mapper.SqBookmarkTagMapper.selectSqTaListById"-->
|
|
<!-- column="bookmark_id">-->
|
|
|
|
|
|
<!-- </collection>-->
|
|
|
|
</resultMap>
|
|
|
|
<sql id="selectSqBookmarkVo">
|
|
select bookmark_id, userid, title, url, urls, description, image, Label, menu_id, zcount, IDelete, Start, create_time from sq_bookmark
|
|
</sql>
|
|
|
|
<select id="selectSqBookmarkList" parameterType="SqBookmark" resultMap="SqBookmarkResult">
|
|
<include refid="selectSqBookmarkVo"/>
|
|
<where>
|
|
<if test="userid != null "> and userid = #{userid}</if>
|
|
<if test="title != null and title != ''"> and title = #{title}</if>
|
|
<if test="url != null and url != ''"> and url = #{url}</if>
|
|
<if test="urls != null and urls != ''"> and urls = #{urls}</if>
|
|
<if test="description != null and description != ''"> and description = #{description}</if>
|
|
<if test="image != null and image != ''"> and image = #{image}</if>
|
|
<if test="label != null and label != ''"> and label = #{label}</if>
|
|
<if test="menuId != null "> and menu_id = #{menuId}</if>
|
|
<if test="zcount != null "> and zcount = #{zcount}</if>
|
|
<if test="idelete != null "> and idelete = #{idelete}</if>
|
|
<if test="start != null "> and start = #{start}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectSqBookmarkById" parameterType="Long" resultMap="SqBookmarkResult">
|
|
<include refid="selectSqBookmarkVo"/>
|
|
where bookmark_id = #{bookmarkId}
|
|
</select>
|
|
|
|
<insert id="insertSqBookmark" parameterType="SqBookmark" useGeneratedKeys="true" keyProperty="bookmarkId">
|
|
insert into sq_bookmark
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="userid != null">userid,</if>
|
|
<if test="title != null">title,</if>
|
|
<if test="url != null">url,</if>
|
|
<if test="urls != null">urls,</if>
|
|
<if test="description != null">description,</if>
|
|
<if test="image != null">image,</if>
|
|
<if test="label != null">label,</if>
|
|
<if test="menuId != null">menu_id,</if>
|
|
<if test="zcount != null">zcount,</if>
|
|
<if test="idelete != null">idelete,</if>
|
|
<if test="start != null">start,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="userid != null">#{userid},</if>
|
|
<if test="title != null">#{title},</if>
|
|
<if test="url != null">#{url},</if>
|
|
<if test="urls != null">#{urls},</if>
|
|
<if test="description != null">#{description},</if>
|
|
<if test="image != null">#{image},</if>
|
|
<if test="label != null">#{label},</if>
|
|
<if test="menuId != null">#{menuId},</if>
|
|
<if test="zcount != null">#{zcount},</if>
|
|
<if test="idelete != null">#{idelete},</if>
|
|
<if test="start != null">#{start},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateSqBookmark" parameterType="SqBookmark">
|
|
update sq_bookmark
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="userid != null">userid = #{userid},</if>
|
|
<if test="title != null">title = #{title},</if>
|
|
<if test="url != null">url = #{url},</if>
|
|
<if test="urls != null">urls = #{urls},</if>
|
|
<if test="description != null">description = #{description},</if>
|
|
<if test="image != null">image = #{image},</if>
|
|
<if test="label != null">label = #{label},</if>
|
|
<if test="menuId != null">menu_id = #{menuId},</if>
|
|
<if test="zcount != null">zcount = #{zcount},</if>
|
|
<if test="idelete != null">idelete = #{idelete},</if>
|
|
<if test="start != null">start = #{start},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
</trim>
|
|
where bookmark_id = #{bookmarkId}
|
|
</update>
|
|
|
|
<update id="updateSqBookmarkBymenuId" parameterType="Long">
|
|
update sq_bookmark set IDelete = 1 where menu_id = #{menuId}
|
|
</update>
|
|
|
|
<delete id="deleteSqBookmarkById" parameterType="Long">
|
|
delete from sq_bookmark where bookmark_id = #{bookmarkId}
|
|
</delete>
|
|
|
|
<delete id="deleteSqBookmarkByIds" parameterType="String">
|
|
delete from sq_bookmark where bookmark_id in
|
|
<foreach item="bookmarkId" collection="array" open="(" separator="," close=")">
|
|
#{bookmarkId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="selectByUseridList" parameterType="Long" resultMap="SqBookmarkResult">
|
|
<include refid="selectSqBookmarkVo"/>
|
|
where userid = #{userId} and idelete = 0 order by create_time desc
|
|
</select>
|
|
|
|
<select id="countBookMakeByMenuId" parameterType="Long" resultType="java.lang.Integer">
|
|
select count(*) FROM sq_bookmark where menu_id =#{menuId}
|
|
</select>
|
|
|
|
<select id="selectBymenuIdUserID" parameterType="SqBookmark" resultMap="SqBookmarkResult">
|
|
<include refid="selectSqBookmarkVo"/>
|
|
where userid=#{userID}
|
|
<if test="sousuo == null or sousuo == ''"> and menu_id = #{menuID}</if>
|
|
<if test="sousuo != null and sousuo != ''"> and title like concat('%', #{sousuo}, '%')</if>
|
|
order by
|
|
<choose>
|
|
<when test="sort == 0">
|
|
create_time desc
|
|
</when>
|
|
<when test="sort == 1">
|
|
create_time asc
|
|
</when>
|
|
<when test="sort == 2">
|
|
CONVERT(title USING GBK) asc
|
|
</when>
|
|
<when test="sort == 3">
|
|
CONVERT(title USING GBK) desc
|
|
</when>
|
|
<otherwise>
|
|
create_time desc
|
|
</otherwise>
|
|
</choose>
|
|
</select>
|
|
</mapper>
|