IntelligentRemindRuleMapper.xml 4.45 KB
<?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.com.glsx.dj.weapp.mapper.IntelligentRemindRuleMapper" >
  <resultMap id="BaseResultMap" type="cn.com.glsx.dj.weapp.model.IntelligentRemindRule" >
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="rule_classify" property="ruleClassify" jdbcType="VARCHAR" />
    <result column="mile_rule" property="mileRule" jdbcType="VARCHAR" />
    <result column="rule_name" property="ruleName" jdbcType="VARCHAR" />
    <result column="time_rule" property="timeRule" jdbcType="VARCHAR" />
    <result column="season_rule" property="seasonRule" jdbcType="VARCHAR" />
    <result column="merchant_id" property="merchantId" jdbcType="INTEGER" />
    <result column="created_by" property="createdBy" jdbcType="VARCHAR" />
    <result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
    <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
    <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
    <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
  </resultMap>

  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbg.generated
    -->
    id, rule_classify, mile_rule, rule_name, time_rule, season_rule, merchant_id, created_by, created_date,
    updated_by, updated_date, deleted_flag
  </sql>

  <select id="selectByPage" resultMap="BaseResultMap" parameterType="cn.com.glsx.dj.weapp.model.IntelligentRemindRule" >
    select
    rule_classify
    from dj_weapp_intelligent_remind_rule
    WHERE deleted_flag='N' and merchant_id=#{merchantId}
    group by rule_classify order by created_date desc
  </select>

  <select id="getRuleClass" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select
    rule_classify
    from dj_weapp_intelligent_remind_rule
    WHERE deleted_flag='N' and merchant_id=#{merchantId}
    group by rule_classify order by created_date desc
  </select>

  <select id="getRuleList" resultMap="BaseResultMap" parameterType="cn.com.glsx.dj.weapp.model.IntelligentRemindRule" >
    select
    <include refid="Base_Column_List" />
    from dj_weapp_intelligent_remind_rule
    WHERE deleted_flag='N' and merchant_id=#{merchantId}
    <if test="ruleClassify != null">
      and rule_classify = #{ruleClassify, jdbcType=VARCHAR}
    </if>
    order by created_date desc
  </select>

  <select id="getById" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from dj_weapp_intelligent_remind_rule
    where id = #{id} and deleted_flag = 'N'
  </select>

  <select id="getByMerchantId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from dj_weapp_intelligent_remind_rule
    where merchant_id = #{merchantId} and deleted_flag = 'N' order by created_date desc
  </select>

  <update id="deleteById" parameterType="java.lang.Integer">
    update dj_weapp_intelligent_remind_rule
    set
    deleted_flag = 'D'
    where id = #{id}
  </update>

  <update id="update" parameterType="cn.com.glsx.dj.weapp.model.IntelligentRemindRule" >
    update dj_weapp_intelligent_remind_rule
    <set >
      <if test="record.ruleClassify != null" >
        rule_classify = #{record.ruleClassify,jdbcType=VARCHAR},
      </if>
      <if test="record.ruleName != null" >
        rule_name = #{record.ruleName,jdbcType=VARCHAR},
      </if>
      time_rule = #{record.timeRule,jdbcType=VARCHAR},
      mile_rule = #{record.mileRule,jdbcType=VARCHAR},
      season_rule = #{record.seasonRule,jdbcType=VARCHAR},
      <if test="record.merchantId != null" >
        merchant_id = #{record.merchantId,jdbcType=INTEGER},
      </if>
      <if test="record.createdBy != null" >
        created_by = #{record.createdBy,jdbcType=VARCHAR},
      </if>
      <if test="record.createdDate != null" >
        created_date = #{record.createdDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updatedBy != null" >
        updated_by = #{record.updatedBy,jdbcType=VARCHAR},
      </if>
      <if test="record.updatedDate != null" >
        updated_date = #{record.updatedDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.deletedFlag != null" >
        deleted_flag = #{record.deletedFlag,jdbcType=CHAR},
      </if>
    </set>
    where id = #{record.id}
  </update>
</mapper>