CutDownPriceUserHelpMapper.xml 3.86 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="com.yoho.activity.dal.CutDownPriceUserHelpMapper">
  <resultMap id="BaseResultMap" type="com.yoho.activity.dal.model.CutDownPriceProductHelpUser">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="user_id" property="userId" jdbcType="INTEGER"  />
    <result column="help_user_id" property="helpUserId" jdbcType="INTEGER"  />
    <result column="activity_id" property="activityId" jdbcType="INTEGER"  />
    <result column="product_skn" property="productSkn" jdbcType="INTEGER"  />
    <result column="cut_record_id" property="cutRecordId" jdbcType="INTEGER"  />
    <result column="cut_price" property="cutPrice" jdbcType="DECIMAL"  />
    <result column="create_time" property="createTime" jdbcType="INTEGER"  />
    <result column="userName" property="userName" jdbcType="VARCHAR"  />
    <result column="userImgUrl" property="userImgUrl" jdbcType="VARCHAR"  />
    <result column="helpUserName" property="helpUserName" jdbcType="VARCHAR"  />
    <result column="helpUserImgUrl" property="helpUserImgUrl" jdbcType="VARCHAR"  />
  </resultMap>
  <sql id="Base_Column_List" >
    id, user_id, help_user_id,activity_id,product_skn,cut_record_id,cut_price,create_time, userName, userImgUrl, helpUserName, helpUserImgUrl
  </sql>

  <select id="selectHelpInfo" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from cutdown_price_help_user
    where user_id = #{userId,jdbcType=INTEGER}
    and activity_id = #{activityId,jdbcType=INTEGER}
    and product_skn = #{productSkn,jdbcType=INTEGER}
    and cut_record_id = #{cutRecordId,jdbcType=INTEGER}
  </select>

  <insert id="addHelpUserInfo" parameterType="com.yoho.activity.dal.model.CutDownPriceProductHelpUser">
    insert into cutdown_price_help_user (user_id, help_user_id,activity_id,product_skn,cut_record_id,cut_price,create_time, userName, userImgUrl, helpUserName, helpUserImgUrl)
    values (#{userId,jdbcType=INTEGER}, #{helpUserId,jdbcType=INTEGER}, #{activityId,jdbcType=INTEGER}, #{productSkn,jdbcType=INTEGER},
      #{cutRecordId,jdbcType=INTEGER}, #{cutPrice,jdbcType=DECIMAL}, #{createTime,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{userImgUrl,jdbcType=VARCHAR}, #{helpUserName,jdbcType=VARCHAR}, #{helpUserImgUrl,jdbcType=VARCHAR}
      )
  </insert>

  <select id="selectExistHelpInfoCurrentDay" resultType="java.lang.Integer">
    select count(1) FROM cutdown_price_help_user
    where help_user_id =  #{helpUserId,jdbcType=INTEGER}
    AND activity_id = #{activityId,jdbcType=INTEGER}
    AND product_skn = #{productSkn,jdbcType=INTEGER}
    and create_time &gt;= #{startTime,jdbcType=INTEGER}
  </select>

  <select id="selectExistHelpInfo" resultType="java.lang.Integer">
    select count(1) FROM cutdown_price_help_user
    where help_user_id =  #{helpUserId,jdbcType=INTEGER}
    AND activity_id = #{activityId,jdbcType=INTEGER}
    AND product_skn = #{productSkn,jdbcType=INTEGER}
    and cut_record_id = #{cutRecordId,jdbcType=INTEGER}
  </select>

  <select id="selectHelpInfoList" resultMap="BaseResultMap" parameterType="java.util.List">
    select
    <include refid="Base_Column_List" />
    from cutdown_price_help_user
    where
    <foreach collection="list" item="item" index="index" separator="OR">
      (user_id = #{item.userId,jdbcType=INTEGER} and activity_id=#{item.activityId,jdbcType=INTEGER} and product_skn=#{item.productSkn,jdbcType=INTEGER})
    </foreach>
  </select>

  <select id="selectHelpInfoListCurrentDay" resultMap="BaseResultMap" >
    select
    <include refid="Base_Column_List" />
    from cutdown_price_help_user
    where
    help_user_id =  #{helpUserId,jdbcType=INTEGER}
    and create_time &gt;= #{startTime,jdbcType=INTEGER}
    and create_time &lt;= #{endTime,jdbcType=INTEGER}
  </select>

</mapper>