You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.7 KiB
42 lines
1.7 KiB
<?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.ischoolbar.programmer.dao.home.FavoriteDao">
|
|
<!-- 收藏插入操作 -->
|
|
<insert id="add" parameterType="com.ischoolbar.programmer.entity.home.Favorite">
|
|
insert into favorite(id,productId,userId,name,imageUrl,price,createTime) values(null,#{productId},#{userId},#{name},#{imageUrl},#{price},#{createTime})
|
|
</insert>
|
|
<!-- 收藏信息搜索查询 -->
|
|
<select id="findList" parameterType="Map" resultType="com.ischoolbar.programmer.entity.home.Favorite">
|
|
select * from favorite where 1 = 1
|
|
<if test="userId != null">
|
|
and userId = #{userId}
|
|
</if>
|
|
<if test="orderBy != null and sort != null">
|
|
order by ${orderBy} ${sort}
|
|
</if>
|
|
<if test="offset != null and pageSize != null">
|
|
limit #{offset},#{pageSize}
|
|
</if>
|
|
</select>
|
|
<!-- 模糊搜索总条数 -->
|
|
<select id="getTotal" parameterType="Map" resultType="Integer">
|
|
select count(*) from favorite where 1 = 1
|
|
<if test="userId != null">
|
|
and userId = #{userId}
|
|
</if>
|
|
</select>
|
|
<!-- 根据id查询 -->
|
|
<select id="findById" parameterType="Long" resultType="com.ischoolbar.programmer.entity.home.Favorite">
|
|
select * from favorite where id = #{value}
|
|
</select>
|
|
<!-- 根据userid和productid查询 -->
|
|
<select id="findByIds" parameterType="Map" resultType="com.ischoolbar.programmer.entity.home.Favorite">
|
|
select * from favorite where userId = #{userId} and productId = #{productId}
|
|
</select>
|
|
<!-- 删除收藏信息 -->
|
|
<delete id="delete" parameterType="String">
|
|
delete from favorite where id in(${value})
|
|
</delete>
|
|
</mapper> |