|
@@ -0,0 +1,199 @@
|
|
|
+<?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.promotion.PromotionOfflineDao" >
|
|
|
+
|
|
|
+ <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.promotion.PromotionOffline" >
|
|
|
+ <id column="id" property="id" jdbcType="INTEGER" />
|
|
|
+ <result column="po_name" property="po_name" jdbcType="VARCHAR" />
|
|
|
+ <result column="po_desc" property="po_desc" jdbcType="VARCHAR" />
|
|
|
+ <result column="po_headimg" property="po_headimg" jdbcType="VARCHAR" />
|
|
|
+ <result column="po_icon" property="po_icon" jdbcType="VARCHAR" />
|
|
|
+ <result column="po_startdate" property="po_startdate" jdbcType="VARCHAR" />
|
|
|
+ <result column="po_enddate" property="po_enddate" jdbcType="VARCHAR" />
|
|
|
+ <result column="po_mkt" property="po_mkt" jdbcType="VARCHAR" />
|
|
|
+ <result column="po_createtime" property="po_createtime" jdbcType="VARCHAR" />
|
|
|
+ <result column="po_createuser" property="po_createuser" jdbcType="VARCHAR" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!--获取所有数据-->
|
|
|
+ <select id="getPromotionOfflines" resultType="com.ygj.yuemum.domain.promotion.PromotionOffline" parameterType="com.ygj.yuemum.domain.promotion.PromotionOffline" >
|
|
|
+ select
|
|
|
+ id,po_name,po_desc,po_headimg,po_icon,po_startdate,po_enddate,
|
|
|
+ fgetbranches_name(po_mkt) po_mkt,po_createtime,po_createuser
|
|
|
+ from promotion_offline
|
|
|
+ where 1=1
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ and id = #{id,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="po_name != null and po_name != ''">
|
|
|
+ and po_name = #{po_name,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="po_desc != null and po_desc != ''">
|
|
|
+ and po_desc = #{po_desc,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="po_headimg != null and po_headimg != ''">
|
|
|
+ and po_headimg = #{po_headimg,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="po_icon != null and po_icon != ''">
|
|
|
+ and po_icon = #{po_icon,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="po_startdate != null and po_startdate != '' and po_enddate != null and po_enddate != ''">
|
|
|
+ and po_startdate >= DATE_FORMAT(#{po_startdate,jdbcType=VARCHAR},'%Y-%m-%d')
|
|
|
+ and po_enddate <= DATE_FORMAT(#{po_enddate,jdbcType=VARCHAR},'%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="po_mkt != null and po_mkt != ''">
|
|
|
+ and po_mkt = #{po_mkt,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="po_createtime != null and po_createtime != ''">
|
|
|
+ and DATE_FORMAT(po_createtime,'%Y-%m-%d') = #{po_createtime,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="po_createuser != null and po_createuser != ''">
|
|
|
+ and po_createuser = #{po_createuser,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ order by 1 desc
|
|
|
+ </select>
|
|
|
+ <select id="getQueryPromotionOfflines" resultType="com.ygj.yuemum.domain.promotion.PromotionOffline" parameterType="com.ygj.yuemum.domain.equipment.EquipmentLog" >
|
|
|
+ select
|
|
|
+ id,po_name
|
|
|
+ from promotion_offline
|
|
|
+ order by 1 desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getOnePromotionOfflines" resultType="com.ygj.yuemum.domain.promotion.PromotionOffline" parameterType="com.ygj.yuemum.domain.equipment.EquipmentLog" >
|
|
|
+ select
|
|
|
+ *
|
|
|
+ from promotion_offline
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getValidPO" resultType="java.lang.Integer" >
|
|
|
+ SELECT
|
|
|
+ count(1)
|
|
|
+ FROM
|
|
|
+ promotion_offline
|
|
|
+ where
|
|
|
+ TO_DAYS(NOW()) - TO_DAYS(po_enddate) <= 0
|
|
|
+ order by id desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getValidPosition" resultType="com.ygj.yuemum.domain.promotion.PromotionOffline" parameterType="java.lang.Integer" >
|
|
|
+ SELECT
|
|
|
+ *
|
|
|
+ FROM
|
|
|
+ promotion_offline
|
|
|
+ where
|
|
|
+ po_mkt = #{po_mkt,jdbcType=VARCHAR}
|
|
|
+ and TO_DAYS(NOW()) - TO_DAYS(po_enddate) <= 0
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="getPOLImage" resultType="java.lang.String" parameterType="java.lang.Integer" >
|
|
|
+ SELECT
|
|
|
+ po_headimg
|
|
|
+ FROM
|
|
|
+ promotion_offline
|
|
|
+ where
|
|
|
+ id = #{id,jdbcType=INTEGER}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getWxPosition" resultType="com.ygj.yuemum.domain.promotion.PromotionOffline" >
|
|
|
+ SELECT
|
|
|
+ id,po_name,po_headimg
|
|
|
+ FROM
|
|
|
+ promotion_offline
|
|
|
+ where
|
|
|
+ TO_DAYS(NOW()) - TO_DAYS(po_enddate) <= 0
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 插入一条培训信息 -->
|
|
|
+ <insert id="insertPromotionOffline" parameterType="com.ygj.yuemum.domain.promotion.PromotionOffline" >
|
|
|
+ insert into promotion_offline
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides="," >
|
|
|
+ <if test="po_name != null" >
|
|
|
+ po_name,
|
|
|
+ </if>
|
|
|
+ <if test="po_desc != null" >
|
|
|
+ po_desc,
|
|
|
+ </if>
|
|
|
+ <if test="po_headimg != null" >
|
|
|
+ po_headimg,
|
|
|
+ </if>
|
|
|
+ <if test="po_icon != null" >
|
|
|
+ po_icon,
|
|
|
+ </if>
|
|
|
+ <if test="po_startdate != null" >
|
|
|
+ po_startdate,
|
|
|
+ </if>
|
|
|
+ <if test="po_enddate != null" >
|
|
|
+ po_enddate,
|
|
|
+ </if>
|
|
|
+ <if test="po_mkt != null" >
|
|
|
+ po_mkt,
|
|
|
+ </if>
|
|
|
+ <if test="po_createtime != null" >
|
|
|
+ po_createtime,
|
|
|
+ </if>
|
|
|
+ <if test="po_createuser != null" >
|
|
|
+ po_createuser
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
|
+ <if test="po_name != null" >
|
|
|
+ #{po_name,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="po_desc != null" >
|
|
|
+ #{po_desc,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="po_headimg != null" >
|
|
|
+ #{po_headimg,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="po_icon != null" >
|
|
|
+ #{po_icon,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="po_startdate != null" >
|
|
|
+ #{po_startdate,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="po_enddate != null" >
|
|
|
+ #{po_enddate,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="po_mkt != null" >
|
|
|
+ #{po_mkt,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="po_createtime != null" >
|
|
|
+ #{po_createtime,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="po_createuser != null" >
|
|
|
+ #{po_createuser,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
|
|
+ delete from promotion_offline
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </delete>
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.promotion.PromotionOffline" >
|
|
|
+ update promotion_offline
|
|
|
+ <set >
|
|
|
+ <if test="po_name != null" >
|
|
|
+ po_name = #{po_name,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="po_desc != null" >
|
|
|
+ po_desc = #{po_desc,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="po_headimg != null" >
|
|
|
+ po_headimg = #{po_headimg,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="po_startdate != null" >
|
|
|
+ po_startdate = #{po_startdate,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="po_enddate != null" >
|
|
|
+ po_enddate = #{po_enddate,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="po_mkt != null" >
|
|
|
+ po_mkt = #{po_mkt,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </update>
|
|
|
+</mapper>
|