ludu-cloud/promotion/promotion-service-impl/target/classes/mapper/ProductRecommendMapper.xml

125 lines
3.7 KiB
XML
Raw Normal View History

2019-05-31 18:38:02 +08:00
<?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.iocoder.mall.promotion.biz.dao.ProductRecommendMapper">
<sql id="FIELDS">
id, type, product_spu_id, sort,
status, memo, create_time
</sql>
<!-- <select id="selectListByPidAndStatusOrderBySort" resultType="ProductRecommendDO">-->
<!-- SELECT-->
<!-- <include refid="FIELDS" />-->
<!-- FROM product_recommend-->
<!-- WHERE pid = #{pid}-->
<!-- AND status = #{status}-->
<!-- AND deleted = 0-->
<!-- ORDER BY sort ASC-->
<!-- </select>-->
<!-- <select id="selectList" resultType="ProductRecommendDO">-->
<!-- SELECT-->
<!-- <include refid="FIELDS" />-->
<!-- FROM product_recommend-->
<!-- WHERE deleted = 0-->
<!-- </select>-->
<select id="selectById" parameterType="Integer" resultType="ProductRecommendDO">
SELECT
<include refid="FIELDS" />
FROM product_recommend
WHERE id = #{id}
AND deleted = 0
</select>
<select id="selectByProductSpuIdAndType" resultType="ProductRecommendDO">
SELECT
<include refid="FIELDS" />
FROM product_recommend
<where>
<if test="productSpuId != null">
product_spu_id = #{productSpuId}
</if>
<if test="type != null">
AND type = #{type}
</if>
AND deleted = 0
</where>
</select>
<select id="selectListByTypeAndStatus" parameterType="Integer" resultType="ProductRecommendDO">
SELECT
<include refid="FIELDS" />
FROM product_recommend
<where>
<if test="type != null">
type = #{type}
</if>
<if test="status != null">
AND status = #{status}
</if>
AND deleted = 0
</where>
</select>
<select id="selectPageByType" resultType="ProductRecommendDO">
SELECT
<include refid="FIELDS" />
FROM product_recommend
<where>
<if test="type != null">
type = #{type}
</if>
AND deleted = 0
</where>
LIMIT #{offset}, #{limit}
</select>
<select id="selectCountByType" resultType="Integer">
SELECT
COUNT(1)
FROM product_recommend
<where>
<if test="type != null">
type = #{type}
</if>
AND deleted = 0
</where>
</select>
<insert id="insert" parameterType="ProductRecommendDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO product_recommend (
type, product_spu_id, sort, status, memo,
create_time, deleted
) VALUES (
#{type}, #{productSpuId}, #{sort}, #{status}, #{memo},
#{createTime}, #{deleted}
)
</insert>
<update id="update" parameterType="ProductRecommendDO">
UPDATE product_recommend
<set>
<if test="type != null">
type = #{type},
</if>
<if test="productSpuId != null">
product_spu_id = #{productSpuId},
</if>
<if test="sort != null">
sort = #{sort},
</if>
<if test="status != null">
status = #{status},
</if>
<if test="memo != null">
memo = #{memo},
</if>
<if test="deleted != null">
deleted = #{deleted}
</if>
</set>
WHERE id = #{id}
</update>
</mapper>