123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 |
- <?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" />
- <result column="cb_type" property="cb_type" jdbcType="BIT" />
- <result column="no_amount" property="no_amount" jdbcType="INTEGER" />
- </resultMap>
- <sql id="Base_Column_List" >
- id,cb_code,cc_quantity,cc_amount,cc_createdate,cc_startdate,cc_enddate,cc_status,syncmodoodate,syncmodoo,usercode,cb_type,no_amount
- </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,
- cb_type,
- no_amount
- FROM
- coupon_create
- order by id desc
- </select>
- <select id="queryCollegeCoupon" resultMap="BaseResultMap" >
- SELECT
- id,
- fgetcouponbatch(cb_code) cb_name,
- cc_startdate,
- cc_enddate,
- cc_createdate,
- cc_amount,
- cc_quantity,
- cc_status,
- cb_type,
- no_amount
- FROM
- coupon_create
- where
- cb_type = 1
- order by id desc
- </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>
- <if test="cb_type != null" >
- cb_type,
- </if>
- <if test="no_amount != null" >
- no_amount
- </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>
- <if test="cb_type != null" >
- #{cb_type,jdbcType=BIT}
- </if>
- <if test="no_amount != null" >
- #{no_amount,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="cb_type != null" >
- cb_type = #{cb_type,jdbcType=BIT},
- </if>
- <if test="date != null" >
- `date` = #{date,jdbcType=DATE},
- </if>
- <if test="no_amount != null" >
- no_amount = #{no_amount,jdbcType=INTEGER}
- </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 concat ('%',#{cb_packages,jdbcType=VARCHAR},'%')
- </if>
- <if test="cb_citys != null and cb_citys != ''">
- and tb.cb_citys like concat ('%',#{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,
- ta.no_amount
- 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 concat ('%',#{cb_packages,jdbcType=VARCHAR},'%')
- </if>
- <if test="cb_citys != null and cb_citys != ''">
- and tb.cb_citys like concat ('%',#{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>
|