商品分页
This commit is contained in:
@@ -2,11 +2,17 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.mall.product.dao.ProductSpuMapper">
|
||||
|
||||
<sql id="FIELDS">
|
||||
id, name, sell_point, description, cid,
|
||||
pic_urls, visible, sort, create_time
|
||||
</sql>
|
||||
|
||||
<select id="selectById" parameterType="Integer" resultType="ProductSpuDO">
|
||||
SELECT
|
||||
id
|
||||
<include refid="FIELDS" />
|
||||
FROM product_spu
|
||||
WHERE id = #{id}
|
||||
AND deleted = 0
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="ProductSpuDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
@@ -50,4 +56,30 @@
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="selectListByNameLikeOrderBySortAsc" resultType="ProductSpuDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM product_spu
|
||||
<where>
|
||||
<if test="name != null">
|
||||
name LIKE "%"#{name}"%"
|
||||
</if>
|
||||
AND deleted = 0
|
||||
</where>
|
||||
ORDER BY sort ASC
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
|
||||
<select id="selectCountByNameLike" resultType="Integer">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
FROM product_spu
|
||||
<where>
|
||||
<if test="name != null">
|
||||
name LIKE "%"#{name}"%"
|
||||
</if>
|
||||
AND deleted = 0
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user