chenhj
2 天以前 31e23deb9ae71263fb59fcd82c26b22c9cdfc3d4
Merge branch 'master' of http://114.132.189.42:9002/r/zd-after
已修改9个文件
已添加23个文件
1059 ■■■■■ 文件已修改
main-business/src/main/java/com/ruoyi/business/controller/InspectionTaskController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/controller/PendingInventoryController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/controller/ProductionController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/controller/ProductionInventoryController.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/controller/ProductionMasterController.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/dto/InspectionTaskDto.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/dto/PendingInventoryDto.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/dto/ProductionMasterDto.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/entity/InspectionTask.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/entity/Production.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/entity/ProductionInventory.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/entity/ProductionMaster.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/mapper/InspectionTaskMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/mapper/ProductionInventoryMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/mapper/ProductionMasterMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/InspectionTaskService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/PendingInventoryService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/ProductionInventoryService.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/ProductionMasterService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/impl/InspectionTaskServiceImpl.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/impl/ProductionInventoryServiceImpl.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java 215 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250613093400__create_table_production_master.sql 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250613112800__create_table_production_inventory.sql 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250614134700__create_table_inspection_task.sql 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/mapper/InspectionTaskMapper.xml 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/mapper/ProductionInventoryMapper.xml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/mapper/ProductionMasterMapper.xml 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/PlusCodeGenerator.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/templates/controller.Java.ftl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/controller/InspectionTaskController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,21 @@
package com.ruoyi.business.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import lombok.AllArgsConstructor;
    import org.springframework.web.bind.annotation.RestController;
/**
* <p>
    * å·¡æ£€ä»»åŠ¡è¡¨ å‰ç«¯æŽ§åˆ¶å™¨
    * </p>
*
* @author ld
* @since 2025-06-14
*/
@RestController
@AllArgsConstructor
@RequestMapping("/inspectionTask")
        public class InspectionTaskController {
    }
main-business/src/main/java/com/ruoyi/business/controller/PendingInventoryController.java
@@ -3,7 +3,6 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.business.dto.PendingInventoryDto;
import com.ruoyi.business.entity.PendingInventory;
import com.ruoyi.business.service.PendingInventoryService;
import com.ruoyi.common.core.domain.R;
import lombok.AllArgsConstructor;
@@ -29,8 +28,8 @@
     * å¾…入库表查询
     */
    @GetMapping("/list")
    public R<IPage<PendingInventory>> list(Page page, PendingInventoryDto pendingInventoryDto) {
        IPage<PendingInventory> list = pendingInventoryService.selectPendingInventoryList(page, pendingInventoryDto);
    public R<IPage<PendingInventoryDto>> list(Page page, PendingInventoryDto pendingInventoryDto) {
        IPage<PendingInventoryDto> list = pendingInventoryService.selectPendingInventoryList(page, pendingInventoryDto);
        return R.ok(list);
    }
main-business/src/main/java/com/ruoyi/business/controller/ProductionController.java
@@ -25,7 +25,7 @@
    private ProductionService productionService;
    /**
     * æŸ¥è¯¢
     * ç”Ÿäº§æ˜Žç»†è¡¨æŸ¥è¯¢
     */
    @GetMapping("/list")
    public R<IPage<Production>> list(Page page, ProductionDto productionDto) {
main-business/src/main/java/com/ruoyi/business/controller/ProductionInventoryController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,39 @@
package com.ruoyi.business.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.business.entity.ProductionInventory;
import com.ruoyi.business.service.ProductionInventoryService;
import com.ruoyi.common.core.domain.R;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * <p>
 * ç”Ÿäº§ä¸»è¡¨ å‰ç«¯æŽ§åˆ¶å™¨
 * </p>
 *
 * @author ld
 * @since 2025-06-13
 */
@RestController
@AllArgsConstructor
@RequestMapping("/productionInventory")
public class ProductionInventoryController {
    private ProductionInventoryService productionInventoryService;
    /**
     * ç”Ÿäº§åº“存明细表查询
     */
    @GetMapping("/list")
    public R<IPage<ProductionInventory>> list(Page page,ProductionInventory productionInventory) {
        IPage<ProductionInventory> list = productionInventoryService.selectPIList(page,productionInventory);
        return R.ok(list);
    }
}
main-business/src/main/java/com/ruoyi/business/controller/ProductionMasterController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,54 @@
package com.ruoyi.business.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.business.dto.ProductionMasterDto;
import com.ruoyi.business.service.ProductionMasterService;
import com.ruoyi.common.core.domain.R;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
 * <p>
 * ç”Ÿäº§ä¸»è¡¨ å‰ç«¯æŽ§åˆ¶å™¨
 * </p>
 *
 * @author ld
 * @since 2025-06-13
 */
@RestController
@AllArgsConstructor
@RequestMapping("/productionMaster")
public class ProductionMasterController {
    private ProductionMasterService productionMasterService;
    /**
     * ç”Ÿäº§ä¸»è¡¨æŸ¥è¯¢
     */
    @GetMapping("/list")
    public R<IPage<ProductionMasterDto>> list(Page page, ProductionMasterDto productionMasterDto) {
        IPage<ProductionMasterDto> list = productionMasterService.selectPMList(page,productionMasterDto);
        return R.ok(list);
    }
    /**
     * ç”Ÿäº§ä¸»è¡¨æ–°å¢žä¿®æ”¹
     */
    @PostMapping("/addOrEditPM")
    public R addOrEditPM(@RequestBody ProductionMasterDto productionMasterDto) {
        return R.ok(productionMasterService.addOrEditPM(productionMasterDto));
    }
    /**
     * åˆ é™¤
     */
    @DeleteMapping("/delPM")
    public R remove(@RequestBody Long[] ids) {
        return R.ok(productionMasterService.delByIds(ids));
    }
}
main-business/src/main/java/com/ruoyi/business/dto/InspectionTaskDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
package com.ruoyi.business.dto;
import com.ruoyi.business.entity.InspectionTask;
import lombok.Data;
@Data
public class InspectionTaskDto extends InspectionTask {
}
main-business/src/main/java/com/ruoyi/business/dto/PendingInventoryDto.java
@@ -13,6 +13,12 @@
    @JsonProperty("pId")
    private Long pId;
    /**
     * æ­£å¼åº“id
     */
    @JsonProperty("officialId")
    private Long officialId;
    private List<Map<String, String>> fieldValue;
    /**
main-business/src/main/java/com/ruoyi/business/dto/ProductionMasterDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
package com.ruoyi.business.dto;
import com.ruoyi.business.entity.Production;
import com.ruoyi.business.entity.ProductionInventory;
import com.ruoyi.business.entity.ProductionMaster;
import lombok.Data;
import java.util.List;
@Data
public class ProductionMasterDto extends ProductionMaster {
    private List<Production> productionList;  //生产明细
    private List<ProductionInventory>  productionInventoryList; //使用库存明细
}
main-business/src/main/java/com/ruoyi/business/entity/InspectionTask.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,59 @@
package com.ruoyi.business.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
    import com.ruoyi.common.core.domain.MyBaseEntity;
/**
* å·¡æ£€ä»»åŠ¡è¡¨ å®žä½“ç±»
*
* @author ld
* @date 2025-06-14
*/
@Data
@TableName("inspection_task")
public class InspectionTask extends MyBaseEntity {
private static final long serialVersionUID = 1L;
        /**
        * å·¡æ£€ä»»åŠ¡å”¯ä¸€æ ‡è¯†
        */
            @TableId(value = "id", type = IdType.AUTO)
        private Long id;
        /**
        * å·¡æ£€ä»»åŠ¡åç§°
        */
            @TableField(value = "task_name")
        private String taskName;
        /**
        *
        */
            @TableField(value = "inspector_id")
        private Long inspectorId;
        /**
        * æ‰§è¡Œå·¡æ£€çš„人员姓名
        */
            @TableField(value = "inspector")
        private String inspector;
        /**
        * å·¡æ£€åœ°ç‚¹è¯¦ç»†æè¿°
        */
            @TableField(value = "port")
        private String port;
        /**
        * ä»»åŠ¡é™„åŠ è¯´æ˜Žæˆ–ç‰¹æ®Šæƒ…å†µè®°å½•
        */
            @TableField(value = "remarks")
        private String remarks;
        /**
        *
        */
            @TableField(value = "registrant_id")
        private Long registrantId;
        /**
        * ä»»åŠ¡ç™»è®°äººå§“å
        */
            @TableField(value = "registrant")
        private String registrant;
}
main-business/src/main/java/com/ruoyi/business/entity/Production.java
@@ -28,6 +28,11 @@
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * ç”Ÿäº§ä¸»è¡¨ID
     */
    @TableField(value = "production_master_id")
    private Long productionMasterId;
    /**
     * ç…¤ç§ID
     */
    @TableField(value = "coal_id")
@@ -37,11 +42,6 @@
     */
    @TableField(value = "coal")
    private String coal;
    /**
     * çƒ­å€¼
     */
    @TableField(value = "calorific_value")
    private Integer calorificValue;
    /**
     * ç”Ÿäº§æ•°é‡
     */
@@ -78,6 +78,11 @@
    @TableField(value = "producer")
    private String producer;
    /**
     * ç”Ÿäº§äººID
     */
    @TableField(value = "producer_id")
    private String producerId;
    /**
     * ç”Ÿäº§æ—¥æœŸ
     */
    @TableField(value = "production_date")
main-business/src/main/java/com/ruoyi/business/entity/ProductionInventory.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,49 @@
package com.ruoyi.business.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.ruoyi.common.core.domain.MyBaseEntity;
/**
 * ç”Ÿäº§ä¸»è¡¨ å®žä½“ç±»
 *
 * @author ruoyi
 * @date 2025-06-13
 */
@Data
@TableName("production_inventory")
public class ProductionInventory extends MyBaseEntity {
    private static final long serialVersionUID = 1L;
    /**
     * ä¸»é”®ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * ç”Ÿäº§ä¸»è¡¨ID
     */
    @TableField(value = "production_master_id")
    private Long productionMasterId;
    /**
     * ç…¤ç§ID
     */
    @TableField(value = "coal_id")
    private Long coalId;
    /**
     * ç…¤ç§
     */
    @TableField(value = "coal")
    private String coal;
    /**
     * åº“存数量
     */
    @TableField(value = "inventory_quantity")
    private Integer inventoryQuantity;
    /**
     * ä½¿ç”¨æ•°é‡
     */
    @TableField(value = "used_quantity")
    private Integer usedQuantity;
}
main-business/src/main/java/com/ruoyi/business/entity/ProductionMaster.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,75 @@
package com.ruoyi.business.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.core.domain.MyBaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDate;
/**
 * ç”Ÿäº§ä¸»è¡¨ å®žä½“ç±»
 *
 * @author ruoyi
 * @date 2025-06-13
 */
@Data
@TableName("production_master")
public class ProductionMaster extends MyBaseEntity {
    private static final long serialVersionUID = 1L;
    /**
     * ä¸»é”®ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * ç…¤ç§
     */
    @TableField(value = "coal")
    private String coal;
    /**
     * ç”Ÿäº§æ•°é‡
     */
    @TableField(value = "production_quantity")
    private Integer productionQuantity;
    /**
     * äººå·¥æˆæœ¬
     */
    @TableField(value = "labor_cost")
    private BigDecimal laborCost;
    /**
     * èƒ½è€—成本
     */
    @TableField(value = "energy_consumption_cost")
    private BigDecimal energyConsumptionCost;
    /**
     * è®¾å¤‡æŠ˜æ—§
     */
    @TableField(value = "equipment_depreciation")
    private BigDecimal equipmentDepreciation;
    /**
     * æ€»æˆæœ¬
     */
    @TableField(value = "total_cost")
    private BigDecimal totalCost;
    /**
     *
     */
    @TableField(value = "producer_id")
    private String producerId;
    /**
     * ç”Ÿäº§äºº
     */
    @TableField(value = "producer")
    private String producer;
    /**
     * ç”Ÿäº§æ—¥æœŸ
     */
    @TableField(value = "production_date")
    private LocalDate productionDate;
}
main-business/src/main/java/com/ruoyi/business/mapper/InspectionTaskMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
package com.ruoyi.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.business.entity.InspectionTask;
import org.apache.ibatis.annotations.Mapper;
/**
 * <p>
 * å·¡æ£€ä»»åŠ¡è¡¨ Mapper æŽ¥å£
 * </p>
 *
 * @author ld
 * @since 2025-06-14
 */
@Mapper
public interface InspectionTaskMapper extends BaseMapper<InspectionTask> {
}
main-business/src/main/java/com/ruoyi/business/mapper/ProductionInventoryMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
package com.ruoyi.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.business.entity.ProductionInventory;
import org.apache.ibatis.annotations.Mapper;
/**
 * <p>
 * ç”Ÿäº§ä¸»è¡¨ Mapper æŽ¥å£
 * </p>
 *
 * @author ruoyi
 * @since 2025-06-13
 */
@Mapper
public interface ProductionInventoryMapper extends BaseMapper<ProductionInventory> {
}
main-business/src/main/java/com/ruoyi/business/mapper/ProductionMasterMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
package com.ruoyi.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.business.entity.ProductionMaster;
import org.apache.ibatis.annotations.Mapper;
/**
 * <p>
 * ç”Ÿäº§ä¸»è¡¨ Mapper æŽ¥å£
 * </p>
 *
 * @author ruoyi
 * @since 2025-06-13
 */
@Mapper
public interface ProductionMasterMapper extends BaseMapper<ProductionMaster> {
}
main-business/src/main/java/com/ruoyi/business/service/InspectionTaskService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
package com.ruoyi.business.service;
import com.ruoyi.business.entity.InspectionTask;
import com.baomidou.mybatisplus.extension.service.IService;
/**
 * <p>
 * å·¡æ£€ä»»åŠ¡è¡¨ æœåŠ¡ç±»
 * </p>
 *
 * @author ld
 * @since 2025-06-14
 */
public interface InspectionTaskService extends IService<InspectionTask> {
}
main-business/src/main/java/com/ruoyi/business/service/PendingInventoryService.java
@@ -16,7 +16,7 @@
 */
public interface PendingInventoryService extends IService<PendingInventory> {
    IPage<PendingInventory> selectPendingInventoryList(Page page, PendingInventoryDto pendingInventoryDto);
    IPage<PendingInventoryDto> selectPendingInventoryList(Page page, PendingInventoryDto pendingInventoryDto);
    int addOrEditPending(PendingInventoryDto pendingInventoryDto);
main-business/src/main/java/com/ruoyi/business/service/ProductionInventoryService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
package com.ruoyi.business.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.business.entity.ProductionInventory;
import com.baomidou.mybatisplus.extension.service.IService;
/**
 * <p>
 * ç”Ÿäº§ä¸»è¡¨ æœåŠ¡ç±»
 * </p>
 *
 * @author ruoyi
 * @since 2025-06-13
 */
public interface ProductionInventoryService extends IService<ProductionInventory> {
    IPage<ProductionInventory> selectPIList(Page page, ProductionInventory productionInventory);
}
main-business/src/main/java/com/ruoyi/business/service/ProductionMasterService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,24 @@
package com.ruoyi.business.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.business.dto.ProductionMasterDto;
import com.ruoyi.business.entity.ProductionMaster;
import com.baomidou.mybatisplus.extension.service.IService;
/**
 * <p>
 * ç”Ÿäº§ä¸»è¡¨ æœåŠ¡ç±»
 * </p>
 *
 * @author ruoyi
 * @since 2025-06-13
 */
public interface ProductionMasterService extends IService<ProductionMaster> {
    IPage<ProductionMasterDto> selectPMList(Page page, ProductionMasterDto productionMasterDto);
    int addOrEditPM(ProductionMasterDto productionMasterDto);
    int delByIds(Long[] ids);
}
main-business/src/main/java/com/ruoyi/business/service/impl/InspectionTaskServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package com.ruoyi.business.service.impl;
import com.ruoyi.business.entity.InspectionTask;
import com.ruoyi.business.mapper.InspectionTaskMapper;
    import com.ruoyi.business.service.InspectionTaskService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import lombok.RequiredArgsConstructor;
/**
* <p>
    * å·¡æ£€ä»»åŠ¡è¡¨ æœåŠ¡å®žçŽ°ç±»
    * </p>
*
* @author ld
* @since 2025-06-14
*/
@Service
@RequiredArgsConstructor
    public class InspectionTaskServiceImpl extends ServiceImpl<InspectionTaskMapper, InspectionTask> implements InspectionTaskService {
    }
main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java
@@ -23,10 +23,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -50,10 +47,56 @@
    private final CoalFieldMapper coalFieldMapper;
    @Override
    public IPage<PendingInventory> selectPendingInventoryList(Page page, PendingInventoryDto pendingInventoryDto) {
    public IPage<PendingInventoryDto> selectPendingInventoryList(Page page, PendingInventoryDto pendingInventoryDto) {
        // 1. æž„建主查询
        LambdaQueryWrapper<PendingInventory> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByDesc(PendingInventory::getCreateTime);
        return pendingInventoryMapper.selectPage(page, queryWrapper);
        // 2. æ‰§è¡Œä¸»è¡¨åˆ†é¡µæŸ¥è¯¢
        IPage<PendingInventory> pendingInventoryPage = pendingInventoryMapper.selectPage(page, queryWrapper);
        // 3. æ— æ•°æ®å¿«é€Ÿè¿”回
        if (CollectionUtils.isEmpty(pendingInventoryPage.getRecords())) {
            return new Page<>(page.getCurrent(), page.getSize(), pendingInventoryPage.getTotal());
        }
        // 4. æå–所有待处理库存ID
        List<Long> pendingIds = pendingInventoryPage.getRecords().stream()
                .map(PendingInventory::getId)
                .collect(Collectors.toList());
        // 5. æ‰¹é‡æŸ¥è¯¢å…³è”的正式库存信息
        Map<Long, Long> pendingToOfficialMap = getOfficialInventoryMap(pendingIds);
        // 6. ä½¿ç”¨MyBatis-Plus的convert方法转换DTO
        return pendingInventoryPage.convert(record -> {
            PendingInventoryDto dto = new PendingInventoryDto();
            BeanUtils.copyProperties(record, dto);
            // ä»Žé¢„加载的Map中获取officialId
            dto.setOfficialId(pendingToOfficialMap.getOrDefault(record.getId(), null));
            return dto;
        });
    }
    // æ‰¹é‡èŽ·å–å¾…å¤„ç†åº“å­˜ä¸Žæ­£å¼åº“å­˜çš„æ˜ å°„å…³ç³»
    private Map<Long, Long> getOfficialInventoryMap(List<Long> pendingIds) {
        if (CollectionUtils.isEmpty(pendingIds)) {
            return Collections.emptyMap();
        }
        // æŸ¥è¯¢å…³è”的正式库存数据
        LambdaQueryWrapper<OfficialInventory> wrapper = new LambdaQueryWrapper<>();
        wrapper.select(OfficialInventory::getId, OfficialInventory::getPendingId)
                .in(OfficialInventory::getPendingId, pendingIds);
        return officialInventoryMapper.selectList(wrapper)
                .stream()
                .collect(Collectors.toMap(
                        OfficialInventory::getPendingId,
                        OfficialInventory::getId,
                        (existing, replacement) -> existing // å¦‚果有重复,保留第一个
                ));
    }
    @Override
@@ -135,15 +178,19 @@
            } else {
                pendingInventoryMapper.deleteById(pendingInventoryDto.getPId());
            }
            officialInventoryMapper.delete(new LambdaQueryWrapper<OfficialInventory>().eq(OfficialInventory::getPendingId, pendingInventoryDto.getPId()));
            OfficialInventory officialInventory = new OfficialInventory();
            BeanUtils.copyProperties(pendingInventory, officialInventory);
            officialInventory.setId(null);
            officialInventory.setPendingId(pendingInventoryDto.getPId());
            officialInventory.setInventoryQuantity(quantity);
            officialInventoryMapper.insert(officialInventory);
            //正式库
            if (pendingInventoryDto.getOfficialId() == null) {
                OfficialInventory officialInventory = new OfficialInventory();
                BeanUtils.copyProperties(pendingInventory, officialInventory);
                officialInventory.setId(null);
                officialInventory.setPendingId(pendingInventoryDto.getPId());
                officialInventory.setInventoryQuantity(quantity);
                officialInventoryMapper.insert(officialInventory);
            }else {
                OfficialInventory officialInventory = officialInventoryMapper.selectById(pendingInventoryDto.getOfficialId());
                officialInventory.setInventoryQuantity(quantity.add(officialInventory.getInventoryQuantity()));
                officialInventoryMapper.updateById(officialInventory);
            }
        }
        return i;
    }
main-business/src/main/java/com/ruoyi/business/service/impl/ProductionInventoryServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
package com.ruoyi.business.service.impl;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.business.entity.ProductionInventory;
import com.ruoyi.business.mapper.ProductionInventoryMapper;
import com.ruoyi.business.service.ProductionInventoryService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
/**
 * <p>
 * ç”Ÿäº§ä¸»è¡¨ æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author ruoyi
 * @since 2025-06-13
 */
@Service
@RequiredArgsConstructor
public class ProductionInventoryServiceImpl extends ServiceImpl<ProductionInventoryMapper, ProductionInventory> implements ProductionInventoryService {
    private final ProductionInventoryMapper productionInventoryMapper;
    @Override
    public IPage<ProductionInventory> selectPIList(Page page,ProductionInventory productionInventory) {
        LambdaQueryWrapper<ProductionInventory> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByDesc(ProductionInventory::getCreateTime);
        return productionInventoryMapper.selectPage(page, queryWrapper);
    }
}
main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,215 @@
package com.ruoyi.business.service.impl;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.business.dto.ProductionMasterDto;
import com.ruoyi.business.entity.Production;
import com.ruoyi.business.entity.ProductionInventory;
import com.ruoyi.business.entity.ProductionMaster;
import com.ruoyi.business.mapper.OfficialInventoryMapper;
import com.ruoyi.business.mapper.ProductionInventoryMapper;
import com.ruoyi.business.mapper.ProductionMapper;
import com.ruoyi.business.mapper.ProductionMasterMapper;
import com.ruoyi.business.service.ProductionMasterService;
import com.ruoyi.common.utils.bean.BeanUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * <p>
 * ç”Ÿäº§ä¸»è¡¨ æœåŠ¡å®žçŽ°ç±»
 * </p>
 *
 * @author ruoyi
 * @since 2025-06-13
 */
@Service
@RequiredArgsConstructor
public class ProductionMasterServiceImpl extends ServiceImpl<ProductionMasterMapper, ProductionMaster> implements ProductionMasterService {
    private final ProductionMasterMapper productionMasterMapper;
    private final ProductionInventoryMapper productionInventoryMapper;
    private final ProductionMapper productionMapper;
    private final OfficialInventoryMapper officialInventoryMapper;
    @Override
    public IPage<ProductionMasterDto> selectPMList(Page page, ProductionMasterDto productionMasterDto) {
        // 1. æž„建主表查询条件
        LambdaQueryWrapper<ProductionMaster> masterQueryWrapper = new LambdaQueryWrapper<>();
        // 2. æ‰§è¡Œä¸»è¡¨åˆ†é¡µæŸ¥è¯¢
        IPage<ProductionMaster> entityPage = productionMasterMapper.selectPage(page, masterQueryWrapper);
        // 3. æå–主表ID列表用于批量查询子表数据
        List<Long> masterIds = entityPage.getRecords().stream()
                .map(ProductionMaster::getId)
                .collect(Collectors.toList());
        // 4. æ‰¹é‡æŸ¥è¯¢å…³è”数据(避免N+1问题)
        Map<Long, List<Production>> productionMap = queryProductionByMasterIds(masterIds);
        Map<Long, List<ProductionInventory>> inventoryMap = queryInventoryByMasterIds(masterIds);
        // 5. è½¬æ¢æ•°æ®å¹¶ç»„装结果
        List<ProductionMasterDto> dtoList = entityPage.getRecords().stream()
                .map(record -> {
                    ProductionMasterDto dto = new ProductionMasterDto();
                    BeanUtils.copyProperties(record, dto);
                    dto.setProductionList(productionMap.getOrDefault(record.getId(), Collections.emptyList()));
                    dto.setProductionInventoryList(inventoryMap.getOrDefault(record.getId(), Collections.emptyList()));
                    return dto;
                })
                .collect(Collectors.toList());
        // 6. æž„建返回结果
        IPage<ProductionMasterDto> dtoPage = new Page<>();
        BeanUtils.copyProperties(entityPage, dtoPage, "records");
        dtoPage.setRecords(dtoList);
        return dtoPage;
    }
    /**
     * æ‰¹é‡æŸ¥è¯¢Production数据
     */
    private Map<Long, List<Production>> queryProductionByMasterIds(List<Long> masterIds) {
        if (masterIds.isEmpty()) {
            return Collections.emptyMap();
        }
        LambdaQueryWrapper<Production> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(Production::getProductionMasterId, masterIds);
        List<Production> productions = productionMapper.selectList(queryWrapper);
        return productions.stream()
                .collect(Collectors.groupingBy(Production::getProductionMasterId));
    }
    /**
     * æ‰¹é‡æŸ¥è¯¢ProductionInventory数据
     */
    private Map<Long, List<ProductionInventory>> queryInventoryByMasterIds(List<Long> masterIds) {
        if (masterIds.isEmpty()) {
            return Collections.emptyMap();
        }
        LambdaQueryWrapper<ProductionInventory> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(ProductionInventory::getProductionMasterId, masterIds);
        List<ProductionInventory> inventoryList = productionInventoryMapper.selectList(queryWrapper);
        return inventoryList.stream()
                .collect(Collectors.groupingBy(ProductionInventory::getProductionMasterId));
    }
    @Override
    @Transactional
    public int addOrEditPM(ProductionMasterDto productionMasterDto) {
        // 1. ç›´æŽ¥è®¡ç®—聚合值,避免创建多余列表
        BigDecimal totalPurchasePrice = BigDecimal.ZERO;
        BigDecimal totalLaborCost = BigDecimal.ZERO;
        BigDecimal totalEnergyConsumptionCost = BigDecimal.ZERO;
        BigDecimal totalTotalCost = BigDecimal.ZERO;
        BigDecimal totalEquipmentDepreciation = BigDecimal.ZERO;
        int totalProductionQuantity = 0;
        StringBuilder coalBuilder = new StringBuilder("["); // ä¼˜åŒ–字符串拼接
        for (Production production : productionMasterDto.getProductionList()) {
            totalPurchasePrice = totalPurchasePrice.add(production.getPurchasePrice());
            totalLaborCost = totalLaborCost.add(production.getLaborCost());
            totalEnergyConsumptionCost = totalEnergyConsumptionCost.add(production.getEnergyConsumptionCost());
            totalTotalCost = totalTotalCost.add(production.getTotalCost());
            totalEquipmentDepreciation = totalEquipmentDepreciation.add(production.getEquipmentDepreciation());
            totalProductionQuantity += production.getProductionQuantity();
            coalBuilder.append(production.getCoal()).append(",");
        }
        // å¤„理coal字符串拼接
        String coalStr = coalBuilder.length() > 1 ?
                coalBuilder.deleteCharAt(coalBuilder.length()-1).append("]").toString() : "[]";
        // 2. åˆ›å»ºä¸»è¡¨å¯¹è±¡
        ProductionMaster productionMaster = new ProductionMaster();
        productionMaster.setProductionQuantity(totalProductionQuantity);
        productionMaster.setTotalCost(totalTotalCost);
        productionMaster.setEquipmentDepreciation(totalEquipmentDepreciation);
        productionMaster.setEnergyConsumptionCost(totalEnergyConsumptionCost);
        productionMaster.setLaborCost(totalLaborCost);
        productionMaster.setCoal(coalStr);
        Long masterId = productionMasterDto.getId();
        productionMaster.setId(masterId);
        // 3. ç»Ÿä¸€å­è¡¨å¤„理逻辑
        if (masterId == null) {
            productionMasterMapper.insert(productionMaster);
            masterId = productionMaster.getId(); // èŽ·å–æ–°ç”Ÿæˆçš„ID
        } else {
            // åˆ é™¤å…³è”子表数据(使用更高效的in删除)
            productionMapper.delete(new LambdaQueryWrapper<Production>()
                    .eq(Production::getProductionMasterId, masterId));
            productionInventoryMapper.delete(new LambdaQueryWrapper<ProductionInventory>()
                    .eq(ProductionInventory::getProductionMasterId, masterId));
            productionMasterMapper.updateById(productionMaster);
        }
        // 4. æ‰¹é‡æ’入子表数据
        batchInsertProductions(masterId, productionMasterDto.getProductionList());
        batchInsertInventories(masterId, productionMasterDto.getProductionInventoryList());
        return 1;
    }
    // æ‰¹é‡æ’入生产数据
    private void batchInsertProductions(Long masterId, List<Production> productions) {
        List<Production> insertList = productions.stream()
                .peek(p -> {
                    p.setId(null);
                    p.setProductionMasterId(masterId);
                })
                .collect(Collectors.toList());
        if (!insertList.isEmpty()) {
            for (Production production : productions) {
                production.setId(null);
                production.setProductionMasterId(masterId);
                productionMapper.insert(production);
            }
        }
    }
    // æ‰¹é‡æ’入库存数据
    private void batchInsertInventories(Long masterId, List<ProductionInventory> inventories) {
        List<ProductionInventory> insertList = inventories.stream()
                .peek(inv -> {
                    inv.setId(null);
                    inv.setProductionMasterId(masterId);
                })
                .collect(Collectors.toList());
        if (!insertList.isEmpty()) {
            for (ProductionInventory inventory : inventories) {
                inventory.setId(null);
                inventory.setProductionMasterId(masterId);
                productionInventoryMapper.insert(inventory);
            }
        }
    }
    @Override
    public int delByIds(Long[] ids) {
        return 0;
    }
}
main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql
@@ -1,24 +1,25 @@
-- åˆ›å»ºç”Ÿäº§æ˜Žç»†è¡¨
CREATE TABLE production
(
    id                      BIGSERIAL PRIMARY KEY,                              -- ä¸»é”®ID
    coal_id                 BIGINT         NOT NULL  DEFAULT 0,                 -- ç…¤ç§ID
    coal                    VARCHAR(50)    NOT NULL,                            -- ç…¤ç§
    calorific_value         INT            NOT NULL,                            -- çƒ­å€¼
    production_quantity     INT            NOT NULL,                            -- ç”Ÿäº§æ•°é‡
    labor_cost              DECIMAL(10, 2) NOT NULL,                            -- äººå·¥æˆæœ¬
    energy_consumption_cost DECIMAL(10, 2) NOT NULL,                            -- èƒ½è€—成本
    equipment_depreciation  DECIMAL(10, 2) NOT NULL,                            -- è®¾å¤‡æŠ˜æ—§
    purchase_price          DECIMAL(10, 2) NOT NULL,                            -- é‡‡è´­å•ä»·
    total_cost              DECIMAL(10, 2) NOT NULL,                            -- æ€»æˆæœ¬
    producer                VARCHAR(50),                                        -- ç”Ÿäº§äºº
    production_date         DATE,                                               -- ç”Ÿäº§æ—¥æœŸ
    id                      BIGSERIAL PRIMARY KEY,             -- ä¸»é”®ID
    production_master_id    BIGINT         NOT NULL DEFAULT 0, -- ç”Ÿäº§ä¸»è¡¨ID
    coal_id                 BIGINT         NOT NULL DEFAULT 0, -- ç…¤ç§ID
    coal                    VARCHAR(50)    NOT NULL,           -- ç…¤ç§
    production_quantity     INT            NOT NULL,           -- ç”Ÿäº§æ•°é‡
    labor_cost              DECIMAL(10, 2) NOT NULL,           -- äººå·¥æˆæœ¬
    energy_consumption_cost DECIMAL(10, 2) NOT NULL,           -- èƒ½è€—成本
    equipment_depreciation  DECIMAL(10, 2) NOT NULL,           -- è®¾å¤‡æŠ˜æ—§
    purchase_price          DECIMAL(10, 2) NOT NULL,           -- é‡‡è´­å•ä»·
    total_cost              DECIMAL(10, 2) NOT NULL,           -- æ€»æˆæœ¬
    producer_id             VARCHAR(50),                       -- ç”Ÿäº§äººid
    producer                VARCHAR(50),                       -- ç”Ÿäº§äºº
    production_date         DATE,                              -- ç”Ÿäº§æ—¥æœŸ
    deleted                 INT            NOT NULL  DEFAULT 0,                 -- è½¯åˆ é™¤æ ‡å¿—:0=未删除,1=已删除
    create_by               VARCHAR(255),                                       -- åˆ›å»ºäººç”¨æˆ·å
    create_time             TIMESTAMP WITHOUT TIME ZONE, -- åˆ›å»ºæ—¶é—´ï¼Œé»˜è®¤å½“前时间
    update_by               VARCHAR(255),                                       -- æœ€åŽæ›´æ–°äººç”¨æˆ·å
    update_time             TIMESTAMP WITHOUT TIME ZONE  -- æœ€åŽæ›´æ–°æ—¶é—´ï¼Œé»˜è®¤å½“前时间
    deleted                 INT            NOT NULL DEFAULT 0, -- è½¯åˆ é™¤æ ‡å¿—:0=未删除,1=已删除
    create_by               VARCHAR(255),                      -- åˆ›å»ºäººç”¨æˆ·å
    create_time             TIMESTAMP WITHOUT TIME ZONE,       -- åˆ›å»ºæ—¶é—´ï¼Œé»˜è®¤å½“前时间
    update_by               VARCHAR(255),                      -- æœ€åŽæ›´æ–°äººç”¨æˆ·å
    update_time             TIMESTAMP WITHOUT TIME ZONE        -- æœ€åŽæ›´æ–°æ—¶é—´ï¼Œé»˜è®¤å½“前时间
);
-- æ·»åŠ è¡¨æ³¨é‡Š
@@ -28,7 +29,6 @@
COMMENT ON COLUMN production.id IS '主键ID';
COMMENT ON COLUMN production.coal_id IS '煤种ID';
COMMENT ON COLUMN production.coal IS '煤种';
COMMENT ON COLUMN production.calorific_value IS '热值';
COMMENT ON COLUMN production.production_quantity IS '生产数量';
COMMENT ON COLUMN production.labor_cost IS '人工成本';
COMMENT ON COLUMN production.energy_consumption_cost IS '能耗成本';
main-business/src/main/resources/db/migration/postgresql/V20250613093400__create_table_production_master.sql
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,40 @@
-- åˆ›å»ºç”Ÿäº§æ˜Žç»†è¡¨
CREATE TABLE production_master
(
    id                      BIGSERIAL PRIMARY KEY,             -- ä¸»é”®ID
    coal                    VARCHAR(50)    NOT NULL,           -- ç…¤ç§
    production_quantity     INT            NOT NULL,           -- ç”Ÿäº§æ•°é‡
    labor_cost              DECIMAL(10, 2) NOT NULL,           -- äººå·¥æˆæœ¬
    energy_consumption_cost DECIMAL(10, 2) NOT NULL,           -- èƒ½è€—成本
    equipment_depreciation  DECIMAL(10, 2) NOT NULL,           -- è®¾å¤‡æŠ˜æ—§
    total_cost              DECIMAL(10, 2) NOT NULL,           -- æ€»æˆæœ¬
    producer_id             VARCHAR(50),                       -- ç”Ÿäº§äººid
    producer                VARCHAR(50),                       -- ç”Ÿäº§äºº
    production_date         DATE,                              -- ç”Ÿäº§æ—¥æœŸ
    deleted                 INT            NOT NULL DEFAULT 0, -- è½¯åˆ é™¤æ ‡å¿—:0=未删除,1=已删除
    create_by               VARCHAR(255),                      -- åˆ›å»ºäººç”¨æˆ·å
    create_time             TIMESTAMP WITHOUT TIME ZONE,       -- åˆ›å»ºæ—¶é—´ï¼Œé»˜è®¤å½“前时间
    update_by               VARCHAR(255),                      -- æœ€åŽæ›´æ–°äººç”¨æˆ·å
    update_time             TIMESTAMP WITHOUT TIME ZONE        -- æœ€åŽæ›´æ–°æ—¶é—´ï¼Œé»˜è®¤å½“前时间
);
-- æ·»åŠ è¡¨æ³¨é‡Š
COMMENT ON TABLE production_master IS '生产主表';
-- æ·»åŠ å­—æ®µæ³¨é‡Š
COMMENT ON COLUMN production_master.id IS '主键ID';
COMMENT ON COLUMN production_master.coal IS '煤种';
COMMENT ON COLUMN production_master.production_quantity IS '生产数量';
COMMENT ON COLUMN production_master.labor_cost IS '人工成本';
COMMENT ON COLUMN production_master.energy_consumption_cost IS '能耗成本';
COMMENT ON COLUMN production_master.equipment_depreciation IS '设备折旧';
COMMENT ON COLUMN production_master.total_cost IS '总成本';
COMMENT ON COLUMN production_master.producer IS '生产人';
COMMENT ON COLUMN production_master.production_date IS '生产日期';
COMMENT ON COLUMN production_master.deleted IS '软删除标志,0=未删除,1=已删除';
COMMENT ON COLUMN production_master.create_by IS '创建该记录的用户';
COMMENT ON COLUMN production_master.create_time IS '记录创建时间';
COMMENT ON COLUMN production_master.update_by IS '最后修改该记录的用户';
COMMENT ON COLUMN production_master.update_time IS '记录最后更新时间';
main-business/src/main/resources/db/migration/postgresql/V20250613112800__create_table_production_inventory.sql
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
-- åˆ›å»ºç”Ÿäº§æ˜Žç»†è¡¨
CREATE TABLE production_inventory
(
    id                   BIGSERIAL PRIMARY KEY,          -- ä¸»é”®ID
    production_master_id BIGINT      NOT NULL DEFAULT 0, -- ç”Ÿäº§ä¸»è¡¨ID
    coal_id              BIGINT      NOT NULL DEFAULT 0, -- ç…¤ç§ID
    coal                 VARCHAR(50) NOT NULL,           -- ç…¤ç§
    inventory_quantity   INT         NOT NULL,           -- åº“存数量
    used_quantity        INT         NOT NULL,           -- ä½¿ç”¨æ•°é‡
    deleted              INT         NOT NULL DEFAULT 0, -- è½¯åˆ é™¤æ ‡å¿—:0=未删除,1=已删除
    create_by            VARCHAR(255),                   -- åˆ›å»ºäººç”¨æˆ·å
    create_time          TIMESTAMP WITHOUT TIME ZONE,    -- åˆ›å»ºæ—¶é—´ï¼Œé»˜è®¤å½“前时间
    update_by            VARCHAR(255),                   -- æœ€åŽæ›´æ–°äººç”¨æˆ·å
    update_time          TIMESTAMP WITHOUT TIME ZONE     -- æœ€åŽæ›´æ–°æ—¶é—´ï¼Œé»˜è®¤å½“前时间
);
-- æ·»åŠ è¡¨æ³¨é‡Š
COMMENT ON TABLE production_inventory IS '生产主表';
-- æ·»åŠ å­—æ®µæ³¨é‡Š
COMMENT ON COLUMN production_inventory.id IS '主键ID';
COMMENT ON COLUMN production_inventory.production_master_id IS '生产主表ID';
COMMENT ON COLUMN production_inventory.coal_id IS '煤种ID';
COMMENT ON COLUMN production_inventory.coal IS '煤种';
COMMENT ON COLUMN production_inventory.inventory_quantity IS '库存数量';
COMMENT ON COLUMN production_inventory.used_quantity IS '使用数量';
COMMENT ON COLUMN production_inventory.deleted IS '软删除标志,0=未删除,1=已删除';
COMMENT ON COLUMN production_inventory.create_by IS '创建该记录的用户';
COMMENT ON COLUMN production_inventory.create_time IS '记录创建时间';
COMMENT ON COLUMN production_inventory.update_by IS '最后修改该记录的用户';
COMMENT ON COLUMN production_inventory.update_time IS '记录最后更新时间';
main-business/src/main/resources/db/migration/postgresql/V20250614134700__create_table_inspection_task.sql
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
-- åˆ›å»ºå·¡æ£€ä»»åŠ¡è¡¨
CREATE TABLE inspection_task
(
    id            BIGSERIAL PRIMARY KEY,       -- ä»»åŠ¡ID (主键,自增长)
    task_name     VARCHAR(255),                -- ä»»åŠ¡åç§°
    inspector_id  BIGINT,                      -- å·¡æ£€äººå‘˜id
    inspector     VARCHAR(100),                -- å·¡æ£€äººå‘˜
    port          TEXT,                        -- å·¡æ£€åœ°ç‚¹
    remarks       TEXT,                        -- å¤‡æ³¨è¯´æ˜Ž
    registrant_id BIGINT,                      -- ç™»è®°äººå‘˜id
    registrant    VARCHAR(100),                -- ç™»è®°äººå‘˜
    deleted       INT NOT NULL DEFAULT 0,      -- è½¯åˆ é™¤æ ‡å¿—:0=未删除,1=已删除
    create_by     VARCHAR(255),                -- åˆ›å»ºäººç”¨æˆ·å
    create_time   TIMESTAMP WITHOUT TIME ZONE, -- åˆ›å»ºæ—¶é—´ï¼Œé»˜è®¤å½“前时间
    update_by     VARCHAR(255),                -- æœ€åŽæ›´æ–°äººç”¨æˆ·å
    update_time   TIMESTAMP WITHOUT TIME ZONE  -- æœ€åŽæ›´æ–°æ—¶é—´ï¼Œé»˜è®¤å½“前时间
);
-- æ·»åŠ è¡¨æ³¨é‡Š
COMMENT ON TABLE inspection_task IS '巡检任务表';
-- æ·»åŠ å­—æ®µæ³¨é‡Š
COMMENT ON COLUMN inspection_task.id IS '巡检任务唯一标识';
COMMENT ON COLUMN inspection_task.task_name IS '巡检任务名称';
COMMENT ON COLUMN inspection_task.inspector IS '执行巡检的人员姓名';
COMMENT ON COLUMN inspection_task.port IS '巡检地点详细描述';
COMMENT ON COLUMN inspection_task.remarks IS '任务附加说明或特殊情况记录';
COMMENT ON COLUMN inspection_task.registrant IS '任务登记人姓名';
COMMENT ON COLUMN inspection_task.deleted IS '软删除标志,0=未删除,1=已删除';
COMMENT ON COLUMN inspection_task.create_by IS '创建该记录的用户';
COMMENT ON COLUMN inspection_task.create_time IS '记录创建时间';
COMMENT ON COLUMN inspection_task.update_by IS '最后修改该记录的用户';
COMMENT ON COLUMN inspection_task.update_time IS '记录最后更新时间';
main-business/src/main/resources/mapper/InspectionTaskMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
<?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.business.mapper.InspectionTaskMapper">
        <!-- é€šç”¨æŸ¥è¯¢æ˜ å°„结果 -->
        <resultMap id="BaseResultMap" type="com.ruoyi.business.entity.InspectionTask">
                    <id column="id" property="id" />
                <result column="deleted" property="deleted" />
                <result column="create_by" property="createBy" />
                <result column="create_time" property="createTime" />
                <result column="update_by" property="updateBy" />
                <result column="update_time" property="updateTime" />
                    <result column="task_name" property="taskName" />
                    <result column="inspector_id" property="inspectorId" />
                    <result column="inspector" property="inspector" />
                    <result column="port" property="port" />
                    <result column="remarks" property="remarks" />
                    <result column="registrant_id" property="registrantId" />
                    <result column="registrant" property="registrant" />
        </resultMap>
        <!-- é€šç”¨æŸ¥è¯¢ç»“果列 -->
        <sql id="Base_Column_List">
                deleted,
                create_by,
                create_time,
                update_by,
                update_time,
            id, task_name, inspector_id, inspector, port, remarks, registrant_id, registrant
        </sql>
</mapper>
main-business/src/main/resources/mapper/ProductionInventoryMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,30 @@
<?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.business.mapper.ProductionInventoryMapper">
        <!-- é€šç”¨æŸ¥è¯¢æ˜ å°„结果 -->
        <resultMap id="BaseResultMap" type="com.ruoyi.business.entity.ProductionInventory">
                    <id column="id" property="id" />
                <result column="deleted" property="deleted" />
                <result column="create_by" property="createBy" />
                <result column="create_time" property="createTime" />
                <result column="update_by" property="updateBy" />
                <result column="update_time" property="updateTime" />
                    <result column="production_master_id" property="productionMasterId" />
                    <result column="coal_id" property="coalId" />
                    <result column="coal" property="coal" />
                    <result column="inventory_quantity" property="inventoryQuantity" />
                    <result column="used_quantity" property="usedQuantity" />
        </resultMap>
        <!-- é€šç”¨æŸ¥è¯¢ç»“果列 -->
        <sql id="Base_Column_List">
                deleted,
                create_by,
                create_time,
                update_by,
                update_time,
            id, production_master_id, coal_id, coal, inventory_quantity, used_quantity
        </sql>
</mapper>
main-business/src/main/resources/mapper/ProductionMasterMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
<?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.business.mapper.ProductionMasterMapper">
        <!-- é€šç”¨æŸ¥è¯¢æ˜ å°„结果 -->
        <resultMap id="BaseResultMap" type="com.ruoyi.business.entity.ProductionMaster">
                    <id column="id" property="id" />
                <result column="deleted" property="deleted" />
                <result column="create_by" property="createBy" />
                <result column="create_time" property="createTime" />
                <result column="update_by" property="updateBy" />
                <result column="update_time" property="updateTime" />
                    <result column="coal" property="coal" />
                    <result column="production_quantity" property="productionQuantity" />
                    <result column="labor_cost" property="laborCost" />
                    <result column="energy_consumption_cost" property="energyConsumptionCost" />
                    <result column="equipment_depreciation" property="equipmentDepreciation" />
                    <result column="total_cost" property="totalCost" />
                    <result column="producer_id" property="producerId" />
                    <result column="producer" property="producer" />
                    <result column="production_date" property="productionDate" />
        </resultMap>
        <!-- é€šç”¨æŸ¥è¯¢ç»“果列 -->
        <sql id="Base_Column_List">
                deleted,
                create_by,
                create_time,
                update_by,
                update_time,
            id, coal, production_quantity, labor_cost, energy_consumption_cost, equipment_depreciation, total_cost, producer_id, producer, production_date
        </sql>
</mapper>
ruoyi-admin/src/main/java/com/ruoyi/PlusCodeGenerator.java
@@ -40,6 +40,7 @@
        String projectPath = System.getProperty("user.dir"); // èŽ·å–é¡¹ç›®æ ¹è·¯å¾„
        String path = "main-business"; // æ¨¡å—名称
        String table = "input_inventory_record,output_inventory_record,inventory_summary"; // è¡¨åï¼Œå¤šä¸ªè¡¨é€—号隔开
        String author = "chenhj";
        // ä»£ç è¾“出路径配置
        String outputBasePath = Paths.get(projectPath, path, "src", "main", "java").toString();
@@ -48,7 +49,7 @@
        // ä»£ç ç”Ÿæˆæ ¸å¿ƒé…ç½®
        FastAutoGenerator.create(DB_URL, DB_USERNAME, DB_PASSWORD)
                .globalConfig(builder -> {
                    builder.author("chenhj") // ä½œè€…信息
                    builder.author(author) // ä½œè€…信息
                            .outputDir(outputBasePath) // ä»£ç è¾“出目录
                            .dateType(DateType.ONLY_DATE) // æ—¥æœŸç±»åž‹
                            .commentDate("yyyy-MM-dd") // æ³¨é‡Šæ—¥æœŸæ ¼å¼
@@ -128,7 +129,7 @@
                    )); // åŸºç±»å­—段
                    customMap.put("idType", "AUTO"); // ä¸»é”®ç±»åž‹
                    customMap.put("superEntityClass", "com.ruoyi.common.core.domain.MyBaseEntity"); // åŸºç±»å…¨è·¯å¾„
                    customMap.put("author", "chenhj"); // ä½œè€…信息
                    customMap.put("author", author); // ä½œè€…信息
                    customMap.put("packageName", BASE_PACKAGE + "." + MODULE_NAME); // åŒ…名
                    customMap.put("tableName", table); // è¡¨å
ruoyi-admin/src/main/resources/templates/controller.Java.ftl
@@ -26,7 +26,7 @@
@Controller
</#if>
@AllArgsConstructor
@RequestMapping("<#if package.ModuleName?? && package.ModuleName != "">/${package.ModuleName}</#if>/<#if controllerMappingHyphenStyle>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
@RequestMapping("/<#if controllerMappingHyphenStyle>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
<#if kotlin>
    class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
<#else>