|
@ -1,32 +1,33 @@ |
|
|
package com.win.module.wms.controller.admin.itembasic; |
|
|
package com.win.module.wms.controller.admin.itembasic; |
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import javax.annotation.Resource; |
|
|
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter; |
|
|
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
|
|
|
|
|
|
|
|
import javax.validation.constraints.*; |
|
|
|
|
|
import javax.validation.*; |
|
|
|
|
|
import javax.servlet.http.*; |
|
|
|
|
|
import java.util.*; |
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
|
|
|
|
import com.win.framework.common.pojo.PageResult; |
|
|
|
|
|
import com.win.framework.common.pojo.CommonResult; |
|
|
import com.win.framework.common.pojo.CommonResult; |
|
|
import static com.win.framework.common.pojo.CommonResult.success; |
|
|
import com.win.framework.common.pojo.PageResult; |
|
|
|
|
|
|
|
|
import com.win.framework.excel.core.util.ExcelUtils; |
|
|
import com.win.framework.excel.core.util.ExcelUtils; |
|
|
|
|
|
|
|
|
import com.win.framework.operatelog.core.annotations.OperateLog; |
|
|
import com.win.framework.operatelog.core.annotations.OperateLog; |
|
|
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.*; |
|
|
|
|
|
|
|
|
|
|
|
import com.win.module.wms.controller.admin.itembasic.vo.*; |
|
|
import com.win.module.wms.controller.admin.itembasic.vo.*; |
|
|
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO; |
|
|
|
|
|
import com.win.module.wms.convert.itembasic.ItembasicConvert; |
|
|
import com.win.module.wms.convert.itembasic.ItembasicConvert; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO; |
|
|
|
|
|
import com.win.module.wms.dal.mysql.itembasic.ItembasicMapper; |
|
|
import com.win.module.wms.service.itembasic.ItembasicService; |
|
|
import com.win.module.wms.service.itembasic.ItembasicService; |
|
|
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter; |
|
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
import javax.validation.Valid; |
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
import java.util.Collection; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; |
|
|
|
|
|
import static com.win.framework.common.pojo.CommonResult.success; |
|
|
|
|
|
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
|
|
|
|
|
import static com.win.module.wms.enums.itembasic.ErrorCodeConstants.CODE_NOT_ONLY; |
|
|
|
|
|
|
|
|
@Tag(name = "管理后台 - 物品基本信息") |
|
|
@Tag(name = "管理后台 - 物品基本信息") |
|
|
@RestController |
|
|
@RestController |
|
@ -37,10 +38,14 @@ public class ItembasicController { |
|
|
@Resource |
|
|
@Resource |
|
|
private ItembasicService itembasicService; |
|
|
private ItembasicService itembasicService; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private ItembasicMapper itembasicMapper; |
|
|
|
|
|
|
|
|
@PostMapping("/create") |
|
|
@PostMapping("/create") |
|
|
@Operation(summary = "创建物品基本信息") |
|
|
@Operation(summary = "创建物品基本信息") |
|
|
@PreAuthorize("@ss.hasPermission('wms:itembasic:create')") |
|
|
@PreAuthorize("@ss.hasPermission('wms:itembasic:create')") |
|
|
public CommonResult<Long> createItembasic(@Valid @RequestBody ItembasicCreateReqVO createReqVO) { |
|
|
public CommonResult<Long> createItembasic(@Valid @RequestBody ItembasicCreateReqVO createReqVO) { |
|
|
|
|
|
checkCoodOnly(createReqVO); |
|
|
return success(itembasicService.createItembasic(createReqVO)); |
|
|
return success(itembasicService.createItembasic(createReqVO)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -48,10 +53,24 @@ public class ItembasicController { |
|
|
@Operation(summary = "更新物品基本信息") |
|
|
@Operation(summary = "更新物品基本信息") |
|
|
@PreAuthorize("@ss.hasPermission('wms:itembasic:update')") |
|
|
@PreAuthorize("@ss.hasPermission('wms:itembasic:update')") |
|
|
public CommonResult<Boolean> updateItembasic(@Valid @RequestBody ItembasicUpdateReqVO updateReqVO) { |
|
|
public CommonResult<Boolean> updateItembasic(@Valid @RequestBody ItembasicUpdateReqVO updateReqVO) { |
|
|
|
|
|
checkCoodOnly(updateReqVO); |
|
|
itembasicService.updateItembasic(updateReqVO); |
|
|
itembasicService.updateItembasic(updateReqVO); |
|
|
return success(true); |
|
|
return success(true); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "校验code唯一") |
|
|
|
|
|
public void checkCoodOnly(ItembasicBaseVO vo){ |
|
|
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
|
|
queryWrapper.eq("code",vo.getCode()); |
|
|
|
|
|
queryWrapper.eq("deleted",0); |
|
|
|
|
|
if(!(null == itembasicMapper.selectOne(queryWrapper))){ |
|
|
|
|
|
ItembasicDO itembasicDO = itembasicMapper.selectOne(queryWrapper); |
|
|
|
|
|
if(itembasicDO.getCode().equals(vo.getCode()) && !itembasicDO.getId().equals(vo.getId())){ |
|
|
|
|
|
throw exception(CODE_NOT_ONLY); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@DeleteMapping("/delete") |
|
|
@DeleteMapping("/delete") |
|
|
@Operation(summary = "删除物品基本信息") |
|
|
@Operation(summary = "删除物品基本信息") |
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|