|
@@ -0,0 +1,71 @@
|
|
|
+package org.dromara.InventoryManagement.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.dromara.InventoryManagement.domain.BaseSupplier;
|
|
|
+import org.dromara.InventoryManagement.domain.bo.BaseSupplierBo;
|
|
|
+import org.dromara.InventoryManagement.domain.vo.BaseSupplierVo;
|
|
|
+import org.dromara.InventoryManagement.mapper.BaseSupplierMapper;
|
|
|
+import org.dromara.InventoryManagement.service.BaseSupplierService;
|
|
|
+import org.dromara.common.core.utils.MapstructUtils;
|
|
|
+import org.dromara.common.core.utils.OrderNumberGenerator;
|
|
|
+import org.dromara.common.core.utils.StringUtils;
|
|
|
+import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
+import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+
|
|
|
+@Service
|
|
|
+@RequiredArgsConstructor
|
|
|
+public class BaseBaseSupplierServiceImpl implements BaseSupplierService {
|
|
|
+
|
|
|
+ private final BaseSupplierMapper baseSupplierMapper;
|
|
|
+ private final OrderNumberGenerator generator = OrderNumberGenerator.getInstance();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询供应商
|
|
|
+ * @param baseSupplierBo 供应商BO对象
|
|
|
+ * @param pageQuery 分页参数
|
|
|
+ * @return 分页结果
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public TableDataInfo<BaseSupplierVo> selectPageSupplierList(BaseSupplierBo baseSupplierBo, PageQuery pageQuery) {
|
|
|
+ QueryWrapper<BaseSupplier> qw = new QueryWrapper<>();
|
|
|
+ qw.like(StringUtils.isNotBlank(baseSupplierBo.getCode()),"code", baseSupplierBo.getCode());
|
|
|
+ Page<BaseSupplierVo> page = baseSupplierMapper.selectVoPage(pageQuery.build(), qw);
|
|
|
+ return TableDataInfo.build(page);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增供应商
|
|
|
+ * @param baseSupplierBo 供应商BO对象
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public int insertSupplier(BaseSupplierBo baseSupplierBo) {
|
|
|
+ baseSupplierBo.setCode(generator.generateOrderNumber("SP"));
|
|
|
+ return baseSupplierMapper.insert(MapstructUtils.convert(baseSupplierBo, BaseSupplier.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改供应商
|
|
|
+ * @param baseSupplierBo 供应商BO对象
|
|
|
+ * @return 影响行数
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public int updateSupplier(BaseSupplierBo baseSupplierBo) {
|
|
|
+ return baseSupplierMapper.updateById(MapstructUtils.convert(baseSupplierBo, BaseSupplier.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除供应商
|
|
|
+ * @param supplierIds 供应商ID
|
|
|
+ * @return 影响行数
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public int deleteSupplierById(Long[] supplierIds) {
|
|
|
+ return baseSupplierMapper.deleteByIds(Arrays.asList(supplierIds));
|
|
|
+ }
|
|
|
+}
|