PointAdjustItemMapper.xml 7.71 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.runsa.crmapp.points.mapper.PointAdjustItemMapper">
  <resultMap id="BaseResultMap" type="cn.runsa.crmapp.points.entity.PointAdjustItem">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="ID" jdbcType="BIGINT" property="id" />
    <result column="ADJ_ID" jdbcType="VARCHAR" property="adjId" />
    <result column="CST_ID" jdbcType="BIGINT" property="cstId" />
    <result column="POINTS" jdbcType="DOUBLE" property="points" />
    <result column="ORDER_ID" jdbcType="VARCHAR" property="orderId" />
    <result column="ORDER_SRC" jdbcType="VARCHAR" property="orderSrc" />
    <result column="S_TIME" jdbcType="TIMESTAMP" property="sTime" />
    <result column="E_TIME" jdbcType="TIMESTAMP" property="eTime" />
    <result column="STATUS" jdbcType="TINYINT" property="status" />
    <result column="RESULT_MEMO" jdbcType="VARCHAR" property="resultMemo" />
    <result column="REMARK" jdbcType="VARCHAR" property="remark" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    `ID`, `ADJ_ID`, `CST_ID`, `POINTS`, `ORDER_ID`, `ORDER_SRC`, `S_TIME`, `E_TIME`, 
    `STATUS`, `RESULT_MEMO`, `REMARK`
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from crm_point_adjust_detail
    where `ID` = #{id,jdbcType=BIGINT}
  </select>
  <select id="findByAdjId" parameterType="java.lang.String" resultMap="BaseResultMap">
  		select 
  			<include refid="Base_Column_List" />
		FROM
			crm_point_adjust_detail
		WHERE 
			ADJ_ID = #{adjId,jdbcType=VARCHAR}
  </select>
  <select id="existCustId" parameterType="cn.runsa.crmapp.points.entity.PointAdjustItem" resultType="java.lang.Integer">
  	select 
  		COUNT(*)
	FROM
	crm_point_adjust_detail
	WHERE 
	ADJ_ID = #{adjId,jdbcType=VARCHAR} AND CST_ID = #{cstId,jdbcType=BIGINT}
  </select>
   <select id="validatedPoint" parameterType="cn.runsa.crmapp.points.entity.PointAdjustItem" resultType="java.lang.Double">
	  	SELECT t1.PNT_VAL FROM `crm_points_account` t1 WHERE t1.CST_ID = #{cstId,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from crm_point_adjust_detail
    where `ID` = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByAdjId" parameterType="java.lang.String">
	  	delete from crm_point_adjust_detail
	    where `ADJ_ID` = #{adjId,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" parameterType="cn.runsa.crmapp.points.entity.PointAdjustItem">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into crm_point_adjust_detail (`ADJ_ID`, `CST_ID`, `POINTS`, 
      `ORDER_ID`, `ORDER_SRC`, `S_TIME`, 
      `E_TIME`, `STATUS`, `RESULT_MEMO`, 
      `REMARK`)
    values (#{adjId,jdbcType=VARCHAR}, #{cstId,jdbcType=BIGINT}, #{points,jdbcType=DOUBLE}, 
      #{orderId,jdbcType=VARCHAR}, #{orderSrc,jdbcType=VARCHAR}, SYSDATE(), 
      #{eTime,jdbcType=TIMESTAMP}, 0, #{resultMemo,jdbcType=VARCHAR}, 
      #{remark,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="cn.runsa.crmapp.points.entity.PointAdjustItem">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into crm_point_adjust_detail
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="adjId != null">
        `ADJ_ID`,
      </if>
      <if test="cstId != null">
        `CST_ID`,
      </if>
      <if test="points != null">
        `POINTS`,
      </if>
      <if test="orderId != null">
        `ORDER_ID`,
      </if>
      <if test="orderSrc != null">
        `ORDER_SRC`,
      </if>
      <if test="sTime != null">
        `S_TIME`,
      </if>
      <if test="eTime != null">
        `E_TIME`,
      </if>
      <if test="status != null">
        `STATUS`,
      </if>
      <if test="resultMemo != null">
        `RESULT_MEMO`,
      </if>
      <if test="remark != null">
        `REMARK`,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="adjId != null">
        #{adjId,jdbcType=VARCHAR},
      </if>
      <if test="cstId != null">
        #{cstId,jdbcType=BIGINT},
      </if>
      <if test="points != null">
        #{points,jdbcType=DOUBLE},
      </if>
      <if test="orderId != null">
        #{orderId,jdbcType=VARCHAR},
      </if>
      <if test="orderSrc != null">
        #{orderSrc,jdbcType=VARCHAR},
      </if>
      <if test="sTime != null">
        #{sTime,jdbcType=TIMESTAMP},
      </if>
      <if test="eTime != null">
        #{eTime,jdbcType=TIMESTAMP},
      </if>
      <if test="status != null">
        #{status,jdbcType=TINYINT},
      </if>
      <if test="resultMemo != null">
        #{resultMemo,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="cn.runsa.crmapp.points.entity.PointAdjustItem">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update crm_point_adjust_detail
    <set>
      <if test="adjId != null">
        `ADJ_ID` = #{adjId,jdbcType=VARCHAR},
      </if>
      <if test="cstId != null">
        `CST_ID` = #{cstId,jdbcType=BIGINT},
      </if>
      <if test="points != null">
        `POINTS` = #{points,jdbcType=DOUBLE},
      </if>
      <if test="orderId != null">
        `ORDER_ID` = #{orderId,jdbcType=VARCHAR},
      </if>
      <if test="orderSrc != null">
        `ORDER_SRC` = #{orderSrc,jdbcType=VARCHAR},
      </if>
      <if test="sTime != null">
        `S_TIME` = #{sTime,jdbcType=TIMESTAMP},
      </if>
      <if test="eTime != null">
        `E_TIME` = #{eTime,jdbcType=TIMESTAMP},
      </if>
      <if test="status != null">
        `STATUS` = #{status,jdbcType=TINYINT},
      </if>
      <if test="resultMemo != null">
        `RESULT_MEMO` = #{resultMemo,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        `REMARK` = #{remark,jdbcType=VARCHAR},
      </if>
    </set>
    where `ID` = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.runsa.crmapp.points.entity.PointAdjustItem">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update crm_point_adjust_detail
    set `ADJ_ID` = #{adjId,jdbcType=VARCHAR},
      `CST_ID` = #{cstId,jdbcType=BIGINT},
      `POINTS` = #{points,jdbcType=DOUBLE},
      `ORDER_ID` = #{orderId,jdbcType=VARCHAR},
      `ORDER_SRC` = #{orderSrc,jdbcType=VARCHAR},
      `S_TIME` = #{sTime,jdbcType=TIMESTAMP},
      `E_TIME` = #{eTime,jdbcType=TIMESTAMP},
      `STATUS` = #{status,jdbcType=TINYINT},
      `RESULT_MEMO` = #{resultMemo,jdbcType=VARCHAR},
      `REMARK` = #{remark,jdbcType=VARCHAR}
    where `ID` = #{id,jdbcType=BIGINT}
  </update>
</mapper>