浏览代码

收支明细

zxz 3 年之前
父节点
当前提交
d11067c9fb

+ 16 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/ReveExpeInfoController.java

@@ -1,6 +1,11 @@
 package com.yh.saas.plugin.yiliangyiyun.controller;
 package com.yh.saas.plugin.yiliangyiyun.controller;
 
 
 
 
+import com.baomidou.mybatisplus.plugins.Page;
+import com.yh.saas.plugin.yiliangyiyun.entity.ReveExpeInfo;
+import com.yh.saas.plugin.yiliangyiyun.service.IReveExpeInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
@@ -16,6 +21,16 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RestController
 @RequestMapping("/reveExpeInfo")
 @RequestMapping("/reveExpeInfo")
 public class ReveExpeInfoController {
 public class ReveExpeInfoController {
-
+    @Autowired
+    private IReveExpeInfoService reveExpeInfoService;
+    /**
+     * 收支明细列表
+     * @param reveExpeInfo
+     * @return
+     */
+    @GetMapping("/selectReveExpe")
+    public Page<ReveExpeInfo> selectReveExpe(ReveExpeInfo reveExpeInfo) {
+        return reveExpeInfoService.selectReveExpe(reveExpeInfo);
+    }
 }
 }
 
 

+ 32 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/ReveExpeInfo.java

@@ -2,16 +2,20 @@ package com.yh.saas.plugin.yiliangyiyun.entity;
 
 
 import com.baomidou.mybatisplus.activerecord.Model;
 import com.baomidou.mybatisplus.activerecord.Model;
 import java.io.Serializable;
 import java.io.Serializable;
+import java.util.Date;
 
 
+import com.baomidou.mybatisplus.annotations.TableField;
 import com.baomidou.mybatisplus.annotations.TableId;
 import com.baomidou.mybatisplus.annotations.TableId;
 import com.baomidou.mybatisplus.annotations.TableName;
 import com.baomidou.mybatisplus.annotations.TableName;
 import com.baomidou.mybatisplus.annotations.Version;
 import com.baomidou.mybatisplus.annotations.Version;
 
 
 import com.baomidou.mybatisplus.enums.IdType;
 import com.baomidou.mybatisplus.enums.IdType;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.yh.saas.common.support.entity.BaseModel;
 import com.yh.saas.common.support.entity.BaseModel;
 import lombok.Data;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -42,6 +46,10 @@ public class ReveExpeInfo extends BaseModel<ReveExpeInfo> {
      * 收支类型
      * 收支类型
      */
      */
     private String reexType;
     private String reexType;
+    /**
+     * 收支类型key
+     */
+    private String reexTypeKey;
     /**
     /**
      * 金额
      * 金额
      */
      */
@@ -59,6 +67,30 @@ public class ReveExpeInfo extends BaseModel<ReveExpeInfo> {
      */
      */
     private Double grossProfit;
     private Double grossProfit;
 
 
+    /**
+     * 开始时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @TableField(exist = false)
+    private Date startDate;
+    /**
+     * 结束时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @TableField(exist = false)
+    private Date endDate;
+    /**
+     * 模糊查询
+     */
+    @TableField(exist = false)
+    private String searchKeyWord;
+    /**
+     * 查询类型
+     */
+    @TableField(exist = false)
+    private String searchType;
 
 
     @Override
     @Override
     protected Serializable pkVal() {
     protected Serializable pkVal() {

+ 17 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/ReveExpeInfoMapper.java

@@ -3,6 +3,9 @@ package com.yh.saas.plugin.yiliangyiyun.mapper;
 import com.yh.saas.plugin.yiliangyiyun.entity.ReveExpeInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.ReveExpeInfo;
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 
 
+import java.util.List;
+import java.util.Map;
+
 /**
 /**
  * <p>
  * <p>
  * 收支明细 Mapper 接口
  * 收支明细 Mapper 接口
@@ -12,5 +15,19 @@ import com.baomidou.mybatisplus.mapper.BaseMapper;
  * @since 2022-03-03
  * @since 2022-03-03
  */
  */
 public interface ReveExpeInfoMapper extends BaseMapper<ReveExpeInfo> {
 public interface ReveExpeInfoMapper extends BaseMapper<ReveExpeInfo> {
+    /**
+     * 根据条件查询列表总数
+     *
+     * @param pageView
+     * @return
+     */
+    Integer getCountByCondition(Map<String, Object> pageView);
 
 
+    /**
+     * 根据条件查询收支明细列表
+     *
+     * @param pageView
+     * @return
+     */
+    List<ReveExpeInfo> getListByCondition(Map<String, Object> pageView);
 }
 }

+ 8 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IReveExpeInfoService.java

@@ -1,5 +1,6 @@
 package com.yh.saas.plugin.yiliangyiyun.service;
 package com.yh.saas.plugin.yiliangyiyun.service;
 
 
+import com.baomidou.mybatisplus.plugins.Page;
 import com.yh.saas.plugin.yiliangyiyun.entity.ReveExpeInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.ReveExpeInfo;
 import com.baomidou.mybatisplus.service.IService;
 import com.baomidou.mybatisplus.service.IService;
 
 
@@ -12,5 +13,12 @@ import com.baomidou.mybatisplus.service.IService;
  * @since 2022-03-03
  * @since 2022-03-03
  */
  */
 public interface IReveExpeInfoService extends IService<ReveExpeInfo> {
 public interface IReveExpeInfoService extends IService<ReveExpeInfo> {
+    /**
+     * 收支明细列表
+     *
+     * @param reveExpeInfo
+     * @return
+     */
+    Page<ReveExpeInfo> selectReveExpe(ReveExpeInfo reveExpeInfo);
 
 
 }
 }

+ 35 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ReveExpeInfoServiceImpl.java

@@ -1,11 +1,17 @@
 package com.yh.saas.plugin.yiliangyiyun.service.impl;
 package com.yh.saas.plugin.yiliangyiyun.service.impl;
 
 
+import com.baomidou.mybatisplus.plugins.Page;
+import com.google.common.collect.Lists;
 import com.yh.saas.plugin.yiliangyiyun.entity.ReveExpeInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.ReveExpeInfo;
 import com.yh.saas.plugin.yiliangyiyun.mapper.ReveExpeInfoMapper;
 import com.yh.saas.plugin.yiliangyiyun.mapper.ReveExpeInfoMapper;
 import com.yh.saas.plugin.yiliangyiyun.service.IReveExpeInfoService;
 import com.yh.saas.plugin.yiliangyiyun.service.IReveExpeInfoService;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
 /**
  * <p>
  * <p>
  * 收支明细 服务实现类
  * 收支明细 服务实现类
@@ -16,5 +22,33 @@ import org.springframework.stereotype.Service;
  */
  */
 @Service
 @Service
 public class ReveExpeInfoServiceImpl extends ServiceImpl<ReveExpeInfoMapper, ReveExpeInfo> implements IReveExpeInfoService {
 public class ReveExpeInfoServiceImpl extends ServiceImpl<ReveExpeInfoMapper, ReveExpeInfo> implements IReveExpeInfoService {
-
+    /**
+     * 收支明细列表
+     *
+     * @param reveExpeInfo
+     * @return
+     */
+    @Override
+    public Page<ReveExpeInfo> selectReveExpe(ReveExpeInfo reveExpeInfo) {
+        Map<String, Object> pageView = new HashMap<>();
+        pageView.put("startRecord", (reveExpeInfo.getCurrentPage() - 1)
+                * reveExpeInfo.getPageSize());
+        //公司id
+        pageView.put("compId", reveExpeInfo.getCompId());
+        pageView.put("searchKeyWord", reveExpeInfo.getSearchKeyWord());
+        pageView.put("searchType", reveExpeInfo.getSearchType());
+        pageView.put("startDate", reveExpeInfo.getStartDate());
+        pageView.put("endDate", reveExpeInfo.getEndDate());
+        pageView.put("pageSize", reveExpeInfo.getPageSize());
+        pageView.put("currentPage", reveExpeInfo.getCurrentPage());
+        // 查询列表总数
+        Integer dataCount = baseMapper.getCountByCondition(pageView);
+        List<ReveExpeInfo> dataList = baseMapper.getListByCondition(pageView);
+        Page<ReveExpeInfo> page = new Page<>();
+        page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
+        page.setTotal(dataCount == null ? 0 : dataCount);
+        page.setCurrent(reveExpeInfo.getCurrentPage());
+        page.setSize(reveExpeInfo.getPageSize());
+        return page;
+    }
 }
 }

+ 79 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/ReveExpeInfoMapper.xml

@@ -1,5 +1,84 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?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">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yh.saas.plugin.yiliangyiyun.mapper.ReveExpeInfoMapper">
 <mapper namespace="com.yh.saas.plugin.yiliangyiyun.mapper.ReveExpeInfoMapper">
+    <!-- 获得列表总数 -->
+    <select id="getCountByCondition" parameterType="Map" resultType="java.lang.Integer">
+        SELECT
+        COUNT(id)
+        FROM reve_expe_info
+        WHERE
+        comp_id = #{compId}
+        and delete_flag = '0'
+        <if test="searchType != null and searchType != ''">
+            <if test="searchType == 1">
+                AND reex_type_key = '1'
+                OR reex_type_key = '3'
+                OR reex_type_key = '5'
+            </if>
+            <if test="searchType == 2">
+                AND reex_type_key = '2'
+                OR reex_type_key = '4'
+                OR reex_type_key = '6'
+            </if>
+        </if>
+        <if test="startDate != null">
+            AND (DATE_FORMAT(create_date,"%Y%m%d") &gt;=
+            DATE_FORMAT(#{startDate},"%Y%m%d"))
+        </if>
+        <if test="endDate != null">
+            AND (DATE_FORMAT(create_date,"%Y%m%d") &lt;=
+            DATE_FORMAT(#{endDate},"%Y%m%d"))
+        </if>
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(expense_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(expense_remarks) like lower(CONCAT('%',#{searchKeyWord},'%')))
+        </if>
 
 
+    </select>
+    <!-- 获得收支明细列表 -->
+    <select id="getListByCondition" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.ReveExpeInfo">
+        SELECT
+        id,
+        comp_id as compId,
+        reex_type as reexType,
+        reex_type_key as reexTypeKey,
+        amount_money as amountMoney,
+        expense_name as expenseName,
+        expense_remarks as expenseRemarks,
+        gross_profit as grossProfit,
+        create_date as createDate
+        FROM reve_expe_info
+        WHERE
+        comp_id = #{compId}
+        and delete_flag = '0'
+        <if test="searchType != null and searchType != ''">
+            <if test="searchType == 1">
+                AND reex_type_key = '1'
+                OR reex_type_key = '3'
+                OR reex_type_key = '5'
+            </if>
+            <if test="searchType == 2">
+                AND reex_type_key = '2'
+                OR reex_type_key = '4'
+                OR reex_type_key = '6'
+            </if>
+        </if>
+        <if test="startDate != null">
+            AND (DATE_FORMAT(create_date,"%Y%m%d") &gt;=
+            DATE_FORMAT(#{startDate},"%Y%m%d"))
+        </if>
+        <if test="endDate != null">
+            AND (DATE_FORMAT(create_date,"%Y%m%d") &lt;=
+            DATE_FORMAT(#{endDate},"%Y%m%d"))
+        </if>
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(expense_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(expense_remarks) like lower(CONCAT('%',#{searchKeyWord},'%')))
+        </if>
+        ORDER BY create_date DESC
+        <if test="currentPage != null and currentPage != ''">
+            LIMIT ${startRecord}, ${pageSize}
+        </if>
+    </select>
 </mapper>
 </mapper>