From acb3bc29c9a844049c417840cbfb6b9280c238b0 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期五, 17 十月 2025 11:47:30 +0800 Subject: [PATCH] 项目管理代码生成,案件分类 --- ruoyi-system/src/main/java/com/ruoyi/system/service/CaseTypeService.java | 3 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/CaseMainController.java | 91 +++++++ ruoyi-system/src/main/java/com/ruoyi/system/query/CaseMainListQuery.java | 23 + ruoyi-system/src/main/java/com/ruoyi/system/service/CaseMainService.java | 4 ruoyi-system/src/main/java/com/ruoyi/system/vo/MonthStorageListVO.java | 27 ++ ruoyi-system/src/main/java/com/ruoyi/system/model/ContractTemplate.java | 5 ruoyi-system/src/main/java/com/ruoyi/system/service/ProjectInventoryService.java | 18 + ruoyi-system/src/main/java/com/ruoyi/system/model/CaseMainFile.java | 5 generator/src/test/java/com/xizang/CodeGeneratorTests.java | 4 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectInventoryController.java | 84 +++++++ ruoyi-system/src/main/java/com/ruoyi/system/model/ProjectStorageItem.java | 1 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/CaseTypeController.java | 45 +++ ruoyi-system/src/main/java/com/ruoyi/system/mapper/ProjectInventoryMapper.java | 19 + ruoyi-system/src/main/resources/mapper/system/CaseMainMapper.xml | 26 ++ ruoyi-system/src/main/java/com/ruoyi/system/mapper/CaseMainMapper.java | 6 ruoyi-system/src/main/java/com/ruoyi/system/mapper/CaseTypeMapper.java | 6 ruoyi-system/src/main/resources/mapper/system/ProjectInventoryMapper.xml | 139 +++++++++++ ruoyi-system/src/main/java/com/ruoyi/system/vo/InStorageListVO.java | 20 + ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ProjectInventoryServiceImpl.java | 36 +++ ruoyi-system/src/main/java/com/ruoyi/system/query/InventoryStorageListQuery.java | 13 + ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CaseTypeServiceImpl.java | 13 + ruoyi-system/src/main/java/com/ruoyi/system/model/CaseMain.java | 15 + ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CaseMainServiceImpl.java | 13 + ruoyi-system/src/main/java/com/ruoyi/system/model/ContractTemplateType.java | 5 ruoyi-system/src/main/java/com/ruoyi/system/query/CaseTypeListQuery.java | 16 + ruoyi-system/src/main/resources/mapper/system/CaseTypeMapper.xml | 9 ruoyi-system/src/main/java/com/ruoyi/system/vo/InventoryStorageListVO.java | 27 ++ ruoyi-system/src/main/java/com/ruoyi/system/vo/OutStorageListVO.java | 20 + 28 files changed, 685 insertions(+), 8 deletions(-) diff --git a/generator/src/test/java/com/xizang/CodeGeneratorTests.java b/generator/src/test/java/com/xizang/CodeGeneratorTests.java index cde9302..27c0076 100644 --- a/generator/src/test/java/com/xizang/CodeGeneratorTests.java +++ b/generator/src/test/java/com/xizang/CodeGeneratorTests.java @@ -25,7 +25,7 @@ private static final String DRIVER_NAME = "com.mysql.cj.jdbc.Driver"; - private static final String JDBC_URL = "jdbc:mysql://192.168.110.188:3307/shehong_intelligent_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai"; + private static final String JDBC_URL = "jdbc:mysql://192.168.110.188:3307/shehong_intelligent_platform_p2?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai"; private static final String USER_NAME = "root_remote"; private static final String PASSWORD = "123456"; @@ -149,7 +149,7 @@ // strategy.setTablePrefix(pc.getModuleName() + ""); // strategy.setLikeTable(new LikeTable("room")); //strategy.setLikeTable(new LikeTable("member")); - strategy.setLikeTable(new LikeTable("asset_"));// 生成表名 + strategy.setLikeTable(new LikeTable("year_"));// 生成表名 // strategy.setLikeTable(new LikeTable("oa_"));// 生成表名 // strategy.setLikeTable(new LikeTable("t_hotel"));// 生成表名 // strategy.setLikeTable(new LikeTable("t_scan_message"));// 生成表名 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/CaseMainController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/CaseMainController.java index 0c80778..7497f63 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/CaseMainController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/CaseMainController.java @@ -1,8 +1,31 @@ package com.ruoyi.web.controller.api; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.basic.PageInfo; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.framework.web.service.TokenService; +import com.ruoyi.system.model.CaseMain; +import com.ruoyi.system.model.CaseMainFile; +import com.ruoyi.system.model.CaseType; +import com.ruoyi.system.query.CaseMainListQuery; +import com.ruoyi.system.query.CaseTypeListQuery; +import com.ruoyi.system.service.CaseMainFileService; +import com.ruoyi.system.service.CaseMainService; +import com.ruoyi.system.service.CaseTypeService; +import com.ruoyi.system.service.ISysUserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.List; /** * <p> @@ -13,8 +36,70 @@ * @since 2025-10-16 */ @RestController +@Api(tags = "案件管理") @RequestMapping("/case-main") public class CaseMainController { - + @Resource + private CaseTypeService caseTypeService; + @Resource + private CaseMainService caseMainService; + @Resource + private CaseMainFileService caseMainFileService; + @Resource + private TokenService tokenService; + @Resource + private ISysUserService sysUserService; + @ApiOperation(value = "案件分类不分页列表") + @PostMapping(value = "/listType") + public R<List<CaseType>> listType() { + return R.ok(caseTypeService.list()); + } + @ApiOperation(value = "案件分页列表") + @PostMapping(value = "/pageList") + public R<PageInfo<CaseMain>> pageList(@RequestBody CaseMainListQuery query) { + return R.ok(caseMainService.pageList(query)); + } + @ApiOperation(value = "添加") + @Transactional + @Log(title = "案件-添加", businessType = BusinessType.INSERT) + @PostMapping(value = "/add") + public R<Boolean> save(@RequestBody CaseMain entity) { + entity.setUpdateTime(LocalDateTime.now()); + Long userId = tokenService.getLoginUser().getUserId(); + SysUser sysUser = sysUserService.selectUserById(userId); + entity.setUpdateBy(sysUser.getNickName()); + caseMainService.save(entity); + List<CaseMainFile> list = entity.getList(); + for (CaseMainFile caseMainFile : list) { + caseMainFile.setCaseId(entity.getId()); + } + caseMainFileService.saveBatch(list); + return R.ok(); + } + @ApiOperation(value = "修改") + @Transactional + @Log(title = "案件-修改", businessType = BusinessType.UPDATE) + @PostMapping(value = "/edit") + public R<Boolean> edit(@RequestBody CaseMain entity) { + caseMainService.updateById(entity); + caseMainFileService.remove(new LambdaQueryWrapper<CaseMainFile>() + .eq(CaseMainFile::getCaseId, entity.getId())); + List<CaseMainFile> list = entity.getList(); + for (CaseMainFile caseMainFile : list) { + caseMainFile.setCaseId(entity.getId()); + } + caseMainFileService.saveBatch(list); + return R.ok(); + } + @Log(title = "案件-删除", businessType = BusinessType.DELETE) + @Transactional + @ApiOperation(value = "案件分类-删除") + @DeleteMapping(value = "/delete") + public R delete(@RequestParam String ids) { + caseMainService.removeBatchByIds(Arrays.asList(ids.split(","))); + caseMainFileService.remove(new LambdaQueryWrapper<CaseMainFile>() + .in(CaseMainFile::getCaseId, Arrays.asList(ids.split(",")))); + return R.ok(); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/CaseTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/CaseTypeController.java index 8d67b85..6006b2a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/CaseTypeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/CaseTypeController.java @@ -1,8 +1,22 @@ package com.ruoyi.web.controller.api; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.basic.PageInfo; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.model.CaseType; +import com.ruoyi.system.model.ContractTemplateType; +import com.ruoyi.system.query.CaseTypeListQuery; +import com.ruoyi.system.query.ContractTemplateTypeListQuery; +import com.ruoyi.system.service.CaseTypeService; +import com.ruoyi.system.service.ContractTemplateTypeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Arrays; /** * <p> @@ -14,7 +28,34 @@ */ @RestController @RequestMapping("/case-type") +@Api(tags = "案件分类") public class CaseTypeController { + @Resource + private CaseTypeService caseTypeService; + @ApiOperation(value = "案件分类分页列表") + @PostMapping(value = "/pageList") + public R<PageInfo<CaseType>> pageList(@RequestBody CaseTypeListQuery query) { + return R.ok(caseTypeService.pageList(query)); + } + @ApiOperation(value = "添加") + @Log(title = "案件分类-添加", businessType = BusinessType.INSERT) + @PostMapping(value = "/add") + public R<Boolean> save(@RequestBody CaseType entity) { + return R.ok(caseTypeService.save(entity)); + } + @ApiOperation(value = "修改") + @Log(title = "案件分类-修改", businessType = BusinessType.UPDATE) + @PostMapping(value = "/edit") + public R<Boolean> edit(@RequestBody CaseType entity) { + return R.ok(caseTypeService.updateById(entity)); + } + @Log(title = "案件分类-删除", businessType = BusinessType.DELETE) + @ApiOperation(value = "案件分类-删除") + @DeleteMapping(value = "/delete") + public R delete(@RequestParam String ids) { + caseTypeService.removeBatchByIds(Arrays.asList(ids.split(","))); + return R.ok(); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectInventoryController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectInventoryController.java index 469bdb6..c18919e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectInventoryController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectInventoryController.java @@ -1,8 +1,28 @@ package com.ruoyi.web.controller.api; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.basic.PageInfo; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.model.*; +import com.ruoyi.system.query.InventoryStorageListQuery; +import com.ruoyi.system.query.ProjectMainListQuery; +import com.ruoyi.system.service.*; +import com.ruoyi.system.vo.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDate; +import java.util.List; /** * <p> @@ -13,8 +33,72 @@ * @since 2025-10-16 */ @RestController +@Api(tags = "存量项目情况") @RequestMapping("/project-inventory") public class ProjectInventoryController { + @Resource + private ProjectInventoryService projectInventoryService; + @Resource + private ProjectStorageItemService projectStorageItemService; + @Resource + private ProjectStorageService projectStorageService; + @ApiOperation(value = "获取存量项目顶部数据") + @PostMapping(value = "/topData") + public R<ProjectInventory> topData() { + int year = LocalDate.now().getYear(); + List<ProjectStorageItem> projectStorageItemList = projectStorageItemService.lambdaQuery() + .like(ProjectStorageItem::getMonth, year).list(); + List<ProjectStorage> projectStorageList = projectStorageService.lambdaQuery() + .like(ProjectStorage::getInTime, year).list(); + BigDecimal investmentTaskFinish = projectStorageItemList.stream().map(ProjectStorageItem::getAmount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + BigDecimal storageTaskFinish = projectStorageList.stream().map(ProjectStorage::getTotalAmount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + List<ProjectInventory> projectInventories = projectInventoryService.list(); + if (projectInventories.isEmpty()){ + ProjectInventory projectInventory = new ProjectInventory(); + projectInventory.setInvestmentTask(BigDecimal.ZERO); + projectInventory.setInvestmentTaskFinish(investmentTaskFinish); + projectInventory.setInvestmentTaskRating(new BigDecimal("100")); + projectInventory.setStorageTask(BigDecimal.ZERO); + projectInventory.setStorageTaskFinish(storageTaskFinish); + projectInventory.setStorageTaskRating(new BigDecimal("100")); + projectInventoryService.save(projectInventory); + return R.ok(projectInventory); + }else{ + ProjectInventory projectInventory = projectInventories.get(0); + projectInventory.setInvestmentTaskFinish(investmentTaskFinish); + projectInventory.setInvestmentTaskRating(investmentTaskFinish.divide(projectInventory.getInvestmentTask(),2, RoundingMode.HALF_UP)); + projectInventory.setStorageTaskFinish(storageTaskFinish); + projectInventory.setStorageTaskRating(storageTaskFinish.divide(projectInventory.getStorageTask(),2, RoundingMode.HALF_UP)); + return R.ok(projectInventory); + } + } + @ApiOperation(value = "修改存量项目顶部数据") + @Log(title = "修改存量项目顶部数据", businessType = BusinessType.UPDATE) + @PostMapping(value = "/saveOrUpdate") + public R<Boolean> saveOrUpdate(@RequestBody ProjectInventory entity) { + projectInventoryService.updateById( entity); + return R.ok(); + } + @ApiOperation(value = "存量项目情况分页列表") + @PostMapping(value = "/storagePageList") + public R<PageInfo<InventoryStorageListVO>> storagePageList(@RequestBody InventoryStorageListQuery inventoryStorageListQuery) { + return R.ok(projectInventoryService.storagePageList(inventoryStorageListQuery)); + } + @ApiOperation(value = "月新增入库项目情况分页列表") + @PostMapping(value = "/inStoragePageList") + public R<PageInfo<InStorageListVO>> inStoragePageList(@RequestBody InventoryStorageListQuery inventoryStorageListQuery) { + return R.ok(projectInventoryService.inStoragePageList(inventoryStorageListQuery)); + } + @ApiOperation(value = "月新增出库项目情况分页列表") + @PostMapping(value = "/outStoragePageList") + public R<PageInfo<OutStorageListVO>> outStoragePageList(@RequestBody InventoryStorageListQuery inventoryStorageListQuery) { + return R.ok(projectInventoryService.outStoragePageList(inventoryStorageListQuery)); + } + @ApiOperation(value = "月新增出库项目情况分页列表") + @PostMapping(value = "/outStoragePageList") + public R<PageInfo<MonthStorageListVO>> monthStoragePageList(@RequestBody InventoryStorageListQuery inventoryStorageListQuery) { + return R.ok(projectInventoryService.monthStoragePageList(inventoryStorageListQuery)); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/CaseMainMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/CaseMainMapper.java index 281ecb7..9fc1160 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/CaseMainMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/CaseMainMapper.java @@ -1,7 +1,12 @@ package com.ruoyi.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.common.basic.PageInfo; import com.ruoyi.system.model.CaseMain; +import com.ruoyi.system.query.CaseMainListQuery; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * <p> @@ -13,4 +18,5 @@ */ public interface CaseMainMapper extends BaseMapper<CaseMain> { + List<CaseMain> pageList(@Param("query")CaseMainListQuery query, @Param("pageInfo")PageInfo<CaseMain> pageInfo); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/CaseTypeMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/CaseTypeMapper.java index 9f139dd..fbbb7ae 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/CaseTypeMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/CaseTypeMapper.java @@ -1,7 +1,12 @@ package com.ruoyi.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.common.basic.PageInfo; import com.ruoyi.system.model.CaseType; +import com.ruoyi.system.query.CaseTypeListQuery; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * <p> @@ -13,4 +18,5 @@ */ public interface CaseTypeMapper extends BaseMapper<CaseType> { + List<CaseType> pageList(@Param("query")CaseTypeListQuery query, @Param("pageInfo")PageInfo<CaseType> pageInfo); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ProjectInventoryMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ProjectInventoryMapper.java index 23ca5eb..9a44def 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ProjectInventoryMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ProjectInventoryMapper.java @@ -1,7 +1,15 @@ package com.ruoyi.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.common.basic.PageInfo; import com.ruoyi.system.model.ProjectInventory; +import com.ruoyi.system.vo.InStorageListVO; +import com.ruoyi.system.vo.InventoryStorageListVO; +import com.ruoyi.system.vo.MonthStorageListVO; +import com.ruoyi.system.vo.OutStorageListVO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * <p> @@ -13,4 +21,15 @@ */ public interface ProjectInventoryMapper extends BaseMapper<ProjectInventory> { + /** + * 查询存量项目情况分页列表(按年度分组) + * @return 年度统计列表 + */ + List<InventoryStorageListVO> selectStoragePageList(@Param("pageInfo")PageInfo<InventoryStorageListVO> pageInfo); + + List<InStorageListVO> inStoragePageList(@Param("pageInfo")PageInfo<InStorageListVO> pageInfo); + + List<OutStorageListVO> outStoragePageList(@Param("pageInfo")PageInfo<OutStorageListVO> pageInfo); + + List<MonthStorageListVO> monthStoragePageList(@Param("pageInfo")PageInfo<MonthStorageListVO> pageInfo); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/model/CaseMain.java b/ruoyi-system/src/main/java/com/ruoyi/system/model/CaseMain.java index 7908be4..5025f01 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/model/CaseMain.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/model/CaseMain.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -11,6 +12,7 @@ import java.io.Serializable; import java.time.LocalDateTime; +import java.util.List; /** * <p> @@ -38,6 +40,8 @@ @ApiModelProperty(value = "创建时间") @TableField("create_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime createTime; @ApiModelProperty(value = "创建人") @@ -45,6 +49,7 @@ private String createBy; @ApiModelProperty(value = "更新时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @TableField("update_time") private LocalDateTime updateTime; @@ -68,5 +73,13 @@ @TableField("dept_id") private Integer deptId; - + @ApiModelProperty(value = "附件资料") + @TableField(exist = false) + private List<CaseMainFile> list; + @ApiModelProperty(value = "案件分类名称") + @TableField(exist = false) + private String typeName; + @ApiModelProperty(value = "所属部门名称") + @TableField(exist = false) + private String deptName; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/model/CaseMainFile.java b/ruoyi-system/src/main/java/com/ruoyi/system/model/CaseMainFile.java index 6ef9b07..674882b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/model/CaseMainFile.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/model/CaseMainFile.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -38,6 +39,8 @@ @ApiModelProperty(value = "创建时间") @TableField("create_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime createTime; @ApiModelProperty(value = "创建人") @@ -46,6 +49,8 @@ @ApiModelProperty(value = "更新时间") @TableField("update_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime updateTime; @ApiModelProperty(value = "更新人") diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/model/ContractTemplate.java b/ruoyi-system/src/main/java/com/ruoyi/system/model/ContractTemplate.java index ed8bd1f..4463c01 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/model/ContractTemplate.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/model/ContractTemplate.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -46,6 +47,8 @@ @ApiModelProperty(value = "创建时间") @TableField("create_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime createTime; @ApiModelProperty(value = "创建人") @@ -54,6 +57,8 @@ @ApiModelProperty(value = "更新时间") @TableField("update_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime updateTime; @ApiModelProperty(value = "更新人") diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/model/ContractTemplateType.java b/ruoyi-system/src/main/java/com/ruoyi/system/model/ContractTemplateType.java index db1dc63..6597019 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/model/ContractTemplateType.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/model/ContractTemplateType.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -38,6 +39,8 @@ @ApiModelProperty(value = "创建时间") @TableField("create_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime createTime; @ApiModelProperty(value = "创建人") @@ -46,6 +49,8 @@ @ApiModelProperty(value = "更新时间") @TableField("update_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private LocalDateTime updateTime; @ApiModelProperty(value = "更新人") diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/model/ProjectStorageItem.java b/ruoyi-system/src/main/java/com/ruoyi/system/model/ProjectStorageItem.java index 43e073c..b3b3ba2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/model/ProjectStorageItem.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/model/ProjectStorageItem.java @@ -71,4 +71,5 @@ private Integer projectStorageId; + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/query/CaseMainListQuery.java b/ruoyi-system/src/main/java/com/ruoyi/system/query/CaseMainListQuery.java new file mode 100644 index 0000000..3536d84 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/query/CaseMainListQuery.java @@ -0,0 +1,23 @@ +package com.ruoyi.system.query; + +import com.ruoyi.common.core.domain.BasePage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel(value = "案件分类分页列表query") +public class CaseMainListQuery extends BasePage { + + + @ApiModelProperty(value = "分类名称") + private Integer typeId; + @ApiModelProperty(value = "案件名称") + private String caseName; + @ApiModelProperty(value = "年份") + private String caseYear; + @ApiModelProperty(value = "更新时间开始 yyyy-MM-dd HH:mm:ss") + private String startTime; + @ApiModelProperty(value = "更新时间结束 yyyy-MM-dd HH:mm:ss") + private String endTime; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/query/CaseTypeListQuery.java b/ruoyi-system/src/main/java/com/ruoyi/system/query/CaseTypeListQuery.java new file mode 100644 index 0000000..8f3c233 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/query/CaseTypeListQuery.java @@ -0,0 +1,16 @@ +package com.ruoyi.system.query; + +import com.ruoyi.common.core.domain.BasePage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel(value = "案件分类类型分页列表query") +public class CaseTypeListQuery extends BasePage { + + + @ApiModelProperty(value = "分类名称") + private String typeName; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/query/InventoryStorageListQuery.java b/ruoyi-system/src/main/java/com/ruoyi/system/query/InventoryStorageListQuery.java new file mode 100644 index 0000000..b21195c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/query/InventoryStorageListQuery.java @@ -0,0 +1,13 @@ +package com.ruoyi.system.query; + +import com.ruoyi.common.core.domain.BasePage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel(value = "存量项目情况分页列表query") +public class InventoryStorageListQuery extends BasePage { + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/CaseMainService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/CaseMainService.java index cc6df47..f182d9a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/CaseMainService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/CaseMainService.java @@ -1,7 +1,10 @@ package com.ruoyi.system.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.basic.PageInfo; import com.ruoyi.system.model.CaseMain; +import com.ruoyi.system.model.CaseType; +import com.ruoyi.system.query.CaseMainListQuery; /** * <p> @@ -13,4 +16,5 @@ */ public interface CaseMainService extends IService<CaseMain> { + PageInfo<CaseMain> pageList(CaseMainListQuery query); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/CaseTypeService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/CaseTypeService.java index d19bcf1..56cee27 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/CaseTypeService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/CaseTypeService.java @@ -1,7 +1,9 @@ package com.ruoyi.system.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.basic.PageInfo; import com.ruoyi.system.model.CaseType; +import com.ruoyi.system.query.CaseTypeListQuery; /** * <p> @@ -13,4 +15,5 @@ */ public interface CaseTypeService extends IService<CaseType> { + PageInfo<CaseType> pageList(CaseTypeListQuery query); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ProjectInventoryService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ProjectInventoryService.java index 217d02e..33db3a5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ProjectInventoryService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ProjectInventoryService.java @@ -1,7 +1,13 @@ package com.ruoyi.system.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.basic.PageInfo; import com.ruoyi.system.model.ProjectInventory; +import com.ruoyi.system.query.InventoryStorageListQuery; +import com.ruoyi.system.vo.InStorageListVO; +import com.ruoyi.system.vo.InventoryStorageListVO; +import com.ruoyi.system.vo.MonthStorageListVO; +import com.ruoyi.system.vo.OutStorageListVO; /** * <p> @@ -13,4 +19,16 @@ */ public interface ProjectInventoryService extends IService<ProjectInventory> { + /** + * 存量项目情况分页列表(按年度分组) + * @return 分页结果 + */ + PageInfo<InventoryStorageListVO> storagePageList(InventoryStorageListQuery inventoryStorageListQuery); + + PageInfo<InStorageListVO> inStoragePageList(InventoryStorageListQuery inventoryStorageListQuery); + + PageInfo<OutStorageListVO> outStoragePageList(InventoryStorageListQuery inventoryStorageListQuery); + + PageInfo<MonthStorageListVO> monthStoragePageList(InventoryStorageListQuery inventoryStorageListQuery); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CaseMainServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CaseMainServiceImpl.java index 116ede6..9153618 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CaseMainServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CaseMainServiceImpl.java @@ -1,10 +1,15 @@ package com.ruoyi.system.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.basic.PageInfo; import com.ruoyi.system.mapper.CaseMainMapper; import com.ruoyi.system.model.CaseMain; +import com.ruoyi.system.model.CaseType; +import com.ruoyi.system.query.CaseMainListQuery; import com.ruoyi.system.service.CaseMainService; import org.springframework.stereotype.Service; + +import java.util.List; /** * <p> @@ -17,4 +22,12 @@ @Service public class CaseMainServiceImpl extends ServiceImpl<CaseMainMapper, CaseMain> implements CaseMainService { + @Override + public PageInfo<CaseMain> pageList(CaseMainListQuery query) { + PageInfo<CaseMain> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); + List<CaseMain> list = this.baseMapper.pageList(query,pageInfo); + + pageInfo.setRecords(list); + return pageInfo; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CaseTypeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CaseTypeServiceImpl.java index 0026cc0..a208106 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CaseTypeServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CaseTypeServiceImpl.java @@ -1,10 +1,15 @@ package com.ruoyi.system.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.basic.PageInfo; import com.ruoyi.system.mapper.CaseTypeMapper; import com.ruoyi.system.model.CaseType; +import com.ruoyi.system.model.ContractTemplateType; +import com.ruoyi.system.query.CaseTypeListQuery; import com.ruoyi.system.service.CaseTypeService; import org.springframework.stereotype.Service; + +import java.util.List; /** * <p> @@ -17,4 +22,12 @@ @Service public class CaseTypeServiceImpl extends ServiceImpl<CaseTypeMapper, CaseType> implements CaseTypeService { + @Override + public PageInfo<CaseType> pageList(CaseTypeListQuery query) { + PageInfo<CaseType> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); + List<CaseType> list = this.baseMapper.pageList(query,pageInfo); + + pageInfo.setRecords(list); + return pageInfo; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ProjectInventoryServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ProjectInventoryServiceImpl.java index 1afbdbb..d17ebad 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ProjectInventoryServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ProjectInventoryServiceImpl.java @@ -1,10 +1,15 @@ package com.ruoyi.system.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.basic.PageInfo; import com.ruoyi.system.mapper.ProjectInventoryMapper; import com.ruoyi.system.model.ProjectInventory; +import com.ruoyi.system.query.InventoryStorageListQuery; import com.ruoyi.system.service.ProjectInventoryService; +import com.ruoyi.system.vo.*; import org.springframework.stereotype.Service; + +import java.util.List; /** * <p> @@ -17,4 +22,35 @@ @Service public class ProjectInventoryServiceImpl extends ServiceImpl<ProjectInventoryMapper, ProjectInventory> implements ProjectInventoryService { + @Override + public PageInfo<InventoryStorageListVO> storagePageList(InventoryStorageListQuery inventoryStorageListQuery) { + PageInfo<InventoryStorageListVO> pageInfo = new PageInfo<>(inventoryStorageListQuery.getPageNum(), inventoryStorageListQuery.getPageSize()); + List<InventoryStorageListVO> list = this.baseMapper.selectStoragePageList(pageInfo); + pageInfo.setRecords( list); + return pageInfo; + } + + @Override + public PageInfo<InStorageListVO> inStoragePageList(InventoryStorageListQuery inventoryStorageListQuery) { + PageInfo<InStorageListVO> pageInfo = new PageInfo<>(inventoryStorageListQuery.getPageNum(), inventoryStorageListQuery.getPageSize()); + List<InStorageListVO> list = this.baseMapper.inStoragePageList(pageInfo); + pageInfo.setRecords( list); + return pageInfo; + } + + @Override + public PageInfo<OutStorageListVO> outStoragePageList(InventoryStorageListQuery inventoryStorageListQuery) { + PageInfo<OutStorageListVO> pageInfo = new PageInfo<>(inventoryStorageListQuery.getPageNum(), inventoryStorageListQuery.getPageSize()); + List<OutStorageListVO> list = this.baseMapper.outStoragePageList(pageInfo); + pageInfo.setRecords( list); + return pageInfo; + } + + @Override + public PageInfo<MonthStorageListVO> monthStoragePageList(InventoryStorageListQuery inventoryStorageListQuery) { + PageInfo<MonthStorageListVO> pageInfo = new PageInfo<>(inventoryStorageListQuery.getPageNum(), inventoryStorageListQuery.getPageSize()); + List<MonthStorageListVO> list = this.baseMapper.monthStoragePageList(pageInfo); + pageInfo.setRecords( list); + return pageInfo; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/InStorageListVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/InStorageListVO.java new file mode 100644 index 0000000..564676d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/InStorageListVO.java @@ -0,0 +1,20 @@ +package com.ruoyi.system.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +@ApiModel(value = "存量项目情况列表返回VO") +public class InStorageListVO implements Serializable { + @ApiModelProperty(value = "年月") + private String year; + @ApiModelProperty(value = "在库项目数量") + private Integer storageCount; + @ApiModelProperty(value = "项目总投资") + private BigDecimal totalAmount; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/InventoryStorageListVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/InventoryStorageListVO.java new file mode 100644 index 0000000..fc7002d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/InventoryStorageListVO.java @@ -0,0 +1,27 @@ +package com.ruoyi.system.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.system.model.ProjectMain; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +@ApiModel(value = "存量项目情况列表返回VO") +public class InventoryStorageListVO implements Serializable { + @ApiModelProperty(value = "年度") + private String year; + @ApiModelProperty(value = "在库项目数量") + private Integer storageCount; + @ApiModelProperty(value = "项目总投资") + private BigDecimal totalAmount; + @ApiModelProperty(value = "存量投资") + private BigDecimal remainingAmount; + @ApiModelProperty(value = "本年度已上报投资") + private BigDecimal yearAmount; + @ApiModelProperty(value = "已上报投资") + private BigDecimal allAmount; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/MonthStorageListVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/MonthStorageListVO.java new file mode 100644 index 0000000..79e1797 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/MonthStorageListVO.java @@ -0,0 +1,27 @@ +package com.ruoyi.system.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +@ApiModel(value = "月新增入库投资情况列表返回VO") +public class MonthStorageListVO implements Serializable { + @ApiModelProperty(value = "年月") + private String year; + @ApiModelProperty(value = "在库项目数量") + private Integer storageCount; + @ApiModelProperty(value = "项目总投资") + private BigDecimal totalAmount; + @ApiModelProperty(value = "存量投资") + private BigDecimal remainingAmount; + @ApiModelProperty(value = "本年度已上报投资") + private BigDecimal yearAmount; + @ApiModelProperty(value = "本月已上报投资") + private BigDecimal monthAmount; + @ApiModelProperty(value = "已上报投资") + private BigDecimal allAmount; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/OutStorageListVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/OutStorageListVO.java new file mode 100644 index 0000000..97e004f --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/OutStorageListVO.java @@ -0,0 +1,20 @@ +package com.ruoyi.system.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +@ApiModel(value = "存量项目情况列表返回VO") +public class OutStorageListVO implements Serializable { + @ApiModelProperty(value = "年月") + private String year; + @ApiModelProperty(value = "出库项目数量") + private Integer storageCount; + @ApiModelProperty(value = "项目总投资") + private BigDecimal totalAmount; + +} diff --git a/ruoyi-system/src/main/resources/mapper/system/CaseMainMapper.xml b/ruoyi-system/src/main/resources/mapper/system/CaseMainMapper.xml index f13b08b..3e553c5 100644 --- a/ruoyi-system/src/main/resources/mapper/system/CaseMainMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/CaseMainMapper.xml @@ -20,5 +20,31 @@ <sql id="Base_Column_List"> id, case_name, create_time, create_by, update_time, update_by, disabled, case_year, type_id, dept_id </sql> + <select id="pageList" resultType="com.ruoyi.system.model.CaseMain"> + select t1.*,t2.type_name as typeName,t3.dept_name as deptName from case_main t1 + left join case_type t2 on t1.type_id = t2.id + left join sys_dept t3 on t1.dept_id = t3.dept_id + where 1=1 + <if test="query.caseName != null and query.caseName != ''"> + and t1.case_name like concat('%',#{query.caseName},'%') + </if> + <if test="query.caseYear != null and query.caseYear != ''"> + and t1.case_year like concat('%',#{query.caseYear},'%') + </if> + <if test="query.typeId != null"> + and t1.type_id = #{query.typeId} + </if> + + <if test="query.startTime != null and query.startTime != ''"> + and t1.update_time >= #{query.startTime} + </if> + <if test="query.endTime != null and query.endTime != ''"> + and t1.update_time <= #{query.endTime} + </if> + and t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} + order by t1.update_time desc + + </select> + </mapper> diff --git a/ruoyi-system/src/main/resources/mapper/system/CaseTypeMapper.xml b/ruoyi-system/src/main/resources/mapper/system/CaseTypeMapper.xml index b03296a..444599f 100644 --- a/ruoyi-system/src/main/resources/mapper/system/CaseTypeMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/CaseTypeMapper.xml @@ -17,5 +17,14 @@ <sql id="Base_Column_List"> id, type_name, create_time, create_by, update_time, update_by, disabled </sql> + <select id="pageList" resultType="com.ruoyi.system.model.CaseType"> + select * from case_type + where 1=1 + <if test="query.typeName != null and query.typeName != ''"> + and type_name like concat('%',#{query.typeName},'%') + </if> + and disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} + order by create_time desc + </select> </mapper> diff --git a/ruoyi-system/src/main/resources/mapper/system/ProjectInventoryMapper.xml b/ruoyi-system/src/main/resources/mapper/system/ProjectInventoryMapper.xml index 96317ed..88f739b 100644 --- a/ruoyi-system/src/main/resources/mapper/system/ProjectInventoryMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/ProjectInventoryMapper.xml @@ -23,4 +23,143 @@ id, investment_task, investment_task_finish, investment_task_rating, create_time, create_by, update_time, update_by, disabled, storage_task, storage_task_finish, storage_task_rating </sql> + <!-- 存量项目情况分页列表(按年度分组) --> +<!-- <select id="selectStoragePageList" resultType="com.ruoyi.system.vo.InventoryStorageListVO">--> +<!-- SELECT --> +<!-- YEAR(ps.in_time) AS year,--> +<!-- COUNT(ps.id) AS storageCount,--> +<!-- COALESCE(SUM(ps.total_amount), 0) AS totalAmount,--> +<!-- COALESCE(SUM(ps.total_amount) - COALESCE(SUM(all_items.amount), 0), SUM(ps.total_amount)) AS remainingAmount,--> +<!-- COALESCE(SUM(year_items.amount), 0) AS yearAmount,--> +<!-- COALESCE(SUM(all_items.amount), 0) AS allAmount--> +<!-- FROM project_storage ps--> +<!-- LEFT JOIN (--> +<!-- SELECT --> +<!-- project_storage_id,--> +<!-- SUM(amount) AS amount--> +<!-- FROM project_storage_item --> +<!-- WHERE disabled = 0--> +<!-- GROUP BY project_storage_id--> +<!-- ) all_items ON ps.id = all_items.project_storage_id--> +<!-- LEFT JOIN (--> +<!-- SELECT --> +<!-- project_storage_id,--> +<!-- SUM(amount) AS amount--> +<!-- FROM project_storage_item --> +<!-- WHERE disabled = 0 --> +<!-- AND YEAR(STR_TO_DATE(CONCAT(month, '-01'), '%Y-%m-%d')) = YEAR(CURDATE())--> +<!-- GROUP BY project_storage_id--> +<!-- ) year_items ON ps.id = year_items.project_storage_id--> +<!-- WHERE ps.disabled = 0 --> +<!-- AND ps.status = 1--> +<!-- AND ps.in_time IS NOT NULL--> +<!-- GROUP BY YEAR(ps.in_time)--> +<!-- ORDER BY YEAR(ps.in_time) DESC--> +<!-- </select>--> + <select id="selectStoragePageList" resultType="com.ruoyi.system.vo.InventoryStorageListVO"> + SELECT + ps_year.year, + COUNT(ps_year.id) AS storageCount, + COALESCE(SUM(ps_year.total_amount), 0) AS totalAmount, + COALESCE(SUM(ps_year.total_amount) - COALESCE(SUM(all_items.amount), 0), SUM(ps_year.total_amount)) AS remainingAmount, + COALESCE(SUM(year_items.year_amount), 0) AS yearAmount, + COALESCE(SUM(all_items.amount), 0) AS allAmount + FROM ( + SELECT + id, + total_amount, + YEAR(in_time) as year + FROM project_storage + WHERE disabled = 0 + AND status = 1 + AND in_time IS NOT NULL + ) ps_year + LEFT JOIN ( + SELECT + project_storage_id, + SUM(amount) AS amount + FROM project_storage_item + WHERE disabled = 0 + GROUP BY project_storage_id + ) all_items ON ps_year.id = all_items.project_storage_id + LEFT JOIN ( + SELECT + psi.project_storage_id, + YEAR(STR_TO_DATE(CONCAT(psi.month, '-01'), '%Y-%m-%d')) as item_year, + SUM(psi.amount) AS year_amount + FROM project_storage_item psi + WHERE psi.disabled = 0 + GROUP BY psi.project_storage_id, YEAR(STR_TO_DATE(CONCAT(psi.month, '-01'), '%Y-%m-%d')) + ) year_items ON ps_year.id = year_items.project_storage_id AND ps_year.year = year_items.item_year + GROUP BY ps_year.year + ORDER BY ps_year.year DESC + </select> + <select id="inStoragePageList" resultType="com.ruoyi.system.vo.InStorageListVO"> + SELECT + DATE_FORMAT(ps.in_time, '%Y-%m') AS year, + COUNT(ps.id) AS storageCount, + COALESCE(SUM(ps.total_amount), 0) AS totalAmount + FROM project_storage ps + WHERE ps.disabled = 0 + AND ps.status = 1 + AND ps.in_time IS NOT NULL + GROUP BY DATE_FORMAT(ps.in_time, '%Y-%m') + ORDER BY DATE_FORMAT(ps.in_time, '%Y-%m') DESC + </select> + <select id="outStoragePageList" resultType="com.ruoyi.system.vo.OutStorageListVO"> + SELECT + DATE_FORMAT(ps.in_time, '%Y-%m') AS year, + COUNT(ps.id) AS storageCount, + COALESCE(SUM(ps.total_amount), 0) AS totalAmount + FROM project_storage ps + WHERE ps.disabled = 0 + AND ps.status = 2 + AND ps.in_time IS NOT NULL + GROUP BY DATE_FORMAT(ps.in_time, '%Y-%m') + ORDER BY DATE_FORMAT(ps.in_time, '%Y-%m') DESC + </select> + <select id="monthStoragePageList" resultType="com.ruoyi.system.vo.MonthStorageListVO"> + SELECT + DATE_FORMAT(ps.in_time, '%Y-%m') AS year, + COUNT(ps.id) AS storageCount, + COALESCE(SUM(ps.total_amount), 0) AS totalAmount, + COALESCE(SUM(ps.total_amount) - COALESCE(SUM(all_items.amount), 0), SUM(ps.total_amount)) AS remainingAmount, + COALESCE(SUM(year_items.year_amount), 0) AS yearAmount, + COALESCE(SUM(month_items.month_amount), 0) AS monthAmount, + COALESCE(SUM(all_items.amount), 0) AS allAmount + FROM project_storage ps + LEFT JOIN ( + SELECT + project_storage_id, + SUM(amount) AS amount + FROM project_storage_item + WHERE disabled = 0 + GROUP BY project_storage_id + ) all_items ON ps.id = all_items.project_storage_id + LEFT JOIN ( + SELECT + psi.project_storage_id, + YEAR(STR_TO_DATE(CONCAT(psi.month, '-01'), '%Y-%m-%d')) as item_year, + SUM(psi.amount) AS year_amount + FROM project_storage_item psi + WHERE psi.disabled = 0 + GROUP BY psi.project_storage_id, YEAR(STR_TO_DATE(CONCAT(psi.month, '-01'), '%Y-%m-%d')) + ) year_items ON ps.id = year_items.project_storage_id + AND YEAR(ps.in_time) = year_items.item_year + LEFT JOIN ( + SELECT + psi.project_storage_id, + psi.month, + SUM(psi.amount) AS month_amount + FROM project_storage_item psi + WHERE psi.disabled = 0 + GROUP BY psi.project_storage_id, psi.month + ) month_items ON ps.id = month_items.project_storage_id + AND DATE_FORMAT(ps.in_time, '%Y-%m') = month_items.month + WHERE ps.disabled = 0 + AND ps.status = 1 + AND ps.in_time IS NOT NULL + GROUP BY DATE_FORMAT(ps.in_time, '%Y-%m') + ORDER BY DATE_FORMAT(ps.in_time, '%Y-%m') DESC + </select> </mapper> -- Gitblit v1.7.1