Commit 4876888f by 刘宇峰

优化代码

1 parent 3a680b70
...@@ -4,6 +4,7 @@ import cn.com.glsx.admin.modules.entity.GoodsSaleLimit; ...@@ -4,6 +4,7 @@ import cn.com.glsx.admin.modules.entity.GoodsSaleLimit;
import cn.com.glsx.admin.modules.model.cloudcrane.response.QueryGoodsSaleLimitListResponse; import cn.com.glsx.admin.modules.model.cloudcrane.response.QueryGoodsSaleLimitListResponse;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper; import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -12,7 +13,10 @@ public interface GoodsSaleLimitMapper extends CommonBaseMapper<GoodsSaleLimit> { ...@@ -12,7 +13,10 @@ public interface GoodsSaleLimitMapper extends CommonBaseMapper<GoodsSaleLimit> {
List<QueryGoodsSaleLimitListResponse> queryGoodsSaleLimitList(List<String> goodsSkuCodes); List<QueryGoodsSaleLimitListResponse> queryGoodsSaleLimitList(List<String> goodsSkuCodes);
void insertOrUpdate(GoodsSaleLimit goodsSaleLimit); int insertOrUpdate(GoodsSaleLimit goodsSaleLimit);
GoodsSaleLimit selectByGoodsSkuCode(@Param("goodsSkuCode") String goodsSkuCode);
int logicDeleteByGoodsSkuCodes(@Param("goodsSkuCodes") List<String> goodsSkuCodes);
GoodsSaleLimit selectByGoodsSkuCode(String goodsSkuCode);
} }
\ No newline at end of file \ No newline at end of file
...@@ -265,12 +265,11 @@ public class GoodsService { ...@@ -265,12 +265,11 @@ public class GoodsService {
//新增或更新商品数据 //新增或更新商品数据
goodsMapper.insertOrUpdate(goods); goodsMapper.insertOrUpdate(goods);
goodsStockMapper.insertOrUpdate(goodsStock); goodsStockMapper.insertOrUpdate(goodsStock);
if (!Objects.isNull(goodsSaleLimit)) {
goodsSaleLimitMapper.insertOrUpdate(goodsSaleLimit);
}
//删除关联数据,重新入库 //删除关联数据,重新入库
if (allFlag) { if (allFlag) {
goodsDescDetailMapper.logicDeleteByGoodsSkuCodes(goodsSkuCodeList); goodsDescDetailMapper.logicDeleteByGoodsSkuCodes(goodsSkuCodeList);
goodsSaleLimitMapper.logicDeleteByGoodsSkuCodes(goodsSkuCodeList);
goodsImageMapper.logicDeleteByGoodsSkuCodes(goodsSkuCodeList); goodsImageMapper.logicDeleteByGoodsSkuCodes(goodsSkuCodeList);
goodsAttributeMapper.logicDeleteByGoodsSkuCodes(goodsSkuCodeList); goodsAttributeMapper.logicDeleteByGoodsSkuCodes(goodsSkuCodeList);
goodsSpecificationMapper.logicDeleteByGoodsSkuCodes(goodsSkuCodeList); goodsSpecificationMapper.logicDeleteByGoodsSkuCodes(goodsSkuCodeList);
...@@ -282,6 +281,9 @@ public class GoodsService { ...@@ -282,6 +281,9 @@ public class GoodsService {
if (!Objects.isNull(goodsDescDetail)) { if (!Objects.isNull(goodsDescDetail)) {
goodsDescDetailMapper.insert(goodsDescDetail); goodsDescDetailMapper.insert(goodsDescDetail);
} }
if (!Objects.isNull(goodsSaleLimit)) {
goodsSaleLimitMapper.insert(goodsSaleLimit);
}
if (CollectionUtils.isNotEmpty(goodsImageList)) { if (CollectionUtils.isNotEmpty(goodsImageList)) {
goodsImageMapper.insertList(goodsImageList); goodsImageMapper.insertList(goodsImageList);
} }
......
...@@ -5,17 +5,17 @@ ...@@ -5,17 +5,17 @@
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
<id column="id" jdbcType="INTEGER" property="id" /> <id column="id" jdbcType="INTEGER" property="id"/>
<result column="goods_sku_code" jdbcType="VARCHAR" property="goodsSkuCode" /> <result column="goods_sku_code" jdbcType="VARCHAR" property="goodsSkuCode"/>
<result column="sale_limit_type" jdbcType="INTEGER" property="saleLimitType" /> <result column="sale_limit_type" jdbcType="INTEGER" property="saleLimitType"/>
<result column="province_ids" jdbcType="VARCHAR" property="provinceIds" /> <result column="province_ids" jdbcType="VARCHAR" property="provinceIds"/>
<result column="city_ids" jdbcType="VARCHAR" property="cityIds" /> <result column="city_ids" jdbcType="VARCHAR" property="cityIds"/>
<result column="area_ids" jdbcType="VARCHAR" property="areaIds" /> <result column="area_ids" jdbcType="VARCHAR" property="areaIds"/>
<result column="del_flag" jdbcType="TINYINT" property="delFlag" /> <result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
<result column="created_date" jdbcType="TIMESTAMP" property="createdDate" /> <result column="created_date" jdbcType="TIMESTAMP" property="createdDate"/>
<result column="created_by" jdbcType="INTEGER" property="createdBy" /> <result column="created_by" jdbcType="INTEGER" property="createdBy"/>
<result column="updated_date" jdbcType="TIMESTAMP" property="updatedDate" /> <result column="updated_date" jdbcType="TIMESTAMP" property="updatedDate"/>
<result column="updated_by" jdbcType="INTEGER" property="updatedBy" /> <result column="updated_by" jdbcType="INTEGER" property="updatedBy"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!-- <!--
...@@ -25,7 +25,9 @@ ...@@ -25,7 +25,9 @@
created_date, created_by, updated_date, updated_by created_date, created_by, updated_date, updated_by
</sql> </sql>
<select id="queryGoodsSaleLimitList" resultType="cn.com.glsx.admin.modules.model.cloudcrane.response.QueryGoodsSaleLimitListResponse">
<select id="queryGoodsSaleLimitList"
resultType="cn.com.glsx.admin.modules.model.cloudcrane.response.QueryGoodsSaleLimitListResponse">
select sgsl.goods_sku_code,sgsl.sale_limit_type,sgsl.province_ids,sgsl.city_ids,sgsl.area_ids select sgsl.goods_sku_code,sgsl.sale_limit_type,sgsl.province_ids,sgsl.city_ids,sgsl.area_ids
from shopmall_goods_sale_limit sgsl from shopmall_goods_sale_limit sgsl
where sgsl.del_flag = 0 where sgsl.del_flag = 0
...@@ -49,9 +51,19 @@ ...@@ -49,9 +51,19 @@
</insert> </insert>
<select id="selectByGoodsSkuCode" resultMap="BaseResultMap"> <select id="selectByGoodsSkuCode" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> select
<include refid="Base_Column_List"/>
from shopmall_goods_sale_limit sgsl from shopmall_goods_sale_limit sgsl
where sgsl.del_flag = 0 where sgsl.del_flag = 0
and sgsl.goods_sku_code = #{goodsSkuCode} and sgsl.goods_sku_code = #{goodsSkuCode}
</select> </select>
<update id="logicDeleteByGoodsSkuCodes">
update shopmall_goods_sale_limit
set del_flag = -1, updated_date = sysdate()
where goods_sku_code in
<foreach collection="goodsSkuCodes" separator="," item="item" open="(" close=")">
#{item}
</foreach>
</update>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!