Authored by Lixiaodi

修改出售全新加操作者id

... ... @@ -20,7 +20,7 @@ public interface ProductLimitSaleMapper {
List<ProductLimitSale> selectByProductId(Integer productId);
int softDeleteByProductId(Integer productId);
int softDeleteByProductId(@Param("productId")Integer productId, @Param("editUid")Integer editUid);
List<Integer> selectHasDataProductIds(@Param("productIdList")List<Integer> productIdList);
... ...
... ... @@ -20,4 +20,6 @@ public class ProductLimitSale {
private Integer delStatus;
private Integer editUid;
}
\ No newline at end of file
... ...
... ... @@ -8,9 +8,10 @@
<result column="profit_rate" property="profitRate" jdbcType="DECIMAL" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="del_status" property="delStatus" jdbcType="INTEGER" />
<result column="edit_uid" property="editUid" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, product_id, uid, profit_rate, create_time, del_status
id, product_id, uid, profit_rate, create_time, del_status,edit_uid
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
... ... @@ -48,10 +49,10 @@
<insert id="insert" parameterType="com.yoho.ufo.dal.model.ProductLimitSale" >
insert into product_limit_sale (id, product_id, uid,
profit_rate, create_time, del_status
profit_rate, create_time, del_status,edit_uid
)
values (#{id,jdbcType=INTEGER}, #{productId,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER},
#{profitRate,jdbcType=DECIMAL}, #{createTime,jdbcType=INTEGER}, #{delStatus,jdbcType=INTEGER}
#{profitRate,jdbcType=DECIMAL}, #{createTime,jdbcType=INTEGER}, #{delStatus,jdbcType=INTEGER}, #{editUid,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.yoho.ufo.dal.model.ProductLimitSale" >
... ... @@ -129,7 +130,7 @@
</update>
<update id="softDeleteByProductId" parameterType="com.yoho.ufo.dal.model.ProductLimitSale" >
update product_limit_sale set del_status = 1 where product_id = #{productId,jdbcType=INTEGER} and del_status=0
update product_limit_sale set del_status = 1,editUid=#{editUid} where product_id = #{productId,jdbcType=INTEGER} and del_status=0
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -114,6 +114,12 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
@Override
public ApiResponse<Void> addOrUpdate(ProductRequestBo bo, boolean isCheckUrl) {
Integer uid = new UserHelper().getUserId();
if (uid == null || uid < 1) {
return new ApiResponse<>(400, "请先登录!", null);
}
checkProductInfo(bo, isCheckUrl);
Product product = getProductFromBo(bo);
Goods goods = getGoodsFromBo(bo);
... ... @@ -165,12 +171,12 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
}
}
updateLimitSaleInfo(bo.getLimitSaleInfo(), productId);
updateLimitSaleInfo(bo.getLimitSaleInfo(), productId, uid);
productIntroService.insertProductDesc(productId, bo.getProductIntro());
return new ApiResponse<Void>(null);
}
private void updateLimitSaleInfo(List<String> limitSaleInfo, Integer productId) {
private void updateLimitSaleInfo(List<String> limitSaleInfo, Integer productId, Integer editUid) {
Map<Integer, BigDecimal> map = new HashMap<>();
if (CollectionUtils.isNotEmpty(limitSaleInfo)) {
for (int i = 0; i < limitSaleInfo.size(); i++) {
... ... @@ -233,7 +239,7 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
}
LOGGER.info("商品:{} 限制出售包含关系,删除之后为:{}", productId, map);
} else {
int num = productLimitSaleMapper.softDeleteByProductId(productId);
int num = productLimitSaleMapper.softDeleteByProductId(productId, editUid);
LOGGER.info("商品:{} 限制出售清空模式!软删除结果:{}", productId, num);
}
int now = (int) (System.currentTimeMillis() / 1000);
... ... @@ -244,6 +250,7 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
s.setProfitRate(percent);
s.setDelStatus(0);
s.setCreateTime(now);
s.setEditUid(editUid);
productLimitSaleMapper.insert(s);
LOGGER.info("商品:{} 限制出售,新增条目:{}", productId, s);
});
... ...