skyouc
2025-03-21 53411e80007ce3a1cc268141a4cf7495fa6d265a
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/LocController.java
@@ -22,6 +22,7 @@
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
@@ -76,8 +77,7 @@
        if (Objects.isNull(loc.getTypeIds())) {
            throw new CoolException("库位类型不能为空!!");
        }
        List<Long> lists = JSONArray.parseArray(loc.getTypeIds(), Long.class);
        String join = StringUtils.join(lists, ",");
        String join = StringUtils.join(loc.getTypeIds(), ",");
        loc.setType(join);
        loc.setCreateBy(getLoginUserId());
@@ -87,7 +87,7 @@
        }
        if (!locService.saveType(loc)) {
            throw new CoolException("库位类型保存失败!!");
            throw new CoolException("库位类型关联关系保存失败!!");
        }
        return R.ok("Save Success").add(loc);
    }
@@ -95,12 +95,20 @@
    @PreAuthorize("hasAuthority('manager:loc:update')")
    @OperationLog("Update 库位信息表")
    @PostMapping("/loc/update")
    @Transactional(rollbackFor = Exception.class)
    public R update(@RequestBody Loc loc) {
        loc.setUpdateBy(getLoginUserId());
        loc.setUpdateTime(new Date());
        String join = StringUtils.join(loc.getTypeIds(), ",");
        loc.setType(join);
        if (!locService.updateById(loc)) {
            return R.error("Update Fail");
        }
        if (!locService.updateLoc(loc)) {
            throw new CoolException("库位类型关联关系修改失败!@!");
        }
        return R.ok("Update Success").add(loc);
    }