IntelligentReminderMapper.xml 5.31 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.IntelligentReminderMapper" >
  <resultMap id="BaseResultMap" type="cn.com.glsx.dj.weapp.model.IntelligentReminder" >
    <id column="ID" property="id" jdbcType="INTEGER" />
    <result column="ACCOUNT_ID" property="accountId" jdbcType="INTEGER" />
    <result column="MERCHANT_ID" property="merchantId" jdbcType="INTEGER" />
    <result column="MERCHANT_NAME" property="merchantName" jdbcType="VARCHAR" />
    <result column="REMINDER_ID" property="reminderId" jdbcType="INTEGER" />
    <result column="REMINDER_NAME" property="reminderName" jdbcType="VARCHAR" />
    <result column="REMINDER_TYPE" property="reminderType" jdbcType="TINYINT" />
    <result column="REMARK" property="remark" jdbcType="VARCHAR" />
    <result column="SOURCE" property="source" jdbcType="TINYINT" />
    <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="DELETE_FALG" property="deleteFalg" jdbcType="CHAR" />
  </resultMap>

  <resultMap id="ResultMapDTO" type="cn.com.glsx.dj.weapp.dto.IntelligentReminderDTO" >
    <id column="ID" property="id" jdbcType="INTEGER" />
    <result column="ACCOUNT_ID" property="accountId" jdbcType="INTEGER" />
    <result column="MERCHANT_ID" property="merchantId" jdbcType="INTEGER" />
    <result column="MERCHANT_NAME" property="merchantName" jdbcType="VARCHAR" />
    <result column="REMINDER_ID" property="reminderId" jdbcType="INTEGER" />
    <result column="REMINDER_NAME" property="reminderName" jdbcType="VARCHAR" />
    <result column="REMINDER_TYPE" property="reminderType" jdbcType="TINYINT" />
    <result column="REMARK" property="remark" jdbcType="VARCHAR" />
    <result column="SOURCE" property="source" jdbcType="TINYINT" />
    <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" >
    ID, ACCOUNT_ID, MERCHANT_ID, MERCHANT_NAME, REMINDER_ID, REMINDER_NAME, REMINDER_TYPE,
    REMARK, SOURCE, CREATED_BY, CREATED_DATE, UPDATED_BY,UPDATED_DATE, DELETED_FLAG
  </sql>
  <select id="selectByCondition" parameterType="java.util.HashMap" resultMap="ResultMapDTO">
    SELECT
    <include refid="Base_Column_List" />
    FROM dj_intelligent_reminder
    WHERE 1=1
    <if test="accountId != null">
      AND ACCOUNT_ID = #{accountId,jdbcType=INTEGER}
    </if>
    <if test="merchantId != null">
      AND MERCHANT_ID = #{merchantId,jdbcType=INTEGER}
    </if>
    AND DELETED_FLAG = 'N'
    ORDER BY UPDATED_DATE DESC
  </select>
  <insert id="insertReminder" parameterType="cn.com.glsx.dj.weapp.model.IntelligentReminder">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    INSERT INTO dj_intelligent_reminder (ACCOUNT_ID, MERCHANT_ID, MERCHANT_NAME,REMINDER_ID,REMINDER_NAME,
    REMINDER_TYPE,REMARK,SOURCE,CREATED_BY,CREATED_DATE,UPDATED_BY,UPDATED_DATE,DELETED_FLAG
    )
    VALUES (#{accountId,jdbcType=INTEGER}, #{merchantId,jdbcType=INTEGER}, #{merchantName,jdbcType=VARCHAR},
    #{reminderId,jdbcType=INTEGER},#{reminderName,jdbcType=VARCHAR},#{reminderType,jdbcType=TINYINT},
    #{remark,jdbcType=VARCHAR},#{source,jdbcType=TINYINT},
    #{createdBy,jdbcType=VARCHAR}, NOW(),#{updatedBy,jdbcType=VARCHAR}, NOW(), 'N')
  </insert>

  <select id="getIntelligentReminderById" parameterType="java.lang.Long" resultMap="BaseResultMap">
    SELECT
    <include refid="Base_Column_List" />
    FROM dj_intelligent_reminder
    WHERE ID = #{id,jdbcType=INTEGER}
  </select>
  <update id="updateReminderByCondition" parameterType="cn.com.glsx.dj.weapp.model.IntelligentReminder">
    UPDATE dj_intelligent_reminder
    SET
    <if test="accountId != null">
      ACCOUNT_ID = #{accountId},
    </if>
    <if test="merchantId != null">
      MERCHANT_ID = #{merchantId},
    </if>
    <if test="merchantName != null">
      MERCHANT_NAME = #{merchantName},
    </if>
    <if test="reminderName != null">
      REMINDER_NAME = #{reminderName},
    </if>
    <if test="reminderType != null">
      REMINDER_TYPE = #{reminderType},
    </if>
    <if test="remark != null">
      REMARK = #{remark},
    </if>
    <if test="source != null">
      SOURCE = #{source},
    </if>
    UPDATED_BY = #{updatedBy},
    UPDATED_DATE = NOW()
    WHERE
    ID = #{id,jdbcType=INTEGER}
  </update>

  <update id="deleterReminderById" parameterType="java.lang.Long">
  	UPDATE dj_intelligent_reminder
  	SET DELETED_FLAG = 'Y' , UPDATED_DATE = NOW()
  	WHERE ID = #{id}
  </update>
  <update id="deleterReminderByReminderId" parameterType="java.lang.Integer">
  	UPDATE dj_intelligent_reminder
  	SET DELETED_FLAG = 'Y' , UPDATED_DATE = NOW()
  	WHERE REMINDER_ID = #{reminderId}
  </update>
</mapper>