소스 검색

库存报表添加年份列表

yzc 2 년 전
부모
커밋
4186d0fb64

+ 10 - 4
hx-wms/src/main/java/com/fjhx/wms/controller/monthly/MonthlyInventoryReportController.java

@@ -5,12 +5,10 @@ import com.fjhx.wms.entity.monthly.dto.MonthlyInventoryReportSelectDto;
 import com.fjhx.wms.entity.monthly.vo.MonthlyInventoryReportVo;
 import com.fjhx.wms.service.monthly.MonthlyInventoryReportService;
 import org.springframework.beans.factory.annotation.Autowired;
-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 org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 
 /**
@@ -37,6 +35,14 @@ public class MonthlyInventoryReportController {
     }
 
     /**
+     * 获取日报已有年份列表
+     */
+    @GetMapping("/getYearList")
+    public List<String> getYearList() {
+        return monthlyInventoryReportService.getYearList();
+    }
+
+    /**
      * Excel导出
      */
     @PostMapping("/exportExcel")

+ 5 - 0
hx-wms/src/main/java/com/fjhx/wms/mapper/monthly/MonthlyInventoryReportMapper.java

@@ -36,4 +36,9 @@ public interface MonthlyInventoryReportMapper extends BaseMapper<MonthlyInventor
      */
     List<MonthlyInventoryReportVo> getLastMonthMonthlyInventoryReport();
 
+    /**
+     * 获取日报已有年份列表
+     */
+    List<String> getYearList();
+
 }

+ 6 - 0
hx-wms/src/main/java/com/fjhx/wms/service/monthly/MonthlyInventoryReportService.java

@@ -7,6 +7,7 @@ import com.fjhx.wms.entity.monthly.vo.MonthlyInventoryReportVo;
 import com.ruoyi.common.core.service.BaseService;
 
 import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 
 /**
@@ -28,4 +29,9 @@ public interface MonthlyInventoryReportService extends BaseService<MonthlyInvent
      * Excel导出
      */
     void exportExcel(MonthlyInventoryReportSelectDto dto, HttpServletResponse httpServletResponse);
+
+    /**
+     * 获取日报已有年份列表
+     */
+    List<String> getYearList();
 }

+ 7 - 0
hx-wms/src/main/java/com/fjhx/wms/service/monthly/impl/MonthlyInventoryReportServiceImpl.java

@@ -186,4 +186,11 @@ public class MonthlyInventoryReportServiceImpl extends ServiceImpl<MonthlyInvent
         ExcelUtil.export(httpServletResponse, monthlyInventoryReportExcels, MonthlyInventoryReportExcel.class);
     }
 
+    /**
+     * 获取日报已有年份列表
+     */
+    public List<String> getYearList() {
+        return baseMapper.getYearList();
+    }
+
 }

+ 4 - 0
hx-wms/src/main/resources/mapper/monthly/MonthlyInventoryReportMapper.xml

@@ -46,5 +46,9 @@
         from monthly_inventory_report mir
         where DATE_FORMAT(mir.daily_report_date, '%Y-%m') = DATE_FORMAT(CURRENT_DATE - INTERVAL 2 MONTH, '%Y-%m')
     </select>
+    <select id="getYearList" resultType="java.lang.String">
+        SELECT DISTINCT date_format(daily_report_date, '%Y')
+        FROM monthly_inventory_report
+    </select>
 
 </mapper>