wms新增物料wms_configuration模块

master
maxw@mesnac.com 2 weeks ago
parent a70483c4e0
commit 70365db591

@ -64,7 +64,7 @@ public class WmsConfiguration {
/** /**
* id * id
*/ */
private int tenantId; private String tenantId;
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
private String createBy; private String createBy;
@ -86,5 +86,8 @@ public class WmsConfiguration {
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime; private Date updateTime;
@TableField(exist = false)
private String warehouseCode;//字段映射
} }

@ -71,7 +71,8 @@ public class WmsConfigurationBo extends BaseEntity {
/** /**
* id * id
*/ */
private int tenantId; private String tenantId;
} }

@ -99,6 +99,10 @@ public class WmsConfigurationVo implements Serializable {
@ExcelProperty(value = "审批范围", converter = ExcelDictConvert.class) @ExcelProperty(value = "审批范围", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "0=所有仓库1仓库") @ExcelDictFormat(readConverterExp = "0=所有仓库1仓库")
private String approveRange; private String approveRange;
/**
* id
*/
private String tenantId;
private String warehouseCode;
} }

@ -1,5 +1,6 @@
package org.dromara.wms.mapper; package org.dromara.wms.mapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
@ -18,4 +19,6 @@ public interface WmsConfigurationMapper extends BaseMapperPlus<WmsConfiguration,
int insertConfiguration(@Param("entity") WmsConfiguration entity); int insertConfiguration(@Param("entity") WmsConfiguration entity);
int selectNum(); int selectNum();
int updateByconfigurationId(WmsConfiguration wmsConfiguration);
} }

@ -1,5 +1,8 @@
package org.dromara.wms.service.impl; package org.dromara.wms.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import net.sf.jsqlparser.statement.Statements; import net.sf.jsqlparser.statement.Statements;
import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
@ -9,8 +12,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.dromara.common.mybatis.helper.DataPermissionHelper;
import org.dromara.system.api.model.LoginUser;
import org.dromara.wms.domain.BaseMaterialInfo;
import org.dromara.wms.domain.WmsBaseWarehouse;
import org.dromara.wms.domain.WmsConfiguration; import org.dromara.wms.domain.WmsConfiguration;
import org.dromara.wms.domain.WmsOutstockDetail;
import org.dromara.wms.domain.bo.WmsConfigurationBo; import org.dromara.wms.domain.bo.WmsConfigurationBo;
import org.dromara.wms.domain.bo.WmsOutstockDetailBo;
import org.dromara.wms.domain.vo.WmsConfigurationVo; import org.dromara.wms.domain.vo.WmsConfigurationVo;
import org.dromara.wms.mapper.WmsConfigurationMapper; import org.dromara.wms.mapper.WmsConfigurationMapper;
import org.dromara.wms.service.IWmsConfigurationService; import org.dromara.wms.service.IWmsConfigurationService;
@ -41,7 +50,10 @@ public class WmsConfigurationServiceImpl implements IWmsConfigurationService {
*/ */
@Override @Override
public WmsConfigurationVo queryById(Long configurationId){ public WmsConfigurationVo queryById(Long configurationId){
return baseMapper.selectVoById(configurationId); LambdaQueryWrapper<WmsConfiguration> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(WmsConfiguration::getConfigurationId,configurationId);
WmsConfigurationVo wmsConfigurationVo = baseMapper.selectVoOne(wrapper);
return wmsConfigurationVo;
} }
/** /**
@ -53,7 +65,8 @@ public class WmsConfigurationServiceImpl implements IWmsConfigurationService {
*/ */
@Override @Override
public TableDataInfo<WmsConfigurationVo> queryPageList(WmsConfigurationBo bo, PageQuery pageQuery) { public TableDataInfo<WmsConfigurationVo> queryPageList(WmsConfigurationBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<WmsConfiguration> lqw = buildQueryWrapper(bo); // LambdaQueryWrapper<WmsConfiguration> lqw = buildQueryWrapper(bo);
MPJLambdaWrapper<WmsConfiguration> lqw = buildJoinQueryWrapper(bo);
lqw.orderByDesc(WmsConfiguration::getCreateTime); lqw.orderByDesc(WmsConfiguration::getCreateTime);
Page<WmsConfigurationVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); Page<WmsConfigurationVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result); return TableDataInfo.build(result);
@ -70,6 +83,22 @@ public class WmsConfigurationServiceImpl implements IWmsConfigurationService {
LambdaQueryWrapper<WmsConfiguration> lqw = buildQueryWrapper(bo); LambdaQueryWrapper<WmsConfiguration> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw); return baseMapper.selectVoList(lqw);
} }
private MPJLambdaWrapper<WmsConfiguration> buildJoinQueryWrapper(WmsConfigurationBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<WmsConfiguration> lqw = JoinWrappers.lambda(WmsConfiguration.class)
.selectAll(WmsConfiguration.class)
.select(WmsBaseWarehouse::getWarehouseCode)
.leftJoin(WmsBaseWarehouse.class, WmsBaseWarehouse::getWarehouseId, WmsConfiguration::getWarehouseId);
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;
}
private LambdaQueryWrapper<WmsConfiguration> buildQueryWrapper(WmsConfigurationBo bo) { private LambdaQueryWrapper<WmsConfiguration> buildQueryWrapper(WmsConfigurationBo bo) {
Map<String, Object> params = bo.getParams(); Map<String, Object> params = bo.getParams();
@ -94,6 +123,9 @@ public class WmsConfigurationServiceImpl implements IWmsConfigurationService {
@Override @Override
public Boolean insertByBo(WmsConfigurationBo bo) { public Boolean insertByBo(WmsConfigurationBo bo) {
WmsConfiguration add = MapstructUtils.convert(bo, WmsConfiguration.class); WmsConfiguration add = MapstructUtils.convert(bo, WmsConfiguration.class);
// LoginUser currentUser = DataPermissionHelper.getVariable("user");
// String tenantId = currentUser.getTenantId();
// add.setTenantId(Integer.valueOf(tenantId));
boolean flag = baseMapper.insert(add) > 0; boolean flag = baseMapper.insert(add) > 0;
if (flag) { if (flag) {
bo.setConfigurationId(add.getConfigurationId()); bo.setConfigurationId(add.getConfigurationId());
@ -111,7 +143,7 @@ public class WmsConfigurationServiceImpl implements IWmsConfigurationService {
public Boolean updateByBo(WmsConfigurationBo bo) { public Boolean updateByBo(WmsConfigurationBo bo) {
WmsConfiguration update = MapstructUtils.convert(bo, WmsConfiguration.class); WmsConfiguration update = MapstructUtils.convert(bo, WmsConfiguration.class);
validEntityBeforeSave(update); validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0; return baseMapper.updateByconfigurationId(update) > 0;
} }
/** /**
@ -133,6 +165,8 @@ public class WmsConfigurationServiceImpl implements IWmsConfigurationService {
if(isValid){ if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验 //TODO 做一些业务上的校验,判断是否需要校验
} }
return baseMapper.deleteByIds(ids) > 0; LambdaUpdateWrapper<WmsConfiguration> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.in(WmsConfiguration::getConfigurationId,ids);
return baseMapper.delete(updateWrapper)>0;
} }
} }

@ -23,6 +23,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
VALUES (#{entity.nodeCode},(#{entity.nodeName},(#{entity.approveYesNo},(#{entity.approveType},(#{entity.approveRoleCode},(#{entity.warehouseId},(#{entity.approveRange},(#{entity.tenantId}, 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}) (#{entity.createBy},(#{entity.createTime},(#{entity.updateBy},(#{entity.updateTime})
</insert> </insert>
<update id="updateByconfigurationId" parameterType="org.dromara.wms.domain.WmsConfiguration">
update wms_configuration
<trim prefix="SET" suffixOverrides=",">
<if test="nodeCode != null">node_code = #{nodeCode},</if>
<if test="nodeName != null and nodeName != ''">node_name = #{nodeName},</if>
<if test="approveYesNo != null and approveYesNo != ''">approve_yes_no = #{approveYesNo},</if>
<if test="approveType != null">approve_type = #{approveType},</if>
<if test="approveRoleCode != null">approve_role_code = #{approveRoleCode},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="approveRange != null">approve_range = #{approveRange},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where configuration_id = #{configurationId}
</update>
<select id="selectNum" resultType="java.lang.Integer"> <select id="selectNum" resultType="java.lang.Integer">
select count(1) from wms_configuration select count(1) from wms_configuration
</select> </select>

Loading…
Cancel
Save