diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppGoodsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppGoodsController.java index f07a57d2..28b1e001 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppGoodsController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppGoodsController.java @@ -7,19 +7,13 @@ import com.ruoyi.app.domain.AppGoods; import com.ruoyi.app.domain.AppLocation; import com.ruoyi.app.domain.AppStock; import com.ruoyi.app.service.IAppGoodsService; +import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.web.controller.section.EnhanceDataList; import org.apache.commons.lang3.ObjectUtils; 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 org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -152,4 +146,14 @@ public class AppGoodsController extends BaseController { List appGoodsList = appGoodsService.queryListByGoodsId(appGoods.getGoodsId()); return success("查询成功",appGoodsList); } + + @Anonymous + @GetMapping("/getGoodsInfoByCode") + public AjaxResult getGoodsInfoByCode(@RequestParam("goodsCode") String goodsCode) { + if(StringUtils.isBlank(goodsCode)){ + return error("查询物料条码不能为空"); + } + AppGoods appGoods = appGoodsService.getGoodsInfoByCode(goodsCode); + return success("查询成功", appGoods); + } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index 0e4f6067..828b6bf9 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -114,7 +114,7 @@ public class SecurityConfig requests.antMatchers("/login", "/register", "/captchaImage").permitAll() // 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() - .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**","/app/pms/orderIn", "/app/pmsOrderOut/**", "/app/task/sendLocation", "/app/task/taskResult","/app/task/createOutRequest", "/system/storage/**", "/app/location/count", "/app/vehicle/**").permitAll() + .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**","/app/pms/orderIn", "/app/pmsOrderOut/**", "/app/task/sendLocation", "/app/task/taskResult","/app/task/createOutRequest", "/system/storage/**", "/app/location/count/**", "/app/vehicle/**", "/app/goods/getGoodsInfoByCode/**").permitAll() // 除上面外的所有请求全部需要鉴权认证 .anyRequest().authenticated(); }) diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppGoodsMapper.java b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppGoodsMapper.java index c95bdc3f..9ee2de43 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppGoodsMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppGoodsMapper.java @@ -78,4 +78,6 @@ public interface AppGoodsMapper List selectAppGoodsListByIds(String[] goodsIds); List queryListByGoodsId(String goodsId); + + public AppGoods selectAppGoodsByCode(String goodsCode); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppGoodsService.java b/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppGoodsService.java index fbec37a7..31b9ddc4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppGoodsService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppGoodsService.java @@ -83,4 +83,6 @@ public interface IAppGoodsService String importGoods(List appGoodsList, boolean updateSupport); List queryListByGoodsId(String goodsId); + + public AppGoods getGoodsInfoByCode(String goodsCode); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppGoodsServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppGoodsServiceImpl.java index ce280404..3ce60898 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppGoodsServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppGoodsServiceImpl.java @@ -165,4 +165,9 @@ public class AppGoodsServiceImpl implements IAppGoodsService { public List queryListByGoodsId(String goodsId) { return appGoodsMapper.queryListByGoodsId(goodsId); } + + @Override + public AppGoods getGoodsInfoByCode(String goodsCode) { + return appGoodsMapper.selectAppGoodsByCode(goodsCode); + } } diff --git a/ruoyi-system/src/main/resources/mapper/app/AppGoodsMapper.xml b/ruoyi-system/src/main/resources/mapper/app/AppGoodsMapper.xml index 3b50198a..95fae0b9 100644 --- a/ruoyi-system/src/main/resources/mapper/app/AppGoodsMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/app/AppGoodsMapper.xml @@ -129,4 +129,9 @@ #{id} + +