添加物料名称输入建议

This commit is contained in:
陆一凡 2025-03-21 09:56:38 +08:00
parent 4323d59f42
commit 2f9a65ed5c
10 changed files with 42 additions and 36 deletions

View File

@ -1,24 +0,0 @@
package com.wms.bussiness;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 任务定时器
*/
@Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class TaskTimer {
}

View File

@ -53,7 +53,7 @@ public class ExcelController extends BaseController {
List<Goods> files = ExcelUtils.readMultipartFile(file, Goods.class); List<Goods> files = ExcelUtils.readMultipartFile(file, Goods.class);
// 添加进物料表 // 添加进物料表
for (Goods goods : files) { for (Goods goods : files) {
if (goodsService.selGoodsByGoodsId(goods.getGoodsId()) != null) { if (goodsService.selGoodsByGoodsName(goods.getGoodsName()) != null) {
goodsService.modifyGoods(goods); goodsService.modifyGoods(goods);
}else { }else {
goodsService.addGoods(goods); goodsService.addGoods(goods);

View File

@ -3,7 +3,10 @@ package com.wms.controller;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.wms.common.BaseResponse;
import com.wms.common.ResultUtils;
import com.wms.constants.enums.ResponseCode; import com.wms.constants.enums.ResponseCode;
import com.wms.exception.ErrorCode;
import com.wms.model.entity.app.ResponseEntity; import com.wms.model.entity.app.ResponseEntity;
import com.wms.model.entity.page.PageDomain; import com.wms.model.entity.page.PageDomain;
import com.wms.model.entity.page.TableRequest; import com.wms.model.entity.page.TableRequest;
@ -78,6 +81,28 @@ public class GoodsController extends BaseController{
return JSON.toJSONString(tblResp); return JSON.toJSONString(tblResp);
} }
/**
* 查找所有零件信息
*/
@PostMapping("/getPartInfoList")
@ResponseBody
public BaseResponse getPartInfoList(@RequestBody Goods goods){
logger.info("请求的ip地址{}", HttpUtils.getIpAddr(servletRequest));
logger.info("接收到查询物料数据请求:{}", JSON.toJSONString(goods));
if (StringUtils.isEmpty(goods.getGoodsName())){
logger.info("请求参数错误");
return ResultUtils.error(ErrorCode.PARAMS_ERROR);
}
List<Goods> goodsList = goodsService.selGoods(goods);
if (goodsList.isEmpty()) {
return ResultUtils.error(999, "未查询到物料信息");
}
return ResultUtils.success(goodsList);
}
/** /**
* 更新零件信息 * 更新零件信息
* *

View File

@ -20,7 +20,7 @@ public interface GoodsMapper {
* @param goodsId * @param goodsId
* @return * @return
*/ */
Goods selGoodsByGoodsId(String goodsId); Goods selGoodsByGoodsName(String goodsId);
/** /**
* 添加物料信息 * 添加物料信息

View File

@ -18,10 +18,11 @@ public class Goods extends BaseEntity implements Serializable {
/** /**
* 物料编号 * 物料编号
*/ */
@ExcelImport("模具号")
@ExcelExport("模具号")
private String goodsId; private String goodsId;
@ExcelImport("模具号")
@ExcelExport("模具号")
private String goodsName;
/** /**

View File

@ -18,7 +18,7 @@ public interface GoodsService {
* @param goodsId 物料id * @param goodsId 物料id
* @return 结果 * @return 结果
*/ */
Goods selGoodsByGoodsId(String goodsId); Goods selGoodsByGoodsName(String goodsId);
/** /**
* 添加物料信息 * 添加物料信息

View File

@ -24,8 +24,8 @@ public class GoodsServiceImplements implements GoodsService {
} }
@Override @Override
public Goods selGoodsByGoodsId(String goodsId) { public Goods selGoodsByGoodsName(String goodsId) {
return this.goodsMapper.selGoodsByGoodsId(goodsId); return this.goodsMapper.selGoodsByGoodsName(goodsId);
} }
@Override @Override

View File

@ -1,5 +1,5 @@
spring: spring:
# 本地测试环境 # # 本地测试环境
datasource: datasource:
url: jdbc:mysql://localhost:3306/test?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true url: jdbc:mysql://localhost:3306/test?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
username: root username: root

View File

@ -120,5 +120,5 @@
</logger> </logger>
</springProfile> </springProfile>
<!-- 打印SQL --> <!-- 打印SQL -->
<!-- <logger level="DEBUG" name="com.wms.mapper"/>--> <logger level="DEBUG" name="com.wms.mapper"/>
</configuration> </configuration>

View File

@ -4,6 +4,7 @@
<mapper namespace="com.wms.mapper.GoodsMapper"> <mapper namespace="com.wms.mapper.GoodsMapper">
<resultMap type="Goods" id="GoodsMap"> <resultMap type="Goods" id="GoodsMap">
<result property="goodsId" column="goods_id"/> <result property="goodsId" column="goods_id"/>
<result property="goodsName" column="goods_name"/>
<result property="goodsUnit" column="goods_unit"/> <result property="goodsUnit" column="goods_unit"/>
<result property="lifeDays" column="life_days"/> <result property="lifeDays" column="life_days"/>
<result property="remark" column="remark"/> <result property="remark" column="remark"/>
@ -13,7 +14,7 @@
</resultMap> </resultMap>
<sql id="selectAll"> <sql id="selectAll">
select goods_id, goods_unit, life_days, remark, single_weight,create_time, update_time select goods_id,goods_name, goods_unit, life_days, remark, single_weight,create_time, update_time
from tbl_app_goods from tbl_app_goods
</sql> </sql>
@ -21,6 +22,7 @@
<include refid="selectAll"/> <include refid="selectAll"/>
<where> <where>
<if test="goodsId != null and goodsId != ''"> and goods_id = #{goodsId}</if> <if test="goodsId != null and goodsId != ''"> and goods_id = #{goodsId}</if>
<if test="goodsName!= null and goodsName != ''"> and goods_name like concat('%',#{goodsName},'%')</if>
<if test="goodsUnit != null and goodsUnit != ''"> and goods_unit = #{goodsUnit}</if> <if test="goodsUnit != null and goodsUnit != ''"> and goods_unit = #{goodsUnit}</if>
<if test="lifeDays != null"> and life_days = #{lifeDays}</if> <if test="lifeDays != null"> and life_days = #{lifeDays}</if>
<if test="remark != null"> and remark = #{remark}</if> <if test="remark != null"> and remark = #{remark}</if>
@ -31,15 +33,16 @@
order by create_time desc order by create_time desc
</select> </select>
<select id="selGoodsByGoodsId" parameterType="String" resultMap="GoodsMap"> <select id="selGoodsByGoodsName" parameterType="String" resultMap="GoodsMap">
<include refid="selectAll"/> <include refid="selectAll"/>
where goods_id = #{goodsId}; where goods_name = #{goodsName};
</select> </select>
<insert id="addGoods" parameterType="Goods"> <insert id="addGoods" parameterType="Goods">
insert into tbl_app_goods insert into tbl_app_goods
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="goodsId != null">goods_id,</if> <if test="goodsId != null">goods_id,</if>
<if test="goodsName != null">goods_name,</if>
<if test="goodsUnit != null">goods_unit,</if> <if test="goodsUnit != null">goods_unit,</if>
<if test="lifeDays != null">life_days,</if> <if test="lifeDays != null">life_days,</if>
<if test="remark != null"> remark</if> <if test="remark != null"> remark</if>
@ -47,6 +50,7 @@
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="goodsId != null">#{goodsId},</if> <if test="goodsId != null">#{goodsId},</if>
<if test="goodsName != null">#{goodsName},</if>
<if test="goodsUnit != null">#{goodsUnit},</if> <if test="goodsUnit != null">#{goodsUnit},</if>
<if test="lifeDays != null">#{lifeDays},</if> <if test="lifeDays != null">#{lifeDays},</if>
<if test="remark != null"> #{remark}</if> <if test="remark != null"> #{remark}</if>