增加 送货单模块
parent
c0003881bb
commit
de67497e1f
@ -0,0 +1,106 @@
|
||||
package org.dromara.wms.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.wms.domain.vo.WmsDeliveryNoteVo;
|
||||
import org.dromara.wms.domain.bo.WmsDeliveryNoteBo;
|
||||
import org.dromara.wms.service.IWmsDeliveryNoteService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 送货单管理
|
||||
* 前端访问路由地址为:/wms/deliveryNote
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-06
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/deliveryNote")
|
||||
public class WmsDeliveryNoteController extends BaseController {
|
||||
|
||||
private final IWmsDeliveryNoteService wmsDeliveryNoteService;
|
||||
|
||||
/**
|
||||
* 查询送货单管理列表
|
||||
*/
|
||||
@SaCheckPermission("wms:deliveryNote:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsDeliveryNoteVo> list(WmsDeliveryNoteBo bo, PageQuery pageQuery) {
|
||||
return wmsDeliveryNoteService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出送货单管理列表
|
||||
*/
|
||||
@SaCheckPermission("wms:deliveryNote:export")
|
||||
@Log(title = "送货单管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsDeliveryNoteBo bo, HttpServletResponse response) {
|
||||
List<WmsDeliveryNoteVo> list = wmsDeliveryNoteService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "送货单管理", WmsDeliveryNoteVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取送货单管理详细信息
|
||||
*
|
||||
* @param deliveryNoteId 主键
|
||||
*/
|
||||
@SaCheckPermission("wms:deliveryNote:query")
|
||||
@GetMapping("/{deliveryNoteId}")
|
||||
public R<WmsDeliveryNoteVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long deliveryNoteId) {
|
||||
return R.ok(wmsDeliveryNoteService.queryById(deliveryNoteId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增送货单管理
|
||||
*/
|
||||
@SaCheckPermission("wms:deliveryNote:add")
|
||||
@Log(title = "送货单管理", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsDeliveryNoteBo bo) {
|
||||
return toAjax(wmsDeliveryNoteService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改送货单管理
|
||||
*/
|
||||
@SaCheckPermission("wms:deliveryNote:edit")
|
||||
@Log(title = "送货单管理", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsDeliveryNoteBo bo) {
|
||||
return toAjax(wmsDeliveryNoteService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除送货单管理
|
||||
*
|
||||
* @param deliveryNoteIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("wms:deliveryNote:remove")
|
||||
@Log(title = "送货单管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{deliveryNoteIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] deliveryNoteIds) {
|
||||
return toAjax(wmsDeliveryNoteService.deleteWithValidByIds(List.of(deliveryNoteIds), true));
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.wms.mapper;
|
||||
|
||||
import org.dromara.wms.domain.WmsDeliveryNote;
|
||||
import org.dromara.wms.domain.vo.WmsDeliveryNoteVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 送货单管理Mapper接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-06
|
||||
*/
|
||||
public interface WmsDeliveryNoteMapper extends BaseMapperPlus<WmsDeliveryNote, WmsDeliveryNoteVo> {
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package org.dromara.wms.service;
|
||||
|
||||
import org.dromara.wms.domain.WmsDeliveryNote;
|
||||
import org.dromara.wms.domain.vo.WmsDeliveryNoteVo;
|
||||
import org.dromara.wms.domain.bo.WmsDeliveryNoteBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 送货单管理Service接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-06
|
||||
*/
|
||||
public interface IWmsDeliveryNoteService {
|
||||
|
||||
/**
|
||||
* 查询送货单管理
|
||||
*
|
||||
* @param deliveryNoteId 主键
|
||||
* @return 送货单管理
|
||||
*/
|
||||
WmsDeliveryNoteVo queryById(Long deliveryNoteId);
|
||||
|
||||
/**
|
||||
* 分页查询送货单管理列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 送货单管理分页列表
|
||||
*/
|
||||
TableDataInfo<WmsDeliveryNoteVo> queryPageList(WmsDeliveryNoteBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的送货单管理列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 送货单管理列表
|
||||
*/
|
||||
List<WmsDeliveryNoteVo> queryList(WmsDeliveryNoteBo bo);
|
||||
|
||||
/**
|
||||
* 新增送货单管理
|
||||
*
|
||||
* @param bo 送货单管理
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(WmsDeliveryNoteBo bo);
|
||||
|
||||
/**
|
||||
* 修改送货单管理
|
||||
*
|
||||
* @param bo 送货单管理
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(WmsDeliveryNoteBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除送货单管理信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
package org.dromara.wms.service.impl;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.common.collect.Maps;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.wms.domain.bo.WmsDeliveryNoteBo;
|
||||
import org.dromara.wms.domain.vo.WmsDeliveryNoteVo;
|
||||
import org.dromara.wms.domain.WmsDeliveryNote;
|
||||
import org.dromara.wms.mapper.WmsDeliveryNoteMapper;
|
||||
import org.dromara.wms.service.IWmsDeliveryNoteService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 送货单管理Service业务层处理
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-06
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsDeliveryNoteServiceImpl implements IWmsDeliveryNoteService {
|
||||
|
||||
private final WmsDeliveryNoteMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询送货单管理
|
||||
*
|
||||
* @param deliveryNoteId 主键
|
||||
* @return 送货单管理
|
||||
*/
|
||||
@Override
|
||||
public WmsDeliveryNoteVo queryById(Long deliveryNoteId){
|
||||
|
||||
return baseMapper.selectVoOne(new LambdaQueryWrapper<WmsDeliveryNote>().eq(WmsDeliveryNote::getDeliveryNoteId, deliveryNoteId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询送货单管理列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 送货单管理分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsDeliveryNoteVo> queryPageList(WmsDeliveryNoteBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsDeliveryNote> lqw = buildQueryWrapper(bo);
|
||||
lqw.orderByAsc(WmsDeliveryNote::getCreateTime);
|
||||
Page<WmsDeliveryNoteVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的送货单管理列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 送货单管理列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsDeliveryNoteVo> queryList(WmsDeliveryNoteBo bo) {
|
||||
LambdaQueryWrapper<WmsDeliveryNote> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WmsDeliveryNote> buildQueryWrapper(WmsDeliveryNoteBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WmsDeliveryNote> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getDeliveryNoteId() != null, WmsDeliveryNote::getDeliveryNoteId, bo.getDeliveryNoteId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getPoNo()), WmsDeliveryNote::getPoNo, bo.getPoNo());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getTenantId()), WmsDeliveryNote::getTenantId, bo.getTenantId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDeliveryNoteCode()), WmsDeliveryNote::getDeliveryNoteCode, bo.getDeliveryNoteCode());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDeliveryNoteState()), WmsDeliveryNote::getDeliveryNoteState, bo.getDeliveryNoteState());
|
||||
lqw.eq(bo.getPrintQty() != null, WmsDeliveryNote::getPrintQty, bo.getPrintQty());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getLicensePlate()), WmsDeliveryNote::getLicensePlate, bo.getLicensePlate());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增送货单管理
|
||||
*
|
||||
* @param bo 送货单管理
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsDeliveryNoteBo bo) {
|
||||
WmsDeliveryNote add = MapstructUtils.convert(bo, WmsDeliveryNote.class);
|
||||
// add.setCreateBy("12312");
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setDeliveryNoteId(add.getDeliveryNoteId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改送货单管理
|
||||
*
|
||||
* @param bo 送货单管理
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsDeliveryNoteBo bo) {
|
||||
WmsDeliveryNote update = MapstructUtils.convert(bo, WmsDeliveryNote.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsDeliveryNote entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除送货单管理信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?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="org.dromara.wms.mapper.WmsDeliveryNoteMapper">
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue