库位设置

This commit is contained in:
JinLu.Yin 2022-05-08 18:51:25 +08:00
parent 056e4ddf46
commit d743bd649c
6 changed files with 675 additions and 0 deletions

View File

@ -0,0 +1,104 @@
package com.ktg.mes.wm.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.WmStorageArea;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
/**
* 库位设置Controller
*
* @author yinjinlu
* @date 2022-05-08
*/
@RestController
@RequestMapping("/mes/wm/area")
public class WmStorageAreaController extends BaseController
{
@Autowired
private IWmStorageAreaService wmStorageAreaService;
/**
* 查询库位设置列表
*/
@PreAuthorize("@ss.hasPermi('mes:wm:area:list')")
@GetMapping("/list")
public TableDataInfo list(WmStorageArea wmStorageArea)
{
startPage();
List<WmStorageArea> list = wmStorageAreaService.selectWmStorageAreaList(wmStorageArea);
return getDataTable(list);
}
/**
* 导出库位设置列表
*/
@PreAuthorize("@ss.hasPermi('mes:wm:area:export')")
@Log(title = "库位设置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WmStorageArea wmStorageArea)
{
List<WmStorageArea> list = wmStorageAreaService.selectWmStorageAreaList(wmStorageArea);
ExcelUtil<WmStorageArea> util = new ExcelUtil<WmStorageArea>(WmStorageArea.class);
util.exportExcel(response, list, "库位设置数据");
}
/**
* 获取库位设置详细信息
*/
@PreAuthorize("@ss.hasPermi('mes:wm:area:query')")
@GetMapping(value = "/{areaId}")
public AjaxResult getInfo(@PathVariable("areaId") Long areaId)
{
return AjaxResult.success(wmStorageAreaService.selectWmStorageAreaByAreaId(areaId));
}
/**
* 新增库位设置
*/
@PreAuthorize("@ss.hasPermi('mes:wm:area:add')")
@Log(title = "库位设置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WmStorageArea wmStorageArea)
{
return toAjax(wmStorageAreaService.insertWmStorageArea(wmStorageArea));
}
/**
* 修改库位设置
*/
@PreAuthorize("@ss.hasPermi('mes:wm:area:edit')")
@Log(title = "库位设置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WmStorageArea wmStorageArea)
{
return toAjax(wmStorageAreaService.updateWmStorageArea(wmStorageArea));
}
/**
* 删除库位设置
*/
@PreAuthorize("@ss.hasPermi('mes:wm:area:remove')")
@Log(title = "库位设置", businessType = BusinessType.DELETE)
@DeleteMapping("/{areaIds}")
public AjaxResult remove(@PathVariable Long[] areaIds)
{
return toAjax(wmStorageAreaService.deleteWmStorageAreaByAreaIds(areaIds));
}
}

View File

@ -0,0 +1,221 @@
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_area
*
* @author yinjinlu
* @date 2022-05-08
*/
public class WmStorageArea extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 库位ID */
private Long areaId;
/** 库位编码 */
@Excel(name = "库位编码")
private String areaCode;
/** 库位名称 */
@Excel(name = "库位名称")
private String areaName;
/** 库区ID */
@Excel(name = "库区ID")
private Long locationId;
/** 面积 */
@Excel(name = "面积")
private BigDecimal area;
/** 最大载重量 */
@Excel(name = "最大载重量")
private BigDecimal maxLoa;
/** 库位位置X */
@Excel(name = "库位位置X")
private Long positionX;
/** 库位位置y */
@Excel(name = "库位位置y")
private Long positionY;
/** 库位位置z */
@Excel(name = "库位位置z")
private Long positionZ;
/** 是否启用 */
@Excel(name = "是否启用")
private String enableFlag;
/** 预留字段1 */
private String attr1;
/** 预留字段2 */
private String attr2;
/** 预留字段3 */
private Long attr3;
/** 预留字段4 */
private Long attr4;
public void setAreaId(Long areaId)
{
this.areaId = areaId;
}
public Long getAreaId()
{
return areaId;
}
public void setAreaCode(String areaCode)
{
this.areaCode = areaCode;
}
public String getAreaCode()
{
return areaCode;
}
public void setAreaName(String areaName)
{
this.areaName = areaName;
}
public String getAreaName()
{
return areaName;
}
public void setLocationId(Long locationId)
{
this.locationId = locationId;
}
public Long getLocationId()
{
return locationId;
}
public void setArea(BigDecimal area)
{
this.area = area;
}
public BigDecimal getArea()
{
return area;
}
public void setMaxLoa(BigDecimal maxLoa)
{
this.maxLoa = maxLoa;
}
public BigDecimal getMaxLoa()
{
return maxLoa;
}
public void setPositionX(Long positionX)
{
this.positionX = positionX;
}
public Long getPositionX()
{
return positionX;
}
public void setPositionY(Long positionY)
{
this.positionY = positionY;
}
public Long getPositionY()
{
return positionY;
}
public void setPositionZ(Long positionZ)
{
this.positionZ = positionZ;
}
public Long getPositionZ()
{
return positionZ;
}
public void setEnableFlag(String enableFlag)
{
this.enableFlag = enableFlag;
}
public String getEnableFlag()
{
return enableFlag;
}
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("areaId", getAreaId())
.append("areaCode", getAreaCode())
.append("areaName", getAreaName())
.append("locationId", getLocationId())
.append("area", getArea())
.append("maxLoa", getMaxLoa())
.append("positionX", getPositionX())
.append("positionY", getPositionY())
.append("positionZ", getPositionZ())
.append("enableFlag", getEnableFlag())
.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();
}
}

View File

@ -0,0 +1,61 @@
package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmStorageArea;
/**
* 库位设置Mapper接口
*
* @author yinjinlu
* @date 2022-05-08
*/
public interface WmStorageAreaMapper
{
/**
* 查询库位设置
*
* @param areaId 库位设置主键
* @return 库位设置
*/
public WmStorageArea selectWmStorageAreaByAreaId(Long areaId);
/**
* 查询库位设置列表
*
* @param wmStorageArea 库位设置
* @return 库位设置集合
*/
public List<WmStorageArea> selectWmStorageAreaList(WmStorageArea wmStorageArea);
/**
* 新增库位设置
*
* @param wmStorageArea 库位设置
* @return 结果
*/
public int insertWmStorageArea(WmStorageArea wmStorageArea);
/**
* 修改库位设置
*
* @param wmStorageArea 库位设置
* @return 结果
*/
public int updateWmStorageArea(WmStorageArea wmStorageArea);
/**
* 删除库位设置
*
* @param areaId 库位设置主键
* @return 结果
*/
public int deleteWmStorageAreaByAreaId(Long areaId);
/**
* 批量删除库位设置
*
* @param areaIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteWmStorageAreaByAreaIds(Long[] areaIds);
}

View File

@ -0,0 +1,61 @@
package com.ktg.mes.wm.service;
import java.util.List;
import com.ktg.mes.wm.domain.WmStorageArea;
/**
* 库位设置Service接口
*
* @author yinjinlu
* @date 2022-05-08
*/
public interface IWmStorageAreaService
{
/**
* 查询库位设置
*
* @param areaId 库位设置主键
* @return 库位设置
*/
public WmStorageArea selectWmStorageAreaByAreaId(Long areaId);
/**
* 查询库位设置列表
*
* @param wmStorageArea 库位设置
* @return 库位设置集合
*/
public List<WmStorageArea> selectWmStorageAreaList(WmStorageArea wmStorageArea);
/**
* 新增库位设置
*
* @param wmStorageArea 库位设置
* @return 结果
*/
public int insertWmStorageArea(WmStorageArea wmStorageArea);
/**
* 修改库位设置
*
* @param wmStorageArea 库位设置
* @return 结果
*/
public int updateWmStorageArea(WmStorageArea wmStorageArea);
/**
* 批量删除库位设置
*
* @param areaIds 需要删除的库位设置主键集合
* @return 结果
*/
public int deleteWmStorageAreaByAreaIds(Long[] areaIds);
/**
* 删除库位设置信息
*
* @param areaId 库位设置主键
* @return 结果
*/
public int deleteWmStorageAreaByAreaId(Long areaId);
}

View File

@ -0,0 +1,96 @@
package com.ktg.mes.wm.service.impl;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.service.IWmStorageAreaService;
/**
* 库位设置Service业务层处理
*
* @author yinjinlu
* @date 2022-05-08
*/
@Service
public class WmStorageAreaServiceImpl implements IWmStorageAreaService
{
@Autowired
private WmStorageAreaMapper wmStorageAreaMapper;
/**
* 查询库位设置
*
* @param areaId 库位设置主键
* @return 库位设置
*/
@Override
public WmStorageArea selectWmStorageAreaByAreaId(Long areaId)
{
return wmStorageAreaMapper.selectWmStorageAreaByAreaId(areaId);
}
/**
* 查询库位设置列表
*
* @param wmStorageArea 库位设置
* @return 库位设置
*/
@Override
public List<WmStorageArea> selectWmStorageAreaList(WmStorageArea wmStorageArea)
{
return wmStorageAreaMapper.selectWmStorageAreaList(wmStorageArea);
}
/**
* 新增库位设置
*
* @param wmStorageArea 库位设置
* @return 结果
*/
@Override
public int insertWmStorageArea(WmStorageArea wmStorageArea)
{
wmStorageArea.setCreateTime(DateUtils.getNowDate());
return wmStorageAreaMapper.insertWmStorageArea(wmStorageArea);
}
/**
* 修改库位设置
*
* @param wmStorageArea 库位设置
* @return 结果
*/
@Override
public int updateWmStorageArea(WmStorageArea wmStorageArea)
{
wmStorageArea.setUpdateTime(DateUtils.getNowDate());
return wmStorageAreaMapper.updateWmStorageArea(wmStorageArea);
}
/**
* 批量删除库位设置
*
* @param areaIds 需要删除的库位设置主键
* @return 结果
*/
@Override
public int deleteWmStorageAreaByAreaIds(Long[] areaIds)
{
return wmStorageAreaMapper.deleteWmStorageAreaByAreaIds(areaIds);
}
/**
* 删除库位设置信息
*
* @param areaId 库位设置主键
* @return 结果
*/
@Override
public int deleteWmStorageAreaByAreaId(Long areaId)
{
return wmStorageAreaMapper.deleteWmStorageAreaByAreaId(areaId);
}
}

View File

@ -0,0 +1,132 @@
<?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.WmStorageAreaMapper">
<resultMap type="WmStorageArea" id="WmStorageAreaResult">
<result property="areaId" column="area_id" />
<result property="areaCode" column="area_code" />
<result property="areaName" column="area_name" />
<result property="locationId" column="location_id" />
<result property="area" column="area" />
<result property="maxLoa" column="max_loa" />
<result property="positionX" column="position_x" />
<result property="positionY" column="position_y" />
<result property="positionZ" column="position_z" />
<result property="enableFlag" column="enable_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="selectWmStorageAreaVo">
select area_id, area_code, area_name, location_id, area, max_loa, position_x, position_y, position_z, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_storage_area
</sql>
<select id="selectWmStorageAreaList" parameterType="WmStorageArea" resultMap="WmStorageAreaResult">
<include refid="selectWmStorageAreaVo"/>
<where>
<if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
<if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
<if test="locationId != null "> and location_id = #{locationId}</if>
<if test="area != null "> and area = #{area}</if>
<if test="maxLoa != null "> and max_loa = #{maxLoa}</if>
<if test="positionX != null and positionX !=0 "> and position_x = #{positionX}</if>
<if test="positionY != null and positionY !=0"> and position_y = #{positionY}</if>
<if test="positionZ != null and positionZ !=0"> and position_z = #{positionZ}</if>
<if test="enableFlag != null and enableFlag != ''"> and enable_flag = #{enableFlag}</if>
</where>
</select>
<select id="selectWmStorageAreaByAreaId" parameterType="Long" resultMap="WmStorageAreaResult">
<include refid="selectWmStorageAreaVo"/>
where area_id = #{areaId}
</select>
<insert id="insertWmStorageArea" parameterType="WmStorageArea" useGeneratedKeys="true" keyProperty="areaId">
insert into wm_storage_area
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="areaCode != null and areaCode != ''">area_code,</if>
<if test="areaName != null and areaName != ''">area_name,</if>
<if test="locationId != null">location_id,</if>
<if test="area != null">area,</if>
<if test="maxLoa != null">max_loa,</if>
<if test="positionX != null">position_x,</if>
<if test="positionY != null">position_y,</if>
<if test="positionZ != null">position_z,</if>
<if test="enableFlag != null">enable_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="areaCode != null and areaCode != ''">#{areaCode},</if>
<if test="areaName != null and areaName != ''">#{areaName},</if>
<if test="locationId != null">#{locationId},</if>
<if test="area != null">#{area},</if>
<if test="maxLoa != null">#{maxLoa},</if>
<if test="positionX != null">#{positionX},</if>
<if test="positionY != null">#{positionY},</if>
<if test="positionZ != null">#{positionZ},</if>
<if test="enableFlag != null">#{enableFlag},</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="updateWmStorageArea" parameterType="WmStorageArea">
update wm_storage_area
<trim prefix="SET" suffixOverrides=",">
<if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>
<if test="areaName != null and areaName != ''">area_name = #{areaName},</if>
<if test="locationId != null">location_id = #{locationId},</if>
<if test="area != null">area = #{area},</if>
<if test="maxLoa != null">max_loa = #{maxLoa},</if>
<if test="positionX != null">position_x = #{positionX},</if>
<if test="positionY != null">position_y = #{positionY},</if>
<if test="positionZ != null">position_z = #{positionZ},</if>
<if test="enableFlag != null">enable_flag = #{enableFlag},</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 area_id = #{areaId}
</update>
<delete id="deleteWmStorageAreaByAreaId" parameterType="Long">
delete from wm_storage_area where area_id = #{areaId}
</delete>
<delete id="deleteWmStorageAreaByAreaIds" parameterType="String">
delete from wm_storage_area where area_id in
<foreach item="areaId" collection="array" open="(" separator="," close=")">
#{areaId}
</foreach>
</delete>
</mapper>