|
@@ -0,0 +1,98 @@
|
|
|
+<!DOCTYPE mapper
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+
|
|
|
+<mapper namespace="com.bosshand.virgo.api.workark.dao.ProductCouponModelDao">
|
|
|
+
|
|
|
+ <resultMap type="com.bosshand.virgo.api.workark.model.ProductCouponModel" id="result">
|
|
|
+ <id column="id" property="id"/>
|
|
|
+ <result column="type" property="type"/>
|
|
|
+ <result column="otherType" property="otherType"/>
|
|
|
+ <result column="discount" property="discount"/>
|
|
|
+ <result column="createTime" property="createTime"/>
|
|
|
+ <result column="lifespan" property="lifespan"/>
|
|
|
+ <result column="productLevelId" property="productLevelId"/>
|
|
|
+ <result column="couponAmount" property="couponAmount"/>
|
|
|
+ <result column="title" property="title"/>
|
|
|
+ <result column="threshold" property="threshold"/>
|
|
|
+ <result column="mostConstraint" property="mostConstraint"/>
|
|
|
+ <result column="description" property="description"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="get" resultMap="result">
|
|
|
+ select * from workark_product_coupon_model where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getList" resultMap="result">
|
|
|
+ select * from workark_product_coupon_model
|
|
|
+ <where>
|
|
|
+ <if test="type != null">
|
|
|
+ and type = #{type}
|
|
|
+ </if>
|
|
|
+ <if test="otherType != null">
|
|
|
+ and otherType = #{otherType}
|
|
|
+ </if>
|
|
|
+ <if test="productLevelId != 0">
|
|
|
+ and productLevelId = #{productLevelId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getTotalCount" parameterType="com.bosshand.virgo.api.workark.model.ProductCouponModel" resultType="Integer">
|
|
|
+ SELECT count(*) FROM workark_product_coupon_model
|
|
|
+ <where>
|
|
|
+ <if test="type != null">
|
|
|
+ and type = #{type}
|
|
|
+ </if>
|
|
|
+ <if test="otherType != null">
|
|
|
+ and otherType = #{otherType}
|
|
|
+ </if>
|
|
|
+ <if test="productLevelId != 0">
|
|
|
+ and productLevelId = #{productLevelId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getLimit" resultMap="result">
|
|
|
+ select * from workark_product_coupon_model
|
|
|
+ <where>
|
|
|
+ <if test="p.type != null">
|
|
|
+ and type = #{p.type}
|
|
|
+ </if>
|
|
|
+ <if test="p.otherType != null">
|
|
|
+ and otherType = #{p.otherType}
|
|
|
+ </if>
|
|
|
+ <if test="p.productLevelId != 0">
|
|
|
+ and productLevelId = #{p.productLevelId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by createTime desc limit #{currIndex} , #{pageSize}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="save" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ INSERT INTO workark_product_coupon_model (type, otherType, discount, createTime, lifespan, productLevelId, couponAmount, title, threshold, mostConstraint, description)
|
|
|
+ VALUES (#{type}, #{otherType}, #{discount}, now(), #{lifespan}, #{productLevelId}, #{couponAmount}, #{title}, #{threshold}, #{mostConstraint}, #{description})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="update" parameterType="com.bosshand.virgo.api.workark.model.ProductCouponModel">
|
|
|
+ UPDATE workark_product_coupon_model
|
|
|
+ <trim prefix="set" suffixOverrides=",">
|
|
|
+ <if test="type!=null">type=#{type},</if>
|
|
|
+ <if test="otherType!=null">otherType=#{otherType},</if>
|
|
|
+ <if test="discount!=null">discount=#{discount},</if>
|
|
|
+ <if test="lifespan!=null">lifespan=#{lifespan},</if>
|
|
|
+ <if test="productLevelId!=0">productLevelId=#{productLevelId},</if>
|
|
|
+ <if test="couponAmount!=null">couponAmount=#{couponAmount},</if>
|
|
|
+ <if test="title!=null">title=#{title},</if>
|
|
|
+ <if test="threshold!=null">threshold=#{threshold},</if>
|
|
|
+ <if test="mostConstraint!=null">mostConstraint=#{mostConstraint},</if>
|
|
|
+ <if test="description!=null">description=#{description},</if>
|
|
|
+ </trim>
|
|
|
+ WHERE id=#{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="delete">
|
|
|
+ DELETE FROM workark_product_coupon_model WHERE id=#{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+</mapper>
|