|
@@ -0,0 +1,263 @@
|
|
|
+<?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.ygj.yuemum.dao.coupon.CouponCreateDao" >
|
|
|
+
|
|
|
+ <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.coupon.CouponCreate" >
|
|
|
+ <id column="id" property="id" jdbcType="INTEGER" />
|
|
|
+ <result column="cb_code" property="cb_code" jdbcType="VARCHAR" />
|
|
|
+ <result column="cb_name" property="cb_name" jdbcType="VARCHAR" />
|
|
|
+ <result column="cc_quantity" property="cc_quantity" jdbcType="INTEGER" />
|
|
|
+ <result column="cc_amount" property="cc_amount" jdbcType="INTEGER" />
|
|
|
+ <result column="cc_createdate" property="cc_createdate" jdbcType="DATE" />
|
|
|
+ <result column="cc_startdate" property="cc_startdate" jdbcType="DATE" />
|
|
|
+ <result column="cc_enddate" property="cc_enddate" jdbcType="DATE" />
|
|
|
+ <result column="cc_status" property="cc_status" jdbcType="INTEGER" />
|
|
|
+ <result column="syncmodoodate" property="syncmodoodate" jdbcType="DATE" />
|
|
|
+ <result column="syncmodoo" property="syncmodoo" jdbcType="VARCHAR" />
|
|
|
+ <result column="usercode" property="usercode" jdbcType="VARCHAR" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="Base_Column_List" >
|
|
|
+ id,cb_code,cb_name,cc_quantity,cc_amount,cc_createdate,cc_startdate,cc_enddate,cc_status,syncmodoodate,syncmodoo,usercode
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!--获取所有数据-->
|
|
|
+ <select id="getCount" resultType="java.lang.Integer" >
|
|
|
+ select
|
|
|
+ count(1)
|
|
|
+ from coupon_create
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getAll" resultMap="BaseResultMap" >
|
|
|
+ SELECT
|
|
|
+ id,
|
|
|
+ fgetcouponbatch(cb_code) cb_name,
|
|
|
+ cc_startdate,
|
|
|
+ cc_enddate,
|
|
|
+ cc_createdate,
|
|
|
+ cc_amount,
|
|
|
+ cc_quantity,
|
|
|
+ cc_status
|
|
|
+ FROM
|
|
|
+ coupon_create
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from coupon_create
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="checkCouponBatch" resultType="java.lang.Integer" parameterType="java.lang.String" >
|
|
|
+ select
|
|
|
+ count(1)
|
|
|
+ from coupon_create
|
|
|
+ where cb_code = #{id,jdbcType=VARCHAR}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="checkCouponBatchid" resultType="java.lang.Integer" parameterType="java.lang.Integer" >
|
|
|
+ SELECT
|
|
|
+ count(1)
|
|
|
+ FROM
|
|
|
+ coupon_create ta
|
|
|
+ LEFT JOIN coupon_batch tb ON ta.cb_code = tb.cb_code
|
|
|
+ WHERE
|
|
|
+ tb.id = #{id,jdbcType=VARCHAR}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
|
|
+ delete from coupon_create
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <!-- 插入一条培训信息 -->
|
|
|
+ <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.coupon.CouponCreate" >
|
|
|
+ insert into coupon_create
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides="," >
|
|
|
+ <if test="cb_code != null" >
|
|
|
+ cb_code,
|
|
|
+ </if>
|
|
|
+ <if test="cc_quantity != null" >
|
|
|
+ cc_quantity,
|
|
|
+ </if>
|
|
|
+ <if test="cc_amount != null" >
|
|
|
+ cc_amount,
|
|
|
+ </if>
|
|
|
+ <if test="cc_startdate != null" >
|
|
|
+ cc_startdate,
|
|
|
+ </if>
|
|
|
+ <if test="cc_enddate != null" >
|
|
|
+ cc_enddate,
|
|
|
+ </if>
|
|
|
+ <if test="cc_createdate != null" >
|
|
|
+ cc_createdate,
|
|
|
+ </if>
|
|
|
+ <if test="cc_status != null" >
|
|
|
+ cc_status
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
|
+ <if test="cb_code != null" >
|
|
|
+ #{cb_code,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="cc_quantity != null" >
|
|
|
+ #{cc_quantity,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="cc_amount != null" >
|
|
|
+ #{cc_amount,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="cc_startdate != null" >
|
|
|
+ #{cc_startdate,jdbcType=DATE},
|
|
|
+ </if>
|
|
|
+ <if test="cc_enddate != null" >
|
|
|
+ #{cc_enddate,jdbcType=DATE},
|
|
|
+ </if>
|
|
|
+ <if test="cc_createdate != null" >
|
|
|
+ #{cc_createdate,jdbcType=DATE},
|
|
|
+ </if>
|
|
|
+ <if test="cc_status != null" >
|
|
|
+ #{cc_status,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 根据id更新一条培训信息 -->
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.coupon.CouponCreate" >
|
|
|
+ update coupon_create
|
|
|
+ <set >
|
|
|
+ <if test="cb_code != null" >
|
|
|
+ cb_code = #{cb_code,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="cb_desc != null" >
|
|
|
+ cb_desc = #{cb_desc,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="cc_quantity != null" >
|
|
|
+ cc_quantity = #{cc_quantity,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="cc_amount != null" >
|
|
|
+ cc_amount = #{cc_amount,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="syncmodoodate != null" >
|
|
|
+ syncmodoodate = #{syncmodoodate,jdbcType=DATE},
|
|
|
+ </if>
|
|
|
+ <if test="syncmodoo != null" >
|
|
|
+ syncmodoo = #{syncmodoo,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="usercode != null" >
|
|
|
+ usercode = #{usercode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="date != null" >
|
|
|
+ date = #{date,jdbcType=DATE}
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!--获取所有数据-->
|
|
|
+ <select id="getQCouponCreateCount" resultType="java.lang.Integer" parameterType="com.ygj.yuemum.domain.coupon.CouponCreate">
|
|
|
+ SELECT
|
|
|
+ count(1)
|
|
|
+ FROM
|
|
|
+ coupon_create ta
|
|
|
+ LEFT JOIN coupon_batch tb ON ta.cb_code = tb.cb_code
|
|
|
+ where 1=1
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ and ta.id = #{id,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="cb_code != null and cb_code != ''">
|
|
|
+ and tb.cb_code = #{cb_code,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="cb_packages != null and cb_packages != ''">
|
|
|
+ and tb.cb_packages like "%"#{cb_packages,jdbcType=VARCHAR}"%"
|
|
|
+ </if>
|
|
|
+ <if test="cb_citys != null and cb_citys != ''">
|
|
|
+ and tb.cb_citys like "%"#{cb_citys,jdbcType=VARCHAR}"%"
|
|
|
+ </if>
|
|
|
+ <if test="cc_startdate != null and cc_startdate != ''">
|
|
|
+ and ta.cc_startdate = #{cc_startdate,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="cc_enddate != null and cc_enddate != ''">
|
|
|
+ and ta.cc_enddate = #{cc_enddate,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="cc_createdate != null and cc_createdate != ''">
|
|
|
+ and ta.cc_createdate = #{cc_createdate,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="cc_amount != null and cc_amount != ''">
|
|
|
+ and ta.cc_amount = #{cc_amount,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="cc_quantity != null and cc_quantity != ''">
|
|
|
+ and ta.cc_quantity = #{cc_quantity,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="cc_status != null ">
|
|
|
+ and ta.cc_status = #{cc_status,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getQCouponCreate" resultMap="BaseResultMap" parameterType="com.ygj.yuemum.domain.coupon.CouponCreate">
|
|
|
+ SELECT
|
|
|
+ ta.id,
|
|
|
+ tb.cb_code,
|
|
|
+ tb.cb_name,
|
|
|
+ ta.cc_amount,
|
|
|
+ ta.cc_quantity,
|
|
|
+ ta.cc_createdate,
|
|
|
+ ta.cc_status,
|
|
|
+ ta.cc_startdate,
|
|
|
+ ta.cc_enddate
|
|
|
+ FROM
|
|
|
+ coupon_create ta
|
|
|
+ LEFT JOIN coupon_batch tb ON ta.cb_code = tb.cb_code
|
|
|
+ where 1=1
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ and ta.id = #{id,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="cb_code != null and cb_code != ''">
|
|
|
+ and tb.cb_code = #{cb_code,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="cb_packages != null and cb_packages != ''">
|
|
|
+ and tb.cb_packages like "%"#{cb_packages,jdbcType=VARCHAR}"%"
|
|
|
+ </if>
|
|
|
+ <if test="cb_citys != null and cb_citys != ''">
|
|
|
+ and tb.cb_citys like "%"#{cb_citys,jdbcType=VARCHAR}"%"
|
|
|
+ </if>
|
|
|
+ <if test="cc_startdate != null and cc_startdate != ''">
|
|
|
+ and ta.cc_startdate = #{cc_startdate,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="cc_enddate != null and cc_enddate != ''">
|
|
|
+ and ta.cc_enddate = #{cc_enddate,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="cc_createdate != null and cc_createdate != ''">
|
|
|
+ and ta.cc_createdate = #{cc_createdate,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="cc_amount != null and cc_amount != ''">
|
|
|
+ and ta.cc_amount = #{cc_amount,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="cc_quantity != null and cc_quantity != ''">
|
|
|
+ and ta.cc_quantity = #{cc_quantity,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="cc_status != null ">
|
|
|
+ and ta.cc_status = #{cc_status,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="getccpmid" resultType="java.lang.Integer" >
|
|
|
+ SELECT auto_increment
|
|
|
+ FROM information_schema.tables
|
|
|
+ where table_schema="yuemum"
|
|
|
+ and table_name="coupon_create";
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <update id="disableCouponCreate" parameterType="java.lang.Integer" >
|
|
|
+ update coupon_create
|
|
|
+ set cc_status = 0
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="enableCouponCreate" parameterType="java.lang.Integer" >
|
|
|
+ update coupon_create
|
|
|
+ set cc_status = 1
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </update>
|
|
|
+
|
|
|
+</mapper>
|