addPlustar.md 3.83 KB

添加plustar分类接口

接口名: '/guang/plustar/addPlustar'

方法

POST JSONRAW

入参


属性名称 类型 例子 说明 是否必填 范围
brandId String 30 品牌id 1-10
brandType String 1 频道id 1-1
coverImg String http://img12.static.yhbimg.com/yhb-img01/2016/03/28/08/02a4da74a108380e93a33dc5eb91b42f2f.jpg 封面图 1-85
bannerImg String[] ["http://img12.static.yhbimg.com/yhb-img01/2016/03/28/08/02a4da74a108380e93a33dc5eb91b42f2f.jpg?imageView/2/w/300/h/300"] banner图 -
bannerTitle String 广泛丰厚的 banner标签 0-85
gender String 1 性别 0-1
status String 1 是否可用 0-1

对应SQL的操作库表

  <select id="selectByBrandIdAndType" resultMap="BaseResultMap" >
    select 
    <include refid="Base_Column_List" />
    from brand_relation where 1 = 1
    <if test="brandId != null">
        and brand_id = #{brandId}
    </if>
    <if test="brandType != null">
        and brand_type = #{brandType}
    </if>
  </select>

  <insert id="insertSelective" useGeneratedKeys="true" keyProperty="id" parameterType="com.yohobuy.platform.dal.guang.model.BrandRelation" >
    insert into brand_relation
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="brandId != null" >
        brand_id,
      </if>
      <if test="brandType != null" >
        brand_type,
      </if>
      <if test="coverImg != null" >
        cover_img,
      </if>
      <if test="bannerTitle != null" >
        banner_title,
      </if>
      <if test="isRecommend != null" >
        is_recommend,
      </if>
      <if test="orderBy != null" >
        order_by,
      </if>
      <if test="isDifferent != null" >
        is_different,
      </if>
      <if test="gender != null" >
        gender,
      </if>
      <if test="status != null" >
        status,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="updateTime != null" >
        update_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="brandId != null" >
        #{brandId,jdbcType=INTEGER},
      </if>
      <if test="brandType != null" >
        #{brandType,jdbcType=TINYINT},
      </if>
      <if test="coverImg != null" >
        #{coverImg,jdbcType=VARCHAR},
      </if>
      <if test="bannerTitle != null" >
        #{bannerTitle,jdbcType=VARCHAR},
      </if>
      <if test="isRecommend != null" >
        #{isRecommend,jdbcType=TINYINT},
      </if>
      <if test="orderBy != null" >
        #{orderBy,jdbcType=SMALLINT},
      </if>
      <if test="isDifferent != null" >
        #{isDifferent,jdbcType=BIT},
      </if>
      <if test="gender != null" >
        #{gender,jdbcType=CHAR},
      </if>
      <if test="status != null" >
        #{status,jdbcType=BIT},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=INTEGER},
      </if>
      <if test="updateTime != null" >
        #{updateTime,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>

  <insert id="insertBatch" parameterType="java.util.List" >
    insert into brand_img (relation_id, banner_img)
    values
    <foreach collection="list" item="item" separator=",">
        (#{item.relationId}, #{item.bannerImg})
    </foreach>
  </insert>

错误编码


错误码code 消息 说明
200 添加成功!
400 添加失败!
400 该频道下已经存在该品牌了

返回

{
    "code":200,
    "message":"添加成功!"
}