Authored by Lixiaodi

商品限制销售信息

package com.yohoufo.dal.product;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yohoufo.dal.product.model.ProductLimitSale;
public interface ProductLimitSaleMapper {
int deleteByPrimaryKey(Integer id);
int insert(ProductLimitSale record);
int insertSelective(ProductLimitSale record);
ProductLimitSale selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(ProductLimitSale record);
int updateByPrimaryKey(ProductLimitSale record);
List<ProductLimitSale> selectByProductIdAndUid(@Param("productId")Integer productId, @Param("uid")Integer uid);
}
\ No newline at end of file
... ...
package com.yohoufo.dal.product.model;
import java.math.BigDecimal;
public class ProductLimitSale {
private Integer id;
private Integer productId;
private Integer uid;
private BigDecimal profitRate;
private Integer createTime;
private Byte delStatus;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public BigDecimal getProfitRate() {
return profitRate;
}
public void setProfitRate(BigDecimal profitRate) {
this.profitRate = profitRate;
}
public Integer getCreateTime() {
return createTime;
}
public void setCreateTime(Integer createTime) {
this.createTime = createTime;
}
public Byte getDelStatus() {
return delStatus;
}
public void setDelStatus(Byte delStatus) {
this.delStatus = delStatus;
}
}
\ No newline at end of file
... ...
<?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.yohoufo.dal.product.ProductLimitSaleMapper" >
<resultMap id="BaseResultMap" type="com.yohoufo.dal.product.model.ProductLimitSale" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="product_id" property="productId" jdbcType="INTEGER" />
<result column="uid" property="uid" jdbcType="INTEGER" />
<result column="profit_rate" property="profitRate" jdbcType="DECIMAL" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="del_status" property="delStatus" jdbcType="TINYINT" />
</resultMap>
<sql id="Base_Column_List" >
id, product_id, uid, profit_rate, create_time, del_status
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from product_limit_sale
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByProductIdAndUid" resultMap="BaseResultMap" >
select distinct product_id
from product_limit_sale
where del_status = 0
<if test="productId != null" >
and product_id = #{productId}
</if>
<if test="uid != null" >
and uid = #{uid}
</if>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from product_limit_sale
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yohoufo.dal.product.model.ProductLimitSale" >
insert into product_limit_sale (id, product_id, uid,
profit_rate, create_time, del_status
)
values (#{id,jdbcType=INTEGER}, #{productId,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER},
#{profitRate,jdbcType=DECIMAL}, #{createTime,jdbcType=INTEGER}, #{delStatus,jdbcType=TINYINT}
)
</insert>
<insert id="insertSelective" parameterType="com.yohoufo.dal.product.model.ProductLimitSale" >
insert into product_limit_sale
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="productId != null" >
product_id,
</if>
<if test="uid != null" >
uid,
</if>
<if test="profitRate != null" >
profit_rate,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="delStatus != null" >
del_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="productId != null" >
#{productId,jdbcType=INTEGER},
</if>
<if test="uid != null" >
#{uid,jdbcType=INTEGER},
</if>
<if test="profitRate != null" >
#{profitRate,jdbcType=DECIMAL},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=INTEGER},
</if>
<if test="delStatus != null" >
#{delStatus,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.product.model.ProductLimitSale" >
update product_limit_sale
<set >
<if test="productId != null" >
product_id = #{productId,jdbcType=INTEGER},
</if>
<if test="uid != null" >
uid = #{uid,jdbcType=INTEGER},
</if>
<if test="profitRate != null" >
profit_rate = #{profitRate,jdbcType=DECIMAL},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=INTEGER},
</if>
<if test="delStatus != null" >
del_status = #{delStatus,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yohoufo.dal.product.model.ProductLimitSale" >
update product_limit_sale
set product_id = #{productId,jdbcType=INTEGER},
uid = #{uid,jdbcType=INTEGER},
profit_rate = #{profitRate,jdbcType=DECIMAL},
create_time = #{createTime,jdbcType=INTEGER},
del_status = #{delStatus,jdbcType=TINYINT}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -18,7 +18,7 @@
<properties>
<qiniu.version>7.0.5</qiniu.version>
<project-name>yohoufo-fore</project-name>
<model.version>6.0-SNAPSHOT</model.version>
<model.version>7.0-SNAPSHOT</model.version>
</properties>
<dependencyManagement>
... ...
... ... @@ -552,9 +552,9 @@ public class ProductController {
, @RequestParam(value = "uid") Integer userId) {
LOG.info("in method=ufo.product.queryProductLimitInfo product_id={}, uerId={}", productId, userId);
JSONObject result = new JSONObject();
String productIdInfo = configReader.getString("ufo.product.productLimitInfo", "");
LOG.info("in ufo.product.queryProductLimitInfo queryProductLimitInfo Is {}", productIdInfo);
if (StringUtils.contains(productIdInfo, Integer.toString(productId))) {
boolean hasPermission = productService.queryProductLimitInfo(productId, userId);
LOG.info("in ufo.product.queryProductLimitInfo queryProductLimitInfo Is {}", hasPermission);
if (!hasPermission) {
result.put("isLimit", "1");
result.put("tip", LIMIT_PRODUCT_TIP);
} else {
... ...
... ... @@ -89,4 +89,6 @@ public interface ProductService {
SkupDetailForScreenResp getSkuPDetailForShopsScreen(Integer skuP);
void changeSkupHideStatus(Integer uid, int status);
boolean queryProductLimitInfo(Integer productId, Integer userId);
}
... ...
... ... @@ -82,6 +82,9 @@ public class ProductServiceImpl implements ProductService {
@Autowired
private PriceTrendDayMapper priceTrendDayMapper;
@Autowired
private ProductLimitSaleMapper productLimitSaleMapper;
@Autowired
private SellerStoreMapUtil sellerStoreMapUtil;
... ... @@ -1077,4 +1080,14 @@ public class ProductServiceImpl implements ProductService {
innerResult.setSkupPrice(storagePrice.getPrice());
}
@Override
public boolean queryProductLimitInfo(Integer productId, Integer userId) {
List<ProductLimitSale> hasSet = productLimitSaleMapper.selectByProductIdAndUid(productId, null);
List<ProductLimitSale> userSet = productLimitSaleMapper.selectByProductIdAndUid(productId, userId);
if (!CollectionUtils.isEmpty(hasSet) && CollectionUtils.isEmpty(userSet)) {
return false;
} else {
return true;
}
}
}
... ...
... ... @@ -38,6 +38,7 @@ datasources:
- com.yohoufo.dal.product.ProductImportTranItemMapper
- com.yohoufo.dal.product.TransferRecordsMapper
- com.yohoufo.dal.product.TransferRecordsHistoryMapper
- com.yohoufo.dal.product.ProductLimitSaleMapper
ufo_order:
... ...
... ... @@ -38,6 +38,7 @@ datasources:
- com.yohoufo.dal.product.ProductImportTranItemMapper
- com.yohoufo.dal.product.TransferRecordsMapper
- com.yohoufo.dal.product.TransferRecordsHistoryMapper
- com.yohoufo.dal.product.ProductLimitSaleMapper
ufo_order:
servers:
... ...