addLimitCode.md 5.9 KB

新增限购码接口

接口名: /limitCode/addLimitCode

方法

POST JSONRAW

入参


属性名称 类型 例子 说明 是否必填 长度限制
name String 新增限购码使用 限购码名称 1~255
limitTimes Integer 10 使用数量 1~11
reqDepartment String 零售运营部/平台运营 申请部门 1~255
limitDateFrom String 2016-02-16 00:00:00 使用期间:开始时间 1~255
limitDateTo String 2016-02-23 00:00:00 使用期间:结束时间 1~255
describe String 联调限购码批次1-未开售 限购码说明 1~255
limitSkn String 51134663 指定商品skn 1~11
userTypeLimit String 新注册 用户类型 0~255
creatorName String 测试账号 申请者名称 1~255
creatorId Integer 2794 申请者id 1~255
skus String 1001;1002;1003 指定sku 0~11
skuTimes String 2;3;5 指定sku的数量用分号分隔,数量是数字 0~11
limitCodeType String 1 生成限购码类型 N:SKN的场合,U:SKU的场合 1

{
    "creatorId": 2794,
    "creatorName": "测试账号",
    "describe": "测试用数据",
    "limitDateFrom": "2016-04-20 05:25:00",
    "limitDateTo": "2016-04-21 10:50:00",
    "limitSkn": "50000613",
    "limitTimes": 30,
    "name": "测试增加限购码",
    "reqDepartment": "零售部/营销策划",
    "userTypeLimit": "新注册|注册未购买|普通会员|银卡会员|金卡会员|白金会员",
    "skus": "102055",
    "skuTimes": "7",
    "limitCodeType": "U"
}

对应SQL的操作库表

  <insert id="addLimitCode" parameterType="com.yohobuy.platform.dal.promotion.model.LimitCode">
    <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
      SELECT LAST_INSERT_ID() AS id
    </selectKey>
    insert into limit_code
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="name != null" >
        name,
      </if>
      <if test="limitTimes != null" >
        limit_times,
      </if>
      <if test="reqDepartment != null" >
        req_department,
      </if>
      <if test="limitDateFrom != null" >
        limit_date_from,
      </if>
      <if test="limitDateTo != null" >
        limit_date_to,
      </if>
      <if test="describe != null" >
        `describe`,
      </if>
      <if test="limitInfo != null" >
        limit_info,
      </if>
      <if test="userUseLimit != null" >
        user_use_limit,
      </if>
      <if test="userTypeLimit != null" >
        user_type_limit,
      </if>
      <if test="limitSkn != null" >
        limit_skn,
      </if>
      <if test="creatorName != null" >
        creator_name,
      </if>
      <if test="creatorId != null" >
        creator_id,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="status != null" >
        status,
      </if>
      <if test="reason != null" >
        reason,
      </if>
      <if test="batchNo != null" >
        batchNo,
      </if>
      <if test="auditTime != null" >
        audit_time,
      </if>
       <if test="limitCodeType != null" >
        limit_code_type
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="name != null" >
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="limitTimes != null" >
        #{limitTimes,jdbcType=INTEGER},
      </if>
      <if test="reqDepartment != null" >
        #{reqDepartment,jdbcType=VARCHAR},
      </if>
      <if test="limitDateFrom != null" >
        #{limitDateFrom,jdbcType=VARCHAR},
      </if>
      <if test="limitDateTo != null" >
        #{limitDateTo,jdbcType=VARCHAR},
      </if>
      <if test="describe != null" >
        #{describe,jdbcType=VARCHAR},
      </if>
      <if test="limitInfo != null" >
         #{limitInfo,jdbcType=VARCHAR},
      </if>
      <if test="userUseLimit != null" >
        #{userUseLimit,jdbcType=INTEGER},
      </if>
      <if test="userTypeLimit != null" >
        #{userTypeLimit,jdbcType=VARCHAR},
      </if>
      <if test="limitSkn != null" >
        #{limitSkn,jdbcType=VARCHAR},
      </if>
      <if test="creatorName != null" >
        #{creatorName,jdbcType=VARCHAR},
      </if>
      <if test="creatorId != null" >
        #{creatorId,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=VARCHAR},
      </if>
      <if test="status != null" >
        #{status,jdbcType=INTEGER},
      </if>
      <if test="reason != null" >
        #{reason,jdbcType=VARCHAR},
      </if>
      <if test="batchNo != null" >
        #{batchNo,jdbcType=VARCHAR},
      </if>
      <if test="auditTime != null" >
        #{auditTime,jdbcType=VARCHAR},
      </if>
      <if test="limitCodeType != null" >
        #{limitCodeType,jdbcType=CHAR}
      </if>
    </trim>
  </insert>
<insert id="insertBatch" parameterType="java.util.List">
        insert into limit_code_sku (id, batchNo, skn,
        sku, sku_limit_times, create_time
        )
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.id,jdbcType=INTEGER}, #{item.batchno,jdbcType=VARCHAR}, #{item.skn,jdbcType=VARCHAR},
            #{item.sku,jdbcType=VARCHAR}, #{item.skuLimitTimes,jdbcType=INTEGER}, #{item.createTime,jdbcType=VARCHAR}
            )
        </foreach>
    </insert>

响应码


响应码code 消息 说明
200 添加成功.
400 参数限购码类型不能为空./入口参数skn不能为空./参数sku和sku数量不整合./sku对应的skn和skn不一致./sku和sku数量情报不能为空.
500 添加失败.

返回

{
    "code": 200,
    "data": [],
    "md5": "d751713988987e9331980363e24189ce",
    "message": "添加成功."
}