yaowanxin
9 天以前 b0c345d2a74f47e5c34617051bcd61becde11b96
业务流程修改
已修改15个文件
已添加6个文件
561 ■■■■ 文件已修改
src/main/java/com/ruoyi/warehouse/controller/DocumentClassificationController.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/controller/DocumentationBorrowManagementController.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/controller/WarehouseController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/mapper/DocumentClassificationMapper.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/mapper/DocumentationBorrowManagementMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/mapper/WarehouseGoodsShelvesMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/pojo/DocumentClassification.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/pojo/Documentation.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/pojo/DocumentationBorrowManagement.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/service/DocumentClassificationService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/service/DocumentationBorrowManagementService.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/service/WarehouseGoodsShelvesService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/service/impl/DocumentClassificationServiceImpl.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/service/impl/DocumentationBorrowManagementServiceImpl.java 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesRowcolServiceImpl.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesServiceImpl.java 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/service/impl/WarehouseServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/warehouse/DocumentClassificationMapper.xml 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/warehouse/DocumentationBorrowManagementMapper.xml 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/warehouse/DocumentationMapper.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/warehouse/WarehouseGoodsShelvesMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/controller/DocumentClassificationController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,49 @@
package com.ruoyi.warehouse.controller;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.warehouse.pojo.DocumentClassification;
import com.ruoyi.warehouse.service.DocumentClassificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@Api(tags = "文档分类")
@RequestMapping("/warehouse/documentClassification")
public class DocumentClassificationController extends BaseController {
    @Autowired
    private DocumentClassificationService documentClassificationService;
    @GetMapping("/getList")
    @ApiOperation("文档分类-查询")
    @Log(title = "文档分类-查询", businessType = BusinessType.OTHER)
    public AjaxResult getList() {
        return AjaxResult.success(documentClassificationService.list());
    }
    @PostMapping("/add")
    @ApiOperation("文档分类-添加")
    @Log(title = "文档分类-添加", businessType = BusinessType.INSERT)
    public AjaxResult add(@RequestBody DocumentClassification documentClassification) {
        return AjaxResult.success(documentClassificationService.save(documentClassification));
    }
    @PostMapping("/update")
    @ApiOperation("文档分类-更新")
    @Log(title = "文档分类-更新", businessType = BusinessType.UPDATE)
    public AjaxResult update(@RequestBody DocumentClassification documentClassification) {
        return AjaxResult.success(documentClassificationService.updateById(documentClassification));
    }
    @DeleteMapping("/delete")
    @ApiOperation("文档分类删除")
    @Log(title = "文档分类删除", businessType = BusinessType.DELETE)
    public AjaxResult delete(@RequestBody List<Long> ids) {
        if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID");
        return AjaxResult.success(documentClassificationService.deleteByIds(ids));
    }
}
src/main/java/com/ruoyi/warehouse/controller/DocumentationBorrowManagementController.java
@@ -1,12 +1,15 @@
package com.ruoyi.warehouse.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.warehouse.mapper.DocumentationBorrowManagementMapper;
import com.ruoyi.warehouse.pojo.DocumentationBorrowManagement;
import com.ruoyi.warehouse.pojo.Warehouse;
import com.ruoyi.warehouse.service.DocumentationBorrowManagementService;
@@ -26,6 +29,8 @@
public class DocumentationBorrowManagementController extends BaseController {
    @Autowired
    private DocumentationBorrowManagementService documentationBorrowManagementService;
    @Autowired
    private DocumentationBorrowManagementMapper documentationBorrowManagementMapper;
    @GetMapping("/listPage")
    @ApiOperation("文档借阅管理-分页查询")
    @Log(title = "文档借阅管理-分页查询", businessType = BusinessType.OTHER)
@@ -37,27 +42,29 @@
    @ApiOperation("文档借阅管理-添加")
    @Log(title = "文档借阅管理-添加", businessType = BusinessType.INSERT)
    public AjaxResult add(@RequestBody DocumentationBorrowManagement documentationBorrowManagement) {
        documentationBorrowManagementService.save(documentationBorrowManagement);
        return AjaxResult.success();
        return AjaxResult.success(documentationBorrowManagementService.add(documentationBorrowManagement));
    }
    @PostMapping("/update")
    @ApiOperation("文档借阅管理-更新")
    @Log(title = "文档借阅管理-更新", businessType = BusinessType.UPDATE)
    public AjaxResult update(@RequestBody DocumentationBorrowManagement documentationBorrowManagement) {
        documentationBorrowManagementService.updateById(documentationBorrowManagement);
        return AjaxResult.success();
//        documentationBorrowManagementService.updateById(documentationBorrowManagement);
        return AjaxResult.success(documentationBorrowManagementService.updateById(documentationBorrowManagement));
    }
    @PostMapping("/delete")
    @ApiOperation("文档借阅管理-删除")
    @Log(title = "文档借阅管理-删除", businessType = BusinessType.DELETE)
    public AjaxResult delete(@RequestBody List<Long> ids) {
        documentationBorrowManagementService.removeByIds(ids);
        return AjaxResult.success();
        if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID");
        return AjaxResult.success(documentationBorrowManagementService.deleteByIds(ids));
    }
    @PostMapping("/export")
    @ApiOperation("文档信息表-导出")
    @Log(title = "文档信息表-导出", businessType = BusinessType.EXPORT)
    public void export(HttpServletResponse response) {
        documentationBorrowManagementService.export(response);
    @ApiOperation("文档借阅管理-导出")
    @Log(title = "文档借阅管理-导出", businessType = BusinessType.EXPORT)
    public void export(HttpServletResponse response,DocumentationBorrowManagement documentationBorrowManagement) {
        String borrowStatus = documentationBorrowManagement.getBorrowStatus();
        List<DocumentationBorrowManagement> documentationBorrowManagements = documentationBorrowManagementMapper.selectList(new LambdaQueryWrapper<DocumentationBorrowManagement>().eq(DocumentationBorrowManagement::getBorrowStatus, borrowStatus));
        ExcelUtil<DocumentationBorrowManagement> util = new ExcelUtil<>(DocumentationBorrowManagement.class);
        util.exportExcel(response, documentationBorrowManagements, "文档借阅-归还记录");
    }
}
src/main/java/com/ruoyi/warehouse/controller/WarehouseController.java
@@ -28,10 +28,10 @@
    @Autowired
    private WarehouseService warehouseService;
    @GetMapping("/listPage")
    @GetMapping("/list")
    @ApiOperation("仓库-查询")
    @Log(title = "仓库-查询", businessType = BusinessType.OTHER)
    public AjaxResult listPage( Warehouse warehouse) {
    public AjaxResult list(@RequestBody Warehouse warehouse) {
        return AjaxResult.success(warehouseService.listPage( warehouse));
    }
    @PostMapping("/add")
src/main/java/com/ruoyi/warehouse/mapper/DocumentClassificationMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package com.ruoyi.warehouse.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.warehouse.pojo.DocumentClassification;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 86151
* @description é’ˆå¯¹è¡¨ã€document_classification(文档分类表)】的数据库操作Mapper
* @createDate 2025-08-15 10:44:23
* @Entity com.ruoyi.warehouse.pojo.DocumentClassification
*/
@Mapper
public interface DocumentClassificationMapper extends BaseMapper<DocumentClassification> {
}
src/main/java/com/ruoyi/warehouse/mapper/DocumentationBorrowManagementMapper.java
@@ -1,8 +1,11 @@
package com.ruoyi.warehouse.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.warehouse.pojo.DocumentationBorrowManagement;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @author 86151
@@ -13,6 +16,7 @@
@Mapper
public interface DocumentationBorrowManagementMapper extends BaseMapper<DocumentationBorrowManagement> {
    IPage<DocumentationBorrowManagement> listPage(Page page,@Param("documentationBorrowManagement") DocumentationBorrowManagement documentationBorrowManagement);
}
src/main/java/com/ruoyi/warehouse/mapper/WarehouseGoodsShelvesMapper.java
@@ -7,6 +7,9 @@
import com.ruoyi.warehouse.pojo.WarehouseGoodsShelves;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
* @description é’ˆå¯¹è¡¨ã€warehouse_goods_shelves(仓库货架表)】的数据库操作Mapper
@@ -16,6 +19,8 @@
@Mapper
public interface WarehouseGoodsShelvesMapper extends BaseMapper<WarehouseGoodsShelves> {
    IPage<WarehouseGoodsShelves> listPage(Page page,@Param("warehouseGoodsShelves") WarehouseGoodsShelves warehouseGoodsShelves);
    List<WarehouseGoodsShelves> list(@Param("warehouseGoodsShelves") WarehouseGoodsShelves warehouseGoodsShelves);
}
src/main/java/com/ruoyi/warehouse/pojo/DocumentClassification.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,67 @@
package com.ruoyi.warehouse.pojo;
import com.baomidou.mybatisplus.annotation.*;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
 * æ–‡æ¡£åˆ†ç±»è¡¨
 * @TableName document_classification
 */
@TableName(value ="document_classification")
@Data
@ApiModel(value = "文档分类表")
public class DocumentClassification implements Serializable {
    /**
     *
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * ç±»åˆ«åç§°
     */
    private String category;
    /**
     * çˆ¶ç±»id
     */
    private Long parentId;
    /**
     * åˆ›å»ºæ—¶é—´
     */
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    /**
     * åˆ›å»ºç”¨æˆ·
     */
    @TableField(fill = FieldFill.INSERT)
    private Long createUser;
    /**
     * ä¿®æ”¹æ—¶é—´
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
    /**
     * ä¿®æ”¹ç”¨æˆ·
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateUser;
    /**
     * ç§Ÿæˆ·id
     */
    @TableField(fill = FieldFill.INSERT)
    private Long tenantId;
    private static final long serialVersionUID = 1L;
}
src/main/java/com/ruoyi/warehouse/pojo/Documentation.java
@@ -28,11 +28,11 @@
    private Long id;
    /**
     * ç±»åˆ«åç§°
     * ç±»åˆ«åç§°id
     */
    @Excel(name = "类别名称")
    @ApiModelProperty(value = "类别名称")
    private String categoryName;
    @Excel(name = "类别名称id")
    @ApiModelProperty(value = "类别名称id")
    private Long documentClassificationId;
    /**
     * æ–‡æ¡£åç§°
@@ -72,7 +72,8 @@
    /**
     * æ–‡æ¡£æ—¥æœŸ
     */
    @Excel(name = "文档日期")
    @Excel(name = "文档日期", dateFormat = "yyyy-MM-dd", width = 30)
    @ApiModelProperty(value = "文档日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime docDate;
@@ -155,13 +156,13 @@
    /**
     * ä¿®æ”¹æ—¶é—´
     */
    @TableField(fill = FieldFill.UPDATE)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
    /**
     * ä¿®æ”¹ç”¨æˆ·
     */
    @TableField(fill = FieldFill.UPDATE)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateUser;
    /**
src/main/java/com/ruoyi/warehouse/pojo/DocumentationBorrowManagement.java
@@ -6,7 +6,10 @@
import java.time.LocalDateTime;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
@@ -26,41 +29,60 @@
    /**
     * æ–‡æ¡£id
     */
    @Excel(name = "文档id")
    private Long documentationId;
    /**
     * å€Ÿé˜…人id
     */
    @Excel(name = "借阅人id")
    @ApiModelProperty(value = "借阅人id")
    private Long borrowerId;
    /**
     * å€Ÿé˜…目的
     */
    @Excel(name = "借阅目的")
    @ApiModelProperty(value = "借阅目的")
    private String borrowPurpose;
    /**
     * å€Ÿé˜…日期
     */
    @ApiModelProperty(value = "借阅日期")
    @Excel(name = "借阅日期", dateFormat = "yyyy-MM-dd", width = 30)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime borrowDate;
    /**
     * åº”归还日期
     */
    @ApiModelProperty(value = "应归还日期")
    @Excel(name = "应归还日期", dateFormat = "yyyy-MM-dd", width = 30)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime dueReturnDate;
    /**
     * å®žé™…归还日期
     */
    @ApiModelProperty(value = "实际归还日期")
    @Excel(name = "实际归还日期", dateFormat = "yyyy-MM-dd", width = 30)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime returnDate;
    /**
     * å€Ÿé˜…状态
     */
    @ApiModelProperty(value = "借阅状态")
    @Excel(name = "借阅状态")
    private String borrowStatus;
    /**
     * å¤‡æ³¨
     */
    @ApiModelProperty(value = "备注")
    @Excel(name = "备注")
    private String remark;
    /**
@@ -78,13 +100,13 @@
    /**
     * ä¿®æ”¹æ—¶é—´
     */
    @TableField(fill = FieldFill.UPDATE)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
    /**
     * ä¿®æ”¹ç”¨æˆ·
     */
    @TableField(fill = FieldFill.UPDATE)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateUser;
    /**
src/main/java/com/ruoyi/warehouse/service/DocumentClassificationService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
package com.ruoyi.warehouse.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.warehouse.pojo.DocumentClassification;
import java.util.List;
/**
* @author 86151
* @description é’ˆå¯¹è¡¨ã€document_classification(文档分类表)】的数据库操作Service
* @createDate 2025-08-15 10:44:23
*/
public interface DocumentClassificationService extends IService<DocumentClassification> {
    boolean deleteByIds(List<Long> ids);
}
src/main/java/com/ruoyi/warehouse/service/DocumentationBorrowManagementService.java
@@ -6,6 +6,7 @@
import com.baomidou.mybatisplus.extension.service.IService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @author 86151
@@ -16,5 +17,9 @@
    IPage<DocumentationBorrowManagement> listPage(Page page, DocumentationBorrowManagement documentationBorrowManagement);
    void export(HttpServletResponse response);
    boolean add(DocumentationBorrowManagement documentationBorrowManagement);
    boolean deleteByIds(List<Long> ids);
}
src/main/java/com/ruoyi/warehouse/service/WarehouseGoodsShelvesService.java
@@ -22,4 +22,7 @@
    boolean updateRowcolById(WarehouseGoodsShelves warehouseGoodsShelves);
    boolean deleteByIds(List<Long> ids);
    List<WarehouseGoodsShelves> list(WarehouseGoodsShelves warehouseGoodsShelves);
}
src/main/java/com/ruoyi/warehouse/service/impl/DocumentClassificationServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,40 @@
package com.ruoyi.warehouse.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.warehouse.mapper.DocumentationMapper;
import com.ruoyi.warehouse.pojo.DocumentClassification;
import com.ruoyi.warehouse.pojo.Documentation;
import com.ruoyi.warehouse.service.DocumentClassificationService;
import com.ruoyi.warehouse.mapper.DocumentClassificationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author 86151
* @description é’ˆå¯¹è¡¨ã€document_classification(文档分类表)】的数据库操作Service实现
* @createDate 2025-08-15 10:44:23
*/
@Service
public class DocumentClassificationServiceImpl extends ServiceImpl<DocumentClassificationMapper, DocumentClassification>
    implements DocumentClassificationService{
    @Autowired
    private DocumentationMapper documentationMapper;
    @Override
    public boolean deleteByIds(List<Long> ids) {
        List<Documentation> documentations = documentationMapper.selectList(new LambdaQueryWrapper<Documentation>().in(Documentation::getDocumentClassificationId, ids));
        if(!CollectionUtils.isEmpty(documentations)){
            return false;
        }
        baseMapper.deleteBatchIds(ids);
        return true;
    }
}
src/main/java/com/ruoyi/warehouse/service/impl/DocumentationBorrowManagementServiceImpl.java
@@ -1,18 +1,24 @@
package com.ruoyi.warehouse.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto;
import com.ruoyi.warehouse.pojo.Documentation;
import com.ruoyi.warehouse.pojo.DocumentationBorrowManagement;
import com.ruoyi.warehouse.service.DocumentationBorrowManagementService;
import com.ruoyi.warehouse.mapper.DocumentationBorrowManagementMapper;
import com.ruoyi.warehouse.service.DocumentationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author 86151
@@ -20,22 +26,91 @@
* @createDate 2025-08-14 15:55:45
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class DocumentationBorrowManagementServiceImpl extends ServiceImpl<DocumentationBorrowManagementMapper, DocumentationBorrowManagement>
    implements DocumentationBorrowManagementService{
    @Autowired
    private DocumentationBorrowManagementMapper documentationBorrowManagementMapper;
    @Autowired
    private DocumentationService documentationService;
    @Override
    public IPage<DocumentationBorrowManagement> listPage(Page page, DocumentationBorrowManagement documentationBorrowManagement) {
        return null;
        IPage<DocumentationBorrowManagement> listPage = documentationBorrowManagementMapper.listPage(page, documentationBorrowManagement);
        return listPage;
    }
    @Override
    public void export(HttpServletResponse response) {
//        List<DocumentationBorrowManagement> list =documentationBorrowManagementMapper.list();
//        ExcelUtil<DocumentationBorrowManagement> util = new ExcelUtil<>(DocumentationBorrowManagement.class);
//        util.exportExcel(response, list, "文档借阅-归还记录");
    public boolean add(DocumentationBorrowManagement documentationBorrowManagement) {
        Long documentationId = documentationBorrowManagement.getDocumentationId();
        String borrowStatus = documentationBorrowManagement.getBorrowStatus();
        Documentation documentation = documentationService.getById(documentationId);
        if (documentation==null){
            System.out.println("文档不存在");
            return false;
        }
        if ("借出".equals(documentation.getDocStatus())){
            if ("归还".equals(borrowStatus)){
                documentation.setDocStatus("正常");
                documentationService.updateById(documentation);
                documentationBorrowManagementMapper.insert(documentationBorrowManagement);
                return true;
            }else{
                System.out.println("文档已借出,不能重复借出");
                return false;
            }
        }else if("正常".equals(documentation.getDocStatus())){
            if ("归还".equals(borrowStatus)){
                System.out.println("文档已归还,不能重复归还");
                return false;
            }else if("借出".equals(borrowStatus)){
                documentation.setDocStatus("借出");
                documentationService.updateById(documentation);
                documentationBorrowManagementMapper.insert(documentationBorrowManagement);
                return true;
            }
        }else{
            System.out.println("文档状态异常");
            return false;
        }
        return false;
    }
//    @Override
//    public boolean updateDBMById(DocumentationBorrowManagement documentationBorrowManagement) {
//        Long id = documentationBorrowManagement.getId();
////        Long documentationId = documentationBorrowManagement.getDocumentationId();
//        //查询文档是否已归还
//        DocumentationBorrowManagement dbm = documentationBorrowManagementMapper.selectById(id);
////        Long documentationId = dbm.getDocumentationId();
//        if ("归还".equals(dbm.getBorrowStatus())){
//            System.out.println("文档已归还,不能更新");
//            return false;
//        }
//        //查询文档
//        Documentation documentation = documentationService.getById(dbm.getDocumentationId());
//        String docStatus = documentation.getDocStatus();
//        if ("正常".equals(docStatus)){
//            System.out.println("文档已归还,不能更新");
//            return false;
//        }
//        return false;
//    }
    @Override
    public boolean deleteByIds(List<Long> ids) {
        List<DocumentationBorrowManagement> list = documentationBorrowManagementMapper.selectList(new LambdaQueryWrapper<DocumentationBorrowManagement>().in(DocumentationBorrowManagement::getId, ids));
        for (DocumentationBorrowManagement documentationBorrowManagement : list) {
            String borrowStatus = documentationBorrowManagement.getBorrowStatus();
            if ("借阅".equals(borrowStatus)){
                System.out.println("文档已借出,不能删除");
                return false;
            }
        }
        documentationBorrowManagementMapper.deleteBatchIds(ids);
        return true;
    }
}
src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesRowcolServiceImpl.java
@@ -45,15 +45,8 @@
        Wrapper<Documentation> queryWrapper = new LambdaQueryWrapper<Documentation>()
                .in(Documentation::getWarehouseGoodsShelvesRowcolId, ids);
        List<Documentation> documentations = documentationMapper.selectList(queryWrapper);
        if (!documentations.isEmpty()) {
            log.error("货架[ID:{}]上存在商品,禁止删除", ids);
            return false;
        }
        int i = warehouseGoodsShelvesRowcolMapper.deleteBatchIds(ids);
        if(i!=ids.size()){
            log.error("删除失败");
            return false;
        }
        if (!documentations.isEmpty()) return false;
        warehouseGoodsShelvesRowcolMapper.deleteBatchIds(ids);
        return true;
    }
}
src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesServiceImpl.java
@@ -36,6 +36,7 @@
*/
@Service
@Slf4j
@Transactional(rollbackFor = Exception.class)
public class WarehouseGoodsShelvesServiceImpl extends ServiceImpl<WarehouseGoodsShelvesMapper, WarehouseGoodsShelves>
    implements WarehouseGoodsShelvesService {
    @Autowired
@@ -54,17 +55,12 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean add(WarehouseGoodsShelves warehouseGoodsShelves) {
        WarehouseGoodsShelves one = warehouseGoodsShelvesMapper.selectOne(new LambdaQueryWrapper<WarehouseGoodsShelves>().eq(WarehouseGoodsShelves::getId, warehouseGoodsShelves.getId()));
        // 1. æ£€æŸ¥è´§æž¶åç§°æ˜¯å¦å·²å­˜åœ¨
        if (one == null) {
            log.error("货架ID不存在");
            int insert = warehouseGoodsShelvesMapper.insert(warehouseGoodsShelves);
            if (insert <= 0) {
                log.error("货架主记录添加失败");
                return false;
            }
            if (insert <= 0) return false;
        }
        Long shelvesId = warehouseGoodsShelves.getId();
@@ -86,16 +82,10 @@
                // ä½¿ç”¨æ‰¹é‡æ’入方法替代循环单条插入
                warehouseGoodsShelvesRowcolService.saveBatch(rowcolList);
            } catch (Exception e) {
                log.error("货架[{}]的行列记录批量添加失败", shelvesId, e);
                // æŠ›å‡ºå¼‚常触发事务回滚
                throw e;
            }
        }
        log.info("货架[{}]添加成功,层数:{},排数:{}",
                warehouseGoodsShelves.getGoodsShelvesName(),
                warehouseGoodsShelves.getStorey(),
                warehouseGoodsShelves.getArrange());
        return true;
    }
    /**
@@ -104,7 +94,6 @@
     * @return æ˜¯å¦æ›´æ–°æˆåŠŸ
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean updateRowcolById(WarehouseGoodsShelves warehouseGoodsShelves) {
        Long shelvesId = warehouseGoodsShelves.getId();
@@ -120,25 +109,14 @@
        Wrapper<Documentation> queryWrapper1 = new LambdaQueryWrapper<Documentation>()
                .in(Documentation::getWarehouseGoodsShelvesRowcolId, rowcolIds);
        List<Documentation> documentations = documentationMapper.selectList(queryWrapper1);
        if (!documentations.isEmpty()) {
            log.error("货架[ID:{}]上存在商品,禁止更新", shelvesId);
            return false;
        }
        if (!documentations.isEmpty()) return false;
        // å…ˆæ›´æ–°è´§æž¶ä¸»ä¿¡æ¯
        boolean isShelvesUpdated = updateById(warehouseGoodsShelves);
        if (!isShelvesUpdated) {
            log.warn("货架[{}]主信息更新失败", shelvesId);
            return false;
        }
        updateById(warehouseGoodsShelves);
        // åˆ é™¤æ—§çš„行列记录
        boolean isOldRowcolRemoved = warehouseGoodsShelvesRowcolService.removeByIds(rowcolIds);
        if (!isOldRowcolRemoved) {
            log.error("货架[{}]的旧行列记录删除失败", shelvesId);
            return false;
        }
        warehouseGoodsShelvesRowcolService.removeByIds(rowcolIds);
        // æ·»åŠ æ–°çš„è¡Œåˆ—è®°å½•
        add(warehouseGoodsShelves);
        log.info("货架[{}]的行列信息更新成功", shelvesId);
        return true;
    }
    /**
@@ -147,14 +125,9 @@
     * @return æ˜¯å¦åˆ é™¤æˆåŠŸ
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean deleteByIds(List<Long> ids) {
        // 1. å…ˆæŸ¥è¯¢æ‰€æœ‰è¦åˆ é™¤çš„货架信息
        List<WarehouseGoodsShelves> shelvesList = warehouseGoodsShelvesMapper.selectBatchIds(ids);
        if (CollectionUtils.isEmpty(shelvesList)) {
            log.info("未查询到需删除的货架,ID列表:{}", ids);
            return true; // æ— æ•°æ®å¯åˆ ï¼Œè§†ä¸ºæˆåŠŸ
        }
        // 2. æ£€æŸ¥æ‰€æœ‰è´§æž¶æ˜¯å¦å­˜åœ¨å•†å“ï¼ˆæœ‰å•†å“åˆ™ä¸å…è®¸åˆ é™¤ï¼‰
        for (WarehouseGoodsShelves shelves : shelvesList) {
@@ -175,20 +148,13 @@
            Wrapper<Documentation> queryWrapper1 = new LambdaQueryWrapper<Documentation>()
                    .in(Documentation::getWarehouseGoodsShelvesRowcolId, rowcolIds);
            List<Documentation> documentations = documentationMapper.selectList(queryWrapper1);
            if (!documentations.isEmpty()) {
                log.error("货架[ID:{}]上存在商品,禁止删除", shelvesId);
                return false; // ä»»ä¸€è´§æž¶æœ‰å•†å“åˆ™ç»ˆæ­¢åˆ é™¤
            }
            if (!documentations.isEmpty()) return false; // ä»»ä¸€è´§æž¶æœ‰å•†å“åˆ™ç»ˆæ­¢åˆ é™¤
        }
        // 3. å…ˆåˆ é™¤è´§æž¶ä¸»è®°å½•
        boolean isShelvesDeleted = removeByIds(ids);
        if (!isShelvesDeleted) {
            log.error("货架主记录删除失败,ID列表:{}", ids);
            return false;
        }
        warehouseGoodsShelvesMapper.deleteBatchIds(ids);
        // 4. æ‰¹é‡åˆ é™¤æ‰€æœ‰å…³è”的行列记录
        // 4. æ‰¹é‡åˆ é™¤æ‰€æœ‰è¡Œåˆ—记录
        List<Long> allShelvesIds = shelvesList.stream()
                .map(WarehouseGoodsShelves::getId)
                .collect(Collectors.toList());
@@ -196,17 +162,15 @@
        // æž„建批量删除条件
        Wrapper<WarehouseGoodsShelvesRowcol> deleteWrapper = new LambdaQueryWrapper<WarehouseGoodsShelvesRowcol>()
                .in(WarehouseGoodsShelvesRowcol::getWarehouseGoodsShelvesId, allShelvesIds);
        boolean isRowcolDeleted = warehouseGoodsShelvesRowcolService.remove(deleteWrapper);
        if (!isRowcolDeleted) {
            log.warn("货架关联的行列记录删除失败,货架ID列表:{}", allShelvesIds);
            // æ­¤å¤„可根据业务需求决定是否回滚货架删除操作
        }
        log.info("货架批量删除成功,ID列表:{}", ids);
        warehouseGoodsShelvesRowcolService.remove(deleteWrapper);
        return true;
    }
    @Override
    public List<WarehouseGoodsShelves> list(WarehouseGoodsShelves warehouseGoodsShelves) {
        return warehouseGoodsShelvesMapper.list(warehouseGoodsShelves);
    }
}
src/main/java/com/ruoyi/warehouse/service/impl/WarehouseServiceImpl.java
@@ -55,7 +55,6 @@
//        return removeByIds(ids);
//    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean deleteByIds(List<Long> ids) {
        // 1. æ£€æŸ¥æ˜¯å¦æœ‰è´§æž¶
        Wrapper<WarehouseGoodsShelves> queryWrapper = new LambdaQueryWrapper<WarehouseGoodsShelves>()
src/main/resources/mapper/warehouse/DocumentClassificationMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.warehouse.mapper.DocumentClassificationMapper">
    <resultMap id="BaseResultMap" type="com.ruoyi.warehouse.pojo.DocumentClassification">
            <id property="id" column="id" jdbcType="BIGINT"/>
            <result property="category" column="category" jdbcType="VARCHAR"/>
            <result property="parentId" column="parent_id" jdbcType="BIGINT"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="createUser" column="create_user" jdbcType="BIGINT"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
            <result property="updateUser" column="update_user" jdbcType="BIGINT"/>
            <result property="tenantId" column="tenant_id" jdbcType="BIGINT"/>
    </resultMap>
    <sql id="Base_Column_List">
        id,category,parent_id,
        create_time,create_user,update_time,
        update_user,tenant_id
    </sql>
</mapper>
src/main/resources/mapper/warehouse/DocumentationBorrowManagementMapper.xml
@@ -4,28 +4,50 @@
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.warehouse.mapper.DocumentationBorrowManagementMapper">
    <resultMap id="BaseResultMap" type="com.ruoyi.warehouse.pojo.DocumentationBorrowManagement">
            <id property="id" column="id" jdbcType="BIGINT"/>
            <result property="documentationId" column="documentation_id" jdbcType="BIGINT"/>
            <result property="borrowerId" column="borrower_id" jdbcType="BIGINT"/>
            <result property="borrowPurpose" column="borrow_purpose" jdbcType="VARCHAR"/>
            <result property="borrowDate" column="borrow_date" jdbcType="TIMESTAMP"/>
            <result property="dueReturnDate" column="due_return_date" jdbcType="TIMESTAMP"/>
            <result property="returnDate" column="return_date" jdbcType="TIMESTAMP"/>
            <result property="borrowStatus" column="borrow_status" jdbcType="VARCHAR"/>
            <result property="remark" column="remark" jdbcType="VARCHAR"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="createUser" column="create_user" jdbcType="BIGINT"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
            <result property="updateUser" column="update_user" jdbcType="BIGINT"/>
            <result property="tenantId" column="tenant_id" jdbcType="BIGINT"/>
    </resultMap>
<!--    <resultMap id="BaseResultMap" type="com.ruoyi.warehouse.pojo.DocumentationBorrowManagement">-->
<!--            <id property="id" column="id" jdbcType="BIGINT"/>-->
<!--            <result property="documentationId" column="documentation_id" jdbcType="BIGINT"/>-->
<!--            <result property="borrowerId" column="borrower_id" jdbcType="BIGINT"/>-->
<!--            <result property="borrowPurpose" column="borrow_purpose" jdbcType="VARCHAR"/>-->
<!--            <result property="borrowDate" column="borrow_date" jdbcType="TIMESTAMP"/>-->
<!--            <result property="dueReturnDate" column="due_return_date" jdbcType="TIMESTAMP"/>-->
<!--            <result property="returnDate" column="return_date" jdbcType="TIMESTAMP"/>-->
<!--            <result property="borrowStatus" column="borrow_status" jdbcType="VARCHAR"/>-->
<!--            <result property="remark" column="remark" jdbcType="VARCHAR"/>-->
<!--            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>-->
<!--            <result property="createUser" column="create_user" jdbcType="BIGINT"/>-->
<!--            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>-->
<!--            <result property="updateUser" column="update_user" jdbcType="BIGINT"/>-->
<!--            <result property="tenantId" column="tenant_id" jdbcType="BIGINT"/>-->
<!--    </resultMap>-->
    <sql id="Base_Column_List">
        id,documentation_id,borrower_id,
        borrow_purpose,borrow_date,due_return_date,
        return_date,borrow_status,remark,
        create_time,create_user,update_time,
        update_user,tenant_id
    </sql>
<!--    <sql id="Base_Column_List">-->
<!--        id,documentation_id,borrower_id,-->
<!--        borrow_purpose,borrow_date,due_return_date,-->
<!--        return_date,borrow_status,remark,-->
<!--        create_time,create_user,update_time,-->
<!--        update_user,tenant_id-->
<!--    </sql>-->
    <select id="listPage" resultType="com.ruoyi.warehouse.pojo.DocumentationBorrowManagement">
        select * from documentation_borrow_management
        where 1=1
        <if test="documentationBorrowManagement.borrowStatus != null">
            and borrow_status = #{documentationBorrowManagement.borrowStatus}
        </if>
        <if test="documentationBorrowManagement.documentationId != null">
            and documentation_id = #{documentationBorrowManagement.documentationId}
        </if>
        <if test="documentationBorrowManagement.borrowerId != null">
            and borrower_id = #{documentationBorrowManagement.borrowerId}
        </if>
        <if test="documentationBorrowManagement.borrowPurpose != null">
            and borrow_purpose = #{documentationBorrowManagement.borrowPurpose}
        </if>
        <if test="documentationBorrowManagement.borrowDate != null">
            and borrow_date = #{documentationBorrowManagement.borrowDate}
        </if>
        <if test="documentationBorrowManagement.dueReturnDate != null">
            and due_return_date = #{documentationBorrowManagement.dueReturnDate}
        </if>
    </select>
</mapper>
src/main/resources/mapper/warehouse/DocumentationMapper.xml
@@ -6,7 +6,7 @@
    <resultMap id="BaseResultMap" type="com.ruoyi.warehouse.pojo.Documentation">
            <id property="id" column="id" jdbcType="BIGINT"/>
            <result property="categoryName" column="category_name" jdbcType="VARCHAR"/>
            <result property="documentClassificationId" column="document_classification_id"/>
            <result property="docName" column="doc_name" jdbcType="VARCHAR"/>
            <result property="docNumber" column="doc_number" jdbcType="BIGINT"/>
            <result property="year" column="year" jdbcType="BIGINT"/>
@@ -42,17 +42,14 @@
    <select id="listPage" resultType="com.ruoyi.warehouse.pojo.Documentation">
        select * from documentation
        where 1=1
        <if test="documentation.categoryName != null">
            and category_name = #{documentation.categoryName}
        <if test="documentation.documentClassificationId != null">
            and document_classification_id = #{documentation.documentClassificationId}
        </if>
        <if test="documentation.docName != null">
            and doc_name = #{documentation.docName}
        </if>
        <if test="documentation.docNumber != null">
            and doc_number = #{documentation.docNumber}
        </if>
        <if test="documentation.warehouse_goods_shelves_rowcol_id != null">
            and warehouse_goods_shelves_rowcol_id = #{documentation.warehouseGoodsShelvesRowcolId}
        </if>
    </select>
    <select id="list" resultType="com.ruoyi.warehouse.pojo.Documentation">
src/main/resources/mapper/warehouse/WarehouseGoodsShelvesMapper.xml
@@ -16,4 +16,17 @@
            </if>
        </where>
    </select>
    <select id="list" resultType="com.ruoyi.warehouse.pojo.WarehouseGoodsShelves">
        select * from warehouse_goods_shelves
        <where>
            1=1
            <if test="warehouseGoodsShelves.goodsShelvesName != null and warehouseGoodsShelves.goodsShelvesName != ''">
                and goods_shelves_name like concat('%',#{warehouseGoodsShelves.goodsShelvesName},'%')
            </if>
            <if test="warehouseGoodsShelves.warehouseId != null">
                and warehouse_id = #{warehouseGoodsShelves.warehouseId}
            </if>
        </where>
    </select>
</mapper>