diff --git a/src/main/java/com/glxp/api/controller/auth/InvWarehouseController.java b/src/main/java/com/glxp/api/controller/auth/InvWarehouseController.java index 7ef6d4bf..07e43044 100644 --- a/src/main/java/com/glxp/api/controller/auth/InvWarehouseController.java +++ b/src/main/java/com/glxp/api/controller/auth/InvWarehouseController.java @@ -1,5 +1,6 @@ package com.glxp.api.controller.auth; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import com.github.pagehelper.PageInfo; @@ -10,7 +11,9 @@ import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.entity.auth.AuthAdmin; import com.glxp.api.entity.auth.DeptEntity; import com.glxp.api.entity.auth.InvWarehouseEntity; +import com.glxp.api.entity.auth.WarehouseUserEntity; import com.glxp.api.entity.system.SystemParamConfigEntity; +import com.glxp.api.req.auth.FilterInvLinkDataRequest; import com.glxp.api.req.auth.FilterInvSubWarehouseRequest; import com.glxp.api.req.auth.FilterInvWarehouseRequest; import com.glxp.api.req.system.DeleteRequest; @@ -18,11 +21,13 @@ import com.glxp.api.req.system.FilterBasicThirdSysRequest; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.auth.InvSubWarehouseResponse; import com.glxp.api.res.auth.InvWarehouseThirdSysResponse; +import com.glxp.api.res.auth.WarehouseUserResponse; import com.glxp.api.service.auth.CustomerService; import com.glxp.api.service.auth.DeptService; import com.glxp.api.service.auth.InvWarehouseService; import com.glxp.api.service.auth.WarehouseUserService; import com.glxp.api.service.system.SystemParamConfigService; +import org.springframework.beans.BeanUtils; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -31,6 +36,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.validation.Valid; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -45,8 +51,6 @@ public class InvWarehouseController { CustomerService customerService; @Resource private WarehouseUserService warehouseUserService; - // @Resource -// private InvSpaceService invSpaceService; @Resource private SystemParamConfigService systemParamConfigService; @@ -294,4 +298,32 @@ public class InvWarehouseController { return ResultVOUtils.success(responses); } + + /** + * 根据仓位码获取关联用户数据 + */ + @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/warehouseUserList") + public BaseResponse getWarehouseUserList(@RequestBody @Valid FilterInvLinkDataRequest filterInvLinkDataRequest, BindingResult bindingResult) { + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + List warehouseUserEntities = warehouseUserService.getWarehouseUserList(filterInvLinkDataRequest); + PageInfo pageInfo = new PageInfo<>(warehouseUserEntities); + + List result = new ArrayList<>(); + if (CollUtil.isNotEmpty(pageInfo.getList())) { + pageInfo.getList().forEach(warehouseUserEntity -> { + WarehouseUserResponse warehouseUserResponse = new WarehouseUserResponse(); + BeanUtils.copyProperties(warehouseUserEntity, warehouseUserResponse); + warehouseUserResponse.setUserid(warehouseUserEntity.getUserid() + ""); + result.add(warehouseUserResponse); + }); + } + PageSimpleResponse response = new PageSimpleResponse<>(); + response.setList(result); + response.setTotal(pageInfo.getTotal()); + return ResultVOUtils.success(response); + } + } diff --git a/src/main/java/com/glxp/api/dao/auth/WarehouseUserDao.java b/src/main/java/com/glxp/api/dao/auth/WarehouseUserDao.java index 8f0d7f55..a397c59a 100644 --- a/src/main/java/com/glxp/api/dao/auth/WarehouseUserDao.java +++ b/src/main/java/com/glxp/api/dao/auth/WarehouseUserDao.java @@ -2,10 +2,12 @@ package com.glxp.api.dao.auth; import com.glxp.api.entity.auth.WarehouseUserEntity; import com.glxp.api.req.auth.FilterInvUserRequest; +import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; +@Mapper public interface WarehouseUserDao { int deleteByPrimaryKey(Integer id); diff --git a/src/main/java/com/glxp/api/res/auth/WarehouseUserResponse.java b/src/main/java/com/glxp/api/res/auth/WarehouseUserResponse.java new file mode 100644 index 00000000..630274a4 --- /dev/null +++ b/src/main/java/com/glxp/api/res/auth/WarehouseUserResponse.java @@ -0,0 +1,34 @@ +package com.glxp.api.res.auth; + +import lombok.Data; + +@Data +public class WarehouseUserResponse { + + /** + * id + */ + private Integer id; + + /** + * 仓位码 + */ + private String code; + + /** + * 用户id + */ + private String userid; + + /** + * 用户名/登录账号 + */ + private String username; + + /** + * 是否是仓库主管 + */ + private boolean isDirector; + + private String employeeName; +} diff --git a/src/main/resources/mybatis/mapper/auth/WarehouseUserDao.xml b/src/main/resources/mybatis/mapper/auth/WarehouseUserDao.xml index 8ef82bbe..80d94393 100644 --- a/src/main/resources/mybatis/mapper/auth/WarehouseUserDao.xml +++ b/src/main/resources/mybatis/mapper/auth/WarehouseUserDao.xml @@ -1,6 +1,6 @@ - +