## 全网产品管理;
This commit is contained in:
parent
80490cf18f
commit
edd799643e
|
@ -1,4 +1,4 @@
|
|||
package com.hzs.sale.all.controller;
|
||||
package com.hzs.sale.all.controller.manage;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
|
@ -1,4 +1,4 @@
|
|||
package com.hzs.sale.all.controller;
|
||||
package com.hzs.sale.all.controller.manage;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
|
@ -51,10 +51,10 @@ public class AllProductDetailController extends BaseController {
|
|||
queryWrapper.like(AllProductDetail::getOrderCode, param.getOrderCode());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(param.getStartDate())) {
|
||||
queryWrapper.ge(AllProductDetail::getCreationTime, DateUtils.getStartTime(DateUtils.parseDateOne(param.getStartDate(), DateUtils.YAMMER)));
|
||||
queryWrapper.ge(AllProductDetail::getCreationTime, DateUtils.getStartTime(DateUtils.parseDateOne(param.getStartDate(), DateUtils.YYYY_MM_DD)));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(param.getEndDate())) {
|
||||
queryWrapper.le(AllProductDetail::getCreationTime, DateUtils.getEndTime(DateUtils.parseDateOne(param.getEndDate(), DateUtils.YAMMER)));
|
||||
queryWrapper.le(AllProductDetail::getCreationTime, DateUtils.getEndTime(DateUtils.parseDateOne(param.getEndDate(), DateUtils.YYYY_MM_DD)));
|
||||
}
|
||||
queryWrapper.orderByDesc(AllProductDetail::getCreationTime);
|
||||
List<AllProductDetail> productList = iAllProductDetailService.list(queryWrapper);
|
|
@ -2,6 +2,9 @@ package com.hzs.sale.all.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.hzs.common.domain.sale.all.AllProduct;
|
||||
import com.hzs.common.domain.sale.all.AllProductDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 全系统产品 服务类
|
||||
|
@ -17,8 +20,16 @@ public interface IAllProductService extends IService<AllProduct> {
|
|||
|
||||
/**
|
||||
* 删除产品
|
||||
*
|
||||
* @param pkId
|
||||
*/
|
||||
void deleteProduct(Integer pkId, Long userId);
|
||||
|
||||
/**
|
||||
* 同步数据
|
||||
*
|
||||
* @param productDetailList
|
||||
*/
|
||||
void syncData(List<AllProductDetail> productDetailList);
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 全系统产品 服务实现类
|
||||
|
@ -56,4 +57,17 @@ public class AllProductServiceImpl extends ServiceImpl<AllProductMapper, AllProd
|
|||
);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void syncData(List<AllProductDetail> productDetailList) {
|
||||
iAllProductDetailService.saveBatch(productDetailList);
|
||||
|
||||
for (AllProductDetail allProductDetail : productDetailList) {
|
||||
baseMapper.changeInventory(AllProduct.builder()
|
||||
.pkId(allProductDetail.getPkAllProduct())
|
||||
.inventory(allProductDetail.getChangeNum())
|
||||
.build());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
<!-- 更新产品库存 -->
|
||||
<update id="changeInventory">
|
||||
update ALL_PRODUCT ap
|
||||
set ap.inventory = ap.inventory + #{param.inventory},
|
||||
ap.pk_modified = #{param.pkModified},
|
||||
ap.modified_time = sysdate
|
||||
set ap.inventory = ap.inventory + #{param.inventory},
|
||||
<if test="param.pkModified != null">
|
||||
ap.pk_modified = #{param.pkModified},
|
||||
</if>
|
||||
ap.modified_time = sysdate
|
||||
where ap.pk_id = #{param.pkId}
|
||||
</update>
|
||||
|
||||
|
|
|
@ -5,13 +5,15 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.hzs.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 全系统产品
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
|
|
Loading…
Reference in New Issue