库区设置
This commit is contained in:
parent
417c63277d
commit
056e4ddf46
@ -0,0 +1,112 @@
|
|||||||
|
package com.ktg.mes.wm.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.ktg.common.constant.UserConstants;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ktg.common.annotation.Log;
|
||||||
|
import com.ktg.common.core.controller.BaseController;
|
||||||
|
import com.ktg.common.core.domain.AjaxResult;
|
||||||
|
import com.ktg.common.enums.BusinessType;
|
||||||
|
import com.ktg.mes.wm.domain.WmStorageLocation;
|
||||||
|
import com.ktg.mes.wm.service.IWmStorageLocationService;
|
||||||
|
import com.ktg.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ktg.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库区设置Controller
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-05-07
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mes/wm/location")
|
||||||
|
public class WmStorageLocationController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IWmStorageLocationService wmStorageLocationService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询库区设置列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mes:wm:location:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(WmStorageLocation wmStorageLocation)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<WmStorageLocation> list = wmStorageLocationService.selectWmStorageLocationList(wmStorageLocation);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出库区设置列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mes:wm:location:export')")
|
||||||
|
@Log(title = "库区设置", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, WmStorageLocation wmStorageLocation)
|
||||||
|
{
|
||||||
|
List<WmStorageLocation> list = wmStorageLocationService.selectWmStorageLocationList(wmStorageLocation);
|
||||||
|
ExcelUtil<WmStorageLocation> util = new ExcelUtil<WmStorageLocation>(WmStorageLocation.class);
|
||||||
|
util.exportExcel(response, list, "库区设置数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取库区设置详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mes:wm:location:query')")
|
||||||
|
@GetMapping(value = "/{locationId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("locationId") Long locationId)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(wmStorageLocationService.selectWmStorageLocationByLocationId(locationId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增库区设置
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mes:wm:location:add')")
|
||||||
|
@Log(title = "库区设置", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody WmStorageLocation wmStorageLocation)
|
||||||
|
{
|
||||||
|
if(UserConstants.NOT_UNIQUE.equals(wmStorageLocationService.checkLocationCodeUnique(wmStorageLocation))){
|
||||||
|
return AjaxResult.error("库区编码已存在!");
|
||||||
|
}
|
||||||
|
if(UserConstants.NOT_UNIQUE.equals(wmStorageLocationService.checkLocationNameUnique(wmStorageLocation))){
|
||||||
|
return AjaxResult.error("库区名称已存在!");
|
||||||
|
}
|
||||||
|
return toAjax(wmStorageLocationService.insertWmStorageLocation(wmStorageLocation));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改库区设置
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mes:wm:location:edit')")
|
||||||
|
@Log(title = "库区设置", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody WmStorageLocation wmStorageLocation)
|
||||||
|
{
|
||||||
|
return toAjax(wmStorageLocationService.updateWmStorageLocation(wmStorageLocation));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除库区设置
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('mes:wm:location:remove')")
|
||||||
|
@Log(title = "库区设置", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{locationIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] locationIds)
|
||||||
|
{
|
||||||
|
return toAjax(wmStorageLocationService.deleteWmStorageLocationByLocationIds(locationIds));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,165 @@
|
|||||||
|
package com.ktg.mes.wm.domain;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ktg.common.annotation.Excel;
|
||||||
|
import com.ktg.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库区设置对象 wm_storage_location
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-05-07
|
||||||
|
*/
|
||||||
|
public class WmStorageLocation extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 库区ID */
|
||||||
|
private Long locationId;
|
||||||
|
|
||||||
|
/** 库区编码 */
|
||||||
|
@Excel(name = "库区编码")
|
||||||
|
private String locationCode;
|
||||||
|
|
||||||
|
/** 库区名称 */
|
||||||
|
@Excel(name = "库区名称")
|
||||||
|
private String locationName;
|
||||||
|
|
||||||
|
/** 仓库ID */
|
||||||
|
@Excel(name = "仓库ID")
|
||||||
|
private Long warehouseId;
|
||||||
|
|
||||||
|
/** 面积 */
|
||||||
|
@Excel(name = "面积")
|
||||||
|
private BigDecimal area;
|
||||||
|
|
||||||
|
/** 是否开启库位管理 */
|
||||||
|
@Excel(name = "是否开启库位管理")
|
||||||
|
private String areaFlag;
|
||||||
|
|
||||||
|
/** 预留字段1 */
|
||||||
|
private String attr1;
|
||||||
|
|
||||||
|
/** 预留字段2 */
|
||||||
|
private String attr2;
|
||||||
|
|
||||||
|
/** 预留字段3 */
|
||||||
|
private Long attr3;
|
||||||
|
|
||||||
|
/** 预留字段4 */
|
||||||
|
private Long attr4;
|
||||||
|
|
||||||
|
public void setLocationId(Long locationId)
|
||||||
|
{
|
||||||
|
this.locationId = locationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getLocationId()
|
||||||
|
{
|
||||||
|
return locationId;
|
||||||
|
}
|
||||||
|
public void setLocationCode(String locationCode)
|
||||||
|
{
|
||||||
|
this.locationCode = locationCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLocationCode()
|
||||||
|
{
|
||||||
|
return locationCode;
|
||||||
|
}
|
||||||
|
public void setLocationName(String locationName)
|
||||||
|
{
|
||||||
|
this.locationName = locationName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLocationName()
|
||||||
|
{
|
||||||
|
return locationName;
|
||||||
|
}
|
||||||
|
public void setWarehouseId(Long warehouseId)
|
||||||
|
{
|
||||||
|
this.warehouseId = warehouseId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getWarehouseId()
|
||||||
|
{
|
||||||
|
return warehouseId;
|
||||||
|
}
|
||||||
|
public void setArea(BigDecimal area)
|
||||||
|
{
|
||||||
|
this.area = area;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getArea()
|
||||||
|
{
|
||||||
|
return area;
|
||||||
|
}
|
||||||
|
public void setAreaFlag(String areaFlag)
|
||||||
|
{
|
||||||
|
this.areaFlag = areaFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAreaFlag()
|
||||||
|
{
|
||||||
|
return areaFlag;
|
||||||
|
}
|
||||||
|
public void setAttr1(String attr1)
|
||||||
|
{
|
||||||
|
this.attr1 = attr1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAttr1()
|
||||||
|
{
|
||||||
|
return attr1;
|
||||||
|
}
|
||||||
|
public void setAttr2(String attr2)
|
||||||
|
{
|
||||||
|
this.attr2 = attr2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAttr2()
|
||||||
|
{
|
||||||
|
return attr2;
|
||||||
|
}
|
||||||
|
public void setAttr3(Long attr3)
|
||||||
|
{
|
||||||
|
this.attr3 = attr3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAttr3()
|
||||||
|
{
|
||||||
|
return attr3;
|
||||||
|
}
|
||||||
|
public void setAttr4(Long attr4)
|
||||||
|
{
|
||||||
|
this.attr4 = attr4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAttr4()
|
||||||
|
{
|
||||||
|
return attr4;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("locationId", getLocationId())
|
||||||
|
.append("locationCode", getLocationCode())
|
||||||
|
.append("locationName", getLocationName())
|
||||||
|
.append("warehouseId", getWarehouseId())
|
||||||
|
.append("area", getArea())
|
||||||
|
.append("areaFlag", getAreaFlag())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.append("attr1", getAttr1())
|
||||||
|
.append("attr2", getAttr2())
|
||||||
|
.append("attr3", getAttr3())
|
||||||
|
.append("attr4", getAttr4())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
package com.ktg.mes.wm.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ktg.mes.wm.domain.WmStorageLocation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库区设置Mapper接口
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-05-07
|
||||||
|
*/
|
||||||
|
public interface WmStorageLocationMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询库区设置
|
||||||
|
*
|
||||||
|
* @param locationId 库区设置主键
|
||||||
|
* @return 库区设置
|
||||||
|
*/
|
||||||
|
public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询库区设置列表
|
||||||
|
*
|
||||||
|
* @param wmStorageLocation 库区设置
|
||||||
|
* @return 库区设置集合
|
||||||
|
*/
|
||||||
|
public List<WmStorageLocation> selectWmStorageLocationList(WmStorageLocation wmStorageLocation);
|
||||||
|
|
||||||
|
|
||||||
|
public WmStorageLocation checkLocationCodeUnique(WmStorageLocation wmStorageLocation);
|
||||||
|
public WmStorageLocation checkLocationNameUnique(WmStorageLocation wmStorageLocation);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增库区设置
|
||||||
|
*
|
||||||
|
* @param wmStorageLocation 库区设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertWmStorageLocation(WmStorageLocation wmStorageLocation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改库区设置
|
||||||
|
*
|
||||||
|
* @param wmStorageLocation 库区设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateWmStorageLocation(WmStorageLocation wmStorageLocation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除库区设置
|
||||||
|
*
|
||||||
|
* @param locationId 库区设置主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteWmStorageLocationByLocationId(Long locationId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除库区设置
|
||||||
|
*
|
||||||
|
* @param locationIds 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteWmStorageLocationByLocationIds(Long[] locationIds);
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
package com.ktg.mes.wm.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ktg.mes.wm.domain.WmStorageLocation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库区设置Service接口
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-05-07
|
||||||
|
*/
|
||||||
|
public interface IWmStorageLocationService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询库区设置
|
||||||
|
*
|
||||||
|
* @param locationId 库区设置主键
|
||||||
|
* @return 库区设置
|
||||||
|
*/
|
||||||
|
public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询库区设置列表
|
||||||
|
*
|
||||||
|
* @param wmStorageLocation 库区设置
|
||||||
|
* @return 库区设置集合
|
||||||
|
*/
|
||||||
|
public List<WmStorageLocation> selectWmStorageLocationList(WmStorageLocation wmStorageLocation);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查库区编码是否唯一
|
||||||
|
* @param wmStorageLocation
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String checkLocationCodeUnique(WmStorageLocation wmStorageLocation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查库区名称是否唯一
|
||||||
|
* @param wmStorageLocation
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String checkLocationNameUnique(WmStorageLocation wmStorageLocation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增库区设置
|
||||||
|
*
|
||||||
|
* @param wmStorageLocation 库区设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertWmStorageLocation(WmStorageLocation wmStorageLocation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改库区设置
|
||||||
|
*
|
||||||
|
* @param wmStorageLocation 库区设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateWmStorageLocation(WmStorageLocation wmStorageLocation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除库区设置
|
||||||
|
*
|
||||||
|
* @param locationIds 需要删除的库区设置主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteWmStorageLocationByLocationIds(Long[] locationIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除库区设置信息
|
||||||
|
*
|
||||||
|
* @param locationId 库区设置主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteWmStorageLocationByLocationId(Long locationId);
|
||||||
|
}
|
@ -0,0 +1,120 @@
|
|||||||
|
package com.ktg.mes.wm.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ktg.common.constant.UserConstants;
|
||||||
|
import com.ktg.common.utils.DateUtils;
|
||||||
|
import com.ktg.common.utils.StringUtils;
|
||||||
|
import org.apache.catalina.User;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ktg.mes.wm.mapper.WmStorageLocationMapper;
|
||||||
|
import com.ktg.mes.wm.domain.WmStorageLocation;
|
||||||
|
import com.ktg.mes.wm.service.IWmStorageLocationService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库区设置Service业务层处理
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-05-07
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class WmStorageLocationServiceImpl implements IWmStorageLocationService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private WmStorageLocationMapper wmStorageLocationMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询库区设置
|
||||||
|
*
|
||||||
|
* @param locationId 库区设置主键
|
||||||
|
* @return 库区设置
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId)
|
||||||
|
{
|
||||||
|
return wmStorageLocationMapper.selectWmStorageLocationByLocationId(locationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询库区设置列表
|
||||||
|
*
|
||||||
|
* @param wmStorageLocation 库区设置
|
||||||
|
* @return 库区设置
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<WmStorageLocation> selectWmStorageLocationList(WmStorageLocation wmStorageLocation)
|
||||||
|
{
|
||||||
|
return wmStorageLocationMapper.selectWmStorageLocationList(wmStorageLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String checkLocationCodeUnique(WmStorageLocation wmStorageLocation) {
|
||||||
|
WmStorageLocation location = wmStorageLocationMapper.checkLocationCodeUnique(wmStorageLocation);
|
||||||
|
Long locationId = wmStorageLocation.getLocationId()==null?-1L:wmStorageLocation.getLocationId();
|
||||||
|
if(StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()){
|
||||||
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
return UserConstants.UNIQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String checkLocationNameUnique(WmStorageLocation wmStorageLocation) {
|
||||||
|
WmStorageLocation location = wmStorageLocationMapper.checkLocationNameUnique(wmStorageLocation);
|
||||||
|
Long locationId = wmStorageLocation.getLocationId()==null?-1L:wmStorageLocation.getLocationId();
|
||||||
|
if(StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()){
|
||||||
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
return UserConstants.UNIQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增库区设置
|
||||||
|
*
|
||||||
|
* @param wmStorageLocation 库区设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertWmStorageLocation(WmStorageLocation wmStorageLocation)
|
||||||
|
{
|
||||||
|
wmStorageLocation.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return wmStorageLocationMapper.insertWmStorageLocation(wmStorageLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改库区设置
|
||||||
|
*
|
||||||
|
* @param wmStorageLocation 库区设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateWmStorageLocation(WmStorageLocation wmStorageLocation)
|
||||||
|
{
|
||||||
|
wmStorageLocation.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return wmStorageLocationMapper.updateWmStorageLocation(wmStorageLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除库区设置
|
||||||
|
*
|
||||||
|
* @param locationIds 需要删除的库区设置主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteWmStorageLocationByLocationIds(Long[] locationIds)
|
||||||
|
{
|
||||||
|
return wmStorageLocationMapper.deleteWmStorageLocationByLocationIds(locationIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除库区设置信息
|
||||||
|
*
|
||||||
|
* @param locationId 库区设置主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteWmStorageLocationByLocationId(Long locationId)
|
||||||
|
{
|
||||||
|
return wmStorageLocationMapper.deleteWmStorageLocationByLocationId(locationId);
|
||||||
|
}
|
||||||
|
}
|
122
ktg-mes/src/main/resources/mapper/wm/WmStorageLocationMapper.xml
Normal file
122
ktg-mes/src/main/resources/mapper/wm/WmStorageLocationMapper.xml
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
<?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="com.ktg.mes.wm.mapper.WmStorageLocationMapper">
|
||||||
|
|
||||||
|
<resultMap type="WmStorageLocation" id="WmStorageLocationResult">
|
||||||
|
<result property="locationId" column="location_id" />
|
||||||
|
<result property="locationCode" column="location_code" />
|
||||||
|
<result property="locationName" column="location_name" />
|
||||||
|
<result property="warehouseId" column="warehouse_id" />
|
||||||
|
<result property="area" column="area" />
|
||||||
|
<result property="areaFlag" column="area_flag" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="attr1" column="attr1" />
|
||||||
|
<result property="attr2" column="attr2" />
|
||||||
|
<result property="attr3" column="attr3" />
|
||||||
|
<result property="attr4" column="attr4" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectWmStorageLocationVo">
|
||||||
|
select location_id, location_code, location_name, warehouse_id, area, area_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_storage_location
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectWmStorageLocationList" parameterType="WmStorageLocation" resultMap="WmStorageLocationResult">
|
||||||
|
<include refid="selectWmStorageLocationVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="locationCode != null and locationCode != ''"> and location_code = #{locationCode}</if>
|
||||||
|
<if test="locationName != null and locationName != ''"> and location_name like concat('%', #{locationName}, '%')</if>
|
||||||
|
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
|
||||||
|
<if test="area != null "> and area = #{area}</if>
|
||||||
|
<if test="areaFlag != null and areaFlag != ''"> and area_flag = #{areaFlag}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectWmStorageLocationByLocationId" parameterType="Long" resultMap="WmStorageLocationResult">
|
||||||
|
<include refid="selectWmStorageLocationVo"/>
|
||||||
|
where location_id = #{locationId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkLocationCodeUnique" parameterType="WmStorageLocation" resultMap="WmStorageLocationResult">
|
||||||
|
<include refid="selectWmStorageLocationVo"/>
|
||||||
|
where location_code = #{locationCode} and warehouse_id = #{warehouseId} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkLocationNameUnique" parameterType="WmStorageLocation" resultMap="WmStorageLocationResult">
|
||||||
|
<include refid="selectWmStorageLocationVo"/>
|
||||||
|
where location_name = #{locationName} and warehouse_id = #{warehouseId} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertWmStorageLocation" parameterType="WmStorageLocation" useGeneratedKeys="true" keyProperty="locationId">
|
||||||
|
insert into wm_storage_location
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="locationCode != null and locationCode != ''">location_code,</if>
|
||||||
|
<if test="locationName != null and locationName != ''">location_name,</if>
|
||||||
|
<if test="warehouseId != null">warehouse_id,</if>
|
||||||
|
<if test="area != null">area,</if>
|
||||||
|
<if test="areaFlag != null">area_flag,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="attr1 != null">attr1,</if>
|
||||||
|
<if test="attr2 != null">attr2,</if>
|
||||||
|
<if test="attr3 != null">attr3,</if>
|
||||||
|
<if test="attr4 != null">attr4,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="locationCode != null and locationCode != ''">#{locationCode},</if>
|
||||||
|
<if test="locationName != null and locationName != ''">#{locationName},</if>
|
||||||
|
<if test="warehouseId != null">#{warehouseId},</if>
|
||||||
|
<if test="area != null">#{area},</if>
|
||||||
|
<if test="areaFlag != null">#{areaFlag},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="attr1 != null">#{attr1},</if>
|
||||||
|
<if test="attr2 != null">#{attr2},</if>
|
||||||
|
<if test="attr3 != null">#{attr3},</if>
|
||||||
|
<if test="attr4 != null">#{attr4},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateWmStorageLocation" parameterType="WmStorageLocation">
|
||||||
|
update wm_storage_location
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="locationCode != null and locationCode != ''">location_code = #{locationCode},</if>
|
||||||
|
<if test="locationName != null and locationName != ''">location_name = #{locationName},</if>
|
||||||
|
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
|
||||||
|
<if test="area != null">area = #{area},</if>
|
||||||
|
<if test="areaFlag != null">area_flag = #{areaFlag},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="attr1 != null">attr1 = #{attr1},</if>
|
||||||
|
<if test="attr2 != null">attr2 = #{attr2},</if>
|
||||||
|
<if test="attr3 != null">attr3 = #{attr3},</if>
|
||||||
|
<if test="attr4 != null">attr4 = #{attr4},</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 location_id = #{locationId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteWmStorageLocationByLocationId" parameterType="Long">
|
||||||
|
delete from wm_storage_location where location_id = #{locationId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteWmStorageLocationByLocationIds" parameterType="String">
|
||||||
|
delete from wm_storage_location where location_id in
|
||||||
|
<foreach item="locationId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{locationId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue
Block a user