wms新增后端服务
parent
d594db2a4f
commit
ad00cbf62b
@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-modules</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>hwmom-wms</artifactId>
|
||||
|
||||
<description>
|
||||
hwmom-wms仓储模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-nacos</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Common Log -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-dict</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-doc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-dubbo</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-seata</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-idempotent</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-tenant</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-translation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-sensitive</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-encrypt</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Api System -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-api-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-api-resource</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.mysql</groupId>-->
|
||||
<!-- <artifactId>mysql-connector-j</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>mssql-jdbc</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.microsoft.sqlserver</groupId>-->
|
||||
<!-- <artifactId>mssql-jdbc</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.github.jsqlparser</groupId>-->
|
||||
<!-- <artifactId>jsqlparser</artifactId>-->
|
||||
<!-- <version>1.4</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version> <!-- 确保使用兼容的插件版本 -->
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -0,0 +1,22 @@
|
||||
package org.dromara.wms;
|
||||
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
|
||||
|
||||
/**
|
||||
* 系统模块
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EnableDubbo
|
||||
@SpringBootApplication
|
||||
public class HwMomWmsApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication application = new SpringApplication(HwMomWmsApplication.class);
|
||||
application.setApplicationStartup(new BufferingApplicationStartup(2048));
|
||||
application.run(args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 仓储模块启动成功 ლ(´ڡ`ლ)゙ ");
|
||||
}
|
||||
}
|
@ -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.dromara.wms.domain.bo.WmsConfigurationBo;
|
||||
import org.dromara.wms.domain.vo.WmsConfigurationVo;
|
||||
import org.dromara.wms.service.IWmsConfigurationService;
|
||||
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.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 仓库模块配置
|
||||
* 前端访问路由地址为:/system/configuration
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-03
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/configuration")
|
||||
public class WmsConfigurationController extends BaseController {
|
||||
|
||||
private final IWmsConfigurationService wmsConfigurationService;
|
||||
|
||||
/**
|
||||
* 查询仓库模块配置列表
|
||||
*/
|
||||
@SaCheckPermission("system:configuration:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsConfigurationVo> list(WmsConfigurationBo bo, PageQuery pageQuery) {
|
||||
return wmsConfigurationService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出仓库模块配置列表
|
||||
*/
|
||||
@SaCheckPermission("system:configuration:export")
|
||||
@Log(title = "仓库模块配置", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsConfigurationBo bo, HttpServletResponse response) {
|
||||
List<WmsConfigurationVo> list = wmsConfigurationService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "仓库模块配置", WmsConfigurationVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取仓库模块配置详细信息
|
||||
*
|
||||
* @param configurationId 主键
|
||||
*/
|
||||
@SaCheckPermission("system:configuration:query")
|
||||
@GetMapping("/{configurationId}")
|
||||
public R<WmsConfigurationVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long configurationId) {
|
||||
return R.ok(wmsConfigurationService.queryById(configurationId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增仓库模块配置
|
||||
*/
|
||||
@SaCheckPermission("system:configuration:add")
|
||||
@Log(title = "仓库模块配置", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsConfigurationBo bo) {
|
||||
return toAjax(wmsConfigurationService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改仓库模块配置
|
||||
*/
|
||||
@SaCheckPermission("system:configuration:edit")
|
||||
@Log(title = "仓库模块配置", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsConfigurationBo bo) {
|
||||
return toAjax(wmsConfigurationService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除仓库模块配置
|
||||
*
|
||||
* @param configurationIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:configuration:remove")
|
||||
@Log(title = "仓库模块配置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{configurationIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] configurationIds) {
|
||||
return toAjax(wmsConfigurationService.deleteWithValidByIds(List.of(configurationIds), true));
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package org.dromara.wms.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.wms.domain.WmsConfiguration;
|
||||
import org.dromara.wms.domain.vo.WmsConfigurationVo;
|
||||
|
||||
/**
|
||||
* 仓库模块配置Mapper接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-03
|
||||
*/
|
||||
@Mapper
|
||||
public interface WmsConfigurationMapper extends BaseMapperPlus<WmsConfiguration, WmsConfigurationVo> {
|
||||
|
||||
int insertConfiguration(@Param("entity") WmsConfiguration entity);
|
||||
|
||||
int selectNum();
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package org.dromara.wms.service;
|
||||
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.wms.domain.bo.WmsConfigurationBo;
|
||||
import org.dromara.wms.domain.vo.WmsConfigurationVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 仓库模块配置Service接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-03
|
||||
*/
|
||||
public interface IWmsConfigurationService {
|
||||
|
||||
/**
|
||||
* 查询仓库模块配置
|
||||
*
|
||||
* @param configurationId 主键
|
||||
* @return 仓库模块配置
|
||||
*/
|
||||
WmsConfigurationVo queryById(Long configurationId);
|
||||
|
||||
/**
|
||||
* 分页查询仓库模块配置列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 仓库模块配置分页列表
|
||||
*/
|
||||
TableDataInfo<WmsConfigurationVo> queryPageList(WmsConfigurationBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的仓库模块配置列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 仓库模块配置列表
|
||||
*/
|
||||
List<WmsConfigurationVo> queryList(WmsConfigurationBo bo);
|
||||
|
||||
/**
|
||||
* 新增仓库模块配置
|
||||
*
|
||||
* @param bo 仓库模块配置
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(WmsConfigurationBo bo);
|
||||
|
||||
/**
|
||||
* 修改仓库模块配置
|
||||
*
|
||||
* @param bo 仓库模块配置
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(WmsConfigurationBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除仓库模块配置信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
package org.dromara.wms.service.impl;
|
||||
|
||||
import net.sf.jsqlparser.statement.Statements;
|
||||
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.dromara.wms.domain.WmsConfiguration;
|
||||
import org.dromara.wms.domain.bo.WmsConfigurationBo;
|
||||
import org.dromara.wms.domain.vo.WmsConfigurationVo;
|
||||
import org.dromara.wms.mapper.WmsConfigurationMapper;
|
||||
import org.dromara.wms.service.IWmsConfigurationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 仓库模块配置Service业务层处理
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-01-03
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsConfigurationServiceImpl implements IWmsConfigurationService {
|
||||
@Autowired
|
||||
private final WmsConfigurationMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询仓库模块配置
|
||||
*
|
||||
* @param configurationId 主键
|
||||
* @return 仓库模块配置
|
||||
*/
|
||||
@Override
|
||||
public WmsConfigurationVo queryById(Long configurationId){
|
||||
return baseMapper.selectVoById(configurationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询仓库模块配置列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 仓库模块配置分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsConfigurationVo> queryPageList(WmsConfigurationBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsConfiguration> lqw = buildQueryWrapper(bo);
|
||||
lqw.orderByDesc(WmsConfiguration::getCreateTime);
|
||||
Page<WmsConfigurationVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的仓库模块配置列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 仓库模块配置列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsConfigurationVo> queryList(WmsConfigurationBo bo) {
|
||||
LambdaQueryWrapper<WmsConfiguration> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WmsConfiguration> buildQueryWrapper(WmsConfigurationBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WmsConfiguration> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getConfigurationId() != null, WmsConfiguration::getConfigurationId, bo.getConfigurationId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getNodeCode()), WmsConfiguration::getNodeCode, bo.getNodeCode());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getNodeName()), WmsConfiguration::getNodeName, bo.getNodeName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getApproveYesNo()), WmsConfiguration::getApproveYesNo, bo.getApproveYesNo());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getApproveType()), WmsConfiguration::getApproveType, bo.getApproveType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getApproveRoleCode()), WmsConfiguration::getApproveRoleCode, bo.getApproveRoleCode());
|
||||
lqw.eq(bo.getWarehouseId() != null, WmsConfiguration::getWarehouseId, bo.getWarehouseId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getApproveRange()), WmsConfiguration::getApproveRange, bo.getApproveRange());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增仓库模块配置
|
||||
*
|
||||
* @param bo 仓库模块配置
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsConfigurationBo bo) {
|
||||
WmsConfiguration add = MapstructUtils.convert(bo, WmsConfiguration.class);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setConfigurationId(add.getConfigurationId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改仓库模块配置
|
||||
*
|
||||
* @param bo 仓库模块配置
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsConfigurationBo bo) {
|
||||
WmsConfiguration update = MapstructUtils.convert(bo, WmsConfiguration.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsConfiguration 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,29 @@
|
||||
<?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.WmsConfigurationMapper">
|
||||
|
||||
<insert id="insertConfiguration">
|
||||
|
||||
INSERT
|
||||
INTO
|
||||
wms_configuration (node_code,
|
||||
node_name,
|
||||
approve_yes_no,
|
||||
approve_type,
|
||||
approve_role_code,
|
||||
warehouse_id,
|
||||
approve_range,
|
||||
tenant_id,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time)
|
||||
VALUES (#{entity.nodeCode},(#{entity.nodeName},(#{entity.approveYesNo},(#{entity.approveType},(#{entity.approveRoleCode},(#{entity.warehouseId},(#{entity.approveRange},(#{entity.tenantId},
|
||||
(#{entity.createBy},(#{entity.createTime},(#{entity.updateBy},(#{entity.updateTime})
|
||||
</insert>
|
||||
<select id="selectNum" resultType="java.lang.Integer">
|
||||
select count(1) from wms_configuration
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue