|
|
@@ -0,0 +1,80 @@
|
|
|
+<?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.seecoder.courselearning.mapperservice.CouponMapper">
|
|
|
+ <resultMap id="BaseResultMap" type="cn.seecoder.courselearning.po.Coupon">
|
|
|
+ <id column="id" jdbcType="INTEGER" property="id" />
|
|
|
+ <result column="type" jdbcType="VARCHAR" property="type" />
|
|
|
+ <result column="name" jdbcType="VARCHAR" property="name" />
|
|
|
+ <result column="description" jdbcType="VARCHAR" property="description" />
|
|
|
+ <result column="course_id" jdbcType="INTEGER" property="courseId" />
|
|
|
+ <result column="user_id" jdbcType="INTEGER" property="userId" />
|
|
|
+ <result column="threshold" jdbcType="INTEGER" property="threshold" />
|
|
|
+ <result column="discount" jdbcType="DOUBLE" property="discount" />
|
|
|
+ <result column="cut_down" jdbcType="INTEGER" property="cutDown" />
|
|
|
+ <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
|
|
|
+ <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
|
|
|
+ <result column="effective" jdbcType="BIT" property="effective" />
|
|
|
+ <result column="sharable" jdbcType="BIT" property="sharable" />
|
|
|
+ </resultMap>
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
|
+ delete from coupon
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </delete>
|
|
|
+ <insert id="insert" parameterType="cn.seecoder.courselearning.po.Coupon" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into coupon (id, type, name,
|
|
|
+ description, course_id, user_id,
|
|
|
+ threshold, discount, cut_down,
|
|
|
+ start_time, end_time, effective,
|
|
|
+ sharable)
|
|
|
+ values (#{id,jdbcType=INTEGER}, #{type,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
|
|
+ #{description,jdbcType=VARCHAR}, #{courseId,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER},
|
|
|
+ #{threshold,jdbcType=INTEGER}, #{discount,jdbcType=DOUBLE}, #{cutDown,jdbcType=INTEGER},
|
|
|
+ #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{effective,jdbcType=BIT},
|
|
|
+ #{sharable,jdbcType=BIT})
|
|
|
+ </insert>
|
|
|
+ <update id="updateByPrimaryKey" parameterType="cn.seecoder.courselearning.po.Coupon">
|
|
|
+ update coupon
|
|
|
+ set type = #{type,jdbcType=VARCHAR},
|
|
|
+ name = #{name,jdbcType=VARCHAR},
|
|
|
+ description = #{description,jdbcType=VARCHAR},
|
|
|
+ course_id = #{courseId,jdbcType=INTEGER},
|
|
|
+ user_id = #{userId,jdbcType=INTEGER},
|
|
|
+ threshold = #{threshold,jdbcType=INTEGER},
|
|
|
+ discount = #{discount,jdbcType=DOUBLE},
|
|
|
+ cut_down = #{cutDown,jdbcType=INTEGER},
|
|
|
+ start_time = #{startTime,jdbcType=TIMESTAMP},
|
|
|
+ end_time = #{endTime,jdbcType=TIMESTAMP},
|
|
|
+ effective = #{effective,jdbcType=BIT},
|
|
|
+ sharable = #{sharable,jdbcType=BIT}
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </update>
|
|
|
+ <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
+ select id, type, name, description, course_id, user_id, threshold, discount, cut_down,
|
|
|
+ start_time, end_time, effective, sharable
|
|
|
+ from coupon
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </select>
|
|
|
+ <select id="selectAll" resultMap="BaseResultMap">
|
|
|
+ select id, type, name, description, course_id, user_id, threshold, discount, cut_down,
|
|
|
+ start_time, end_time, effective, sharable
|
|
|
+ from coupon
|
|
|
+ </select>
|
|
|
+<!-- <select id="selectAllCourseCoupon" parameterType="java.lang.Integer" resultMap="BaseResultMap">-->
|
|
|
+<!-- select id, type, name, description, course_id, user_id, threshold, discount, cut_down,-->
|
|
|
+<!-- start_time, end_time, effective, sharable-->
|
|
|
+<!-- from coupon-->
|
|
|
+<!-- where (course_id = -1 or course_id = #{courseId,jdbcType=INTEGER}) and user_id = -1-->
|
|
|
+<!-- </select>-->
|
|
|
+ <select id="selectByCourseIdAndUserId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
+ select id, type, name, description, course_id, user_id, threshold, discount, cut_down,
|
|
|
+ start_time, end_time, effective, sharable
|
|
|
+ from coupon
|
|
|
+ where course_id = #{courseId,jdbcType=INTEGER} and user_id = #{userId,jdbcType=INTEGER}
|
|
|
+ </select>
|
|
|
+ <select id="selectByUserId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
+ select id, type, name, description, course_id, user_id, threshold, discount, cut_down,
|
|
|
+ start_time, end_time, effective, sharable
|
|
|
+ from coupon
|
|
|
+ where user_id = #{userId,jdbcType=INTEGER}
|
|
|
+ </select>
|
|
|
+</mapper>
|