Просмотр исходного кода

报销列表新增整个报销统计金额

anderx лет назад: 2
Родитель
Сommit
7b26af1aac

+ 47 - 0
src/main/java/com/goafanti/common/mapper/ExpenseAccountMapper.xml

@@ -454,6 +454,53 @@
       and a.pay_dep = #{payDep}
     </if>
   </select>
+
+  <select id="selectExpenseAccountTotalAmount" resultType="java.lang.Integer">
+    select sum(a.total_amount) totalAmount
+    from expense_account a left join department b on a.apply_dep =b.id left join department c on a.pay_dep =c.id
+    left join admin d on a.aid =d.id left join t_order_new e on a.order_no =e.order_no
+    left join t_order_mid tm on a.order_no =tm.order_no
+    <if test="processStatus ==1">
+      inner join (select eaid ,auditor,min(process_status)`type` from expense_account_examine
+      where auditor= #{aid} group by eaid) eae on a.id=eae.eaid
+    </if>
+    where 1=1
+    <if test="processStatus ==0">
+      and a.aid= #{aid}
+    </if>
+    <if test="processStatus ==1">
+      and a.process_status>0
+      <if test="examineStatus ==0">
+        and a.process_status =eae.`type`
+      </if>
+      <if test="examineStatus ==1">
+        and a.process_status >eae.`type`
+      </if>
+    </if>
+    <if test="status != null">
+      and a.status= #{status}
+    </if>
+    <if test="startTime !=null and endTime !=null">
+      and a.create_time between #{startTime} and #{endTime}
+    </if>
+    <if test="depId != null">
+      and d.department_id = #{depId}
+    </if>
+    <if test="contractNo != null">
+      and e.contract_no = #{contractNo}
+    </if>
+    <if test="username != null">
+      and tm.buyer_name  like concat('%',#{username},'%')
+    </if>
+    <if test="applyDep != null">
+      and a.apply_dep  = #{applyDep}
+    </if>
+    <if test="payDep != null">
+      and a.pay_dep = #{payDep}
+    </if>
+  </select>
+
+
   <select id="selectByaidAndPrid" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccount">
     SELECT
     <include refid="selectDtailsSql"/>

+ 31 - 12
src/main/java/com/goafanti/core/mybatis/BaseMybatisDao.java

@@ -1,14 +1,10 @@
 package com.goafanti.core.mybatis;
 
-import java.lang.reflect.ParameterizedType;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.goafanti.common.utils.LoggerUtils;
+import com.goafanti.core.mybatis.page.MysqlDialect;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.core.mybatis.page.PagintionPlus;
+import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -19,9 +15,16 @@ import org.mybatis.spring.SqlSessionTemplate;
 import org.mybatis.spring.support.SqlSessionDaoSupport;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.goafanti.common.utils.LoggerUtils;
-import com.goafanti.core.mybatis.page.MysqlDialect;
-import com.goafanti.core.mybatis.page.Pagination;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.ParameterizedType;
+import java.math.BigDecimal;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 @SuppressWarnings({ "unchecked" })
 public class BaseMybatisDao<T> extends SqlSessionDaoSupport {
@@ -200,6 +203,22 @@ public class BaseMybatisDao<T> extends SqlSessionDaoSupport {
 
 	}
 
+	public Pagination<?> findPagePlus(String sqlId, String countId,String coutnAoumt, Map<String, Object> params, Integer pageNo,
+								  Integer pageSize) {
+		Pagination<?> page = findPage(sqlId, countId, params, pageNo, pageSize);
+		PagintionPlus res= new PagintionPlus();
+		try {
+			BeanUtils.copyProperties(res,page);
+		} catch (IllegalAccessException e) {
+			e.printStackTrace();
+		} catch (InvocationTargetException e) {
+			e.printStackTrace();
+		}
+		BigDecimal totalAmount = new BigDecimal(this.getSqlSession().selectOne(coutnAoumt, params).toString());
+		res.setTotalAmount(totalAmount);
+		return res;
+	}
+
 	/**
 	 * 重载减少参数DEFAULT_SQL_ID, "findCount"
 	 *

+ 2 - 0
src/main/java/com/goafanti/core/mybatis/page/Pagination.java

@@ -35,4 +35,6 @@ public class Pagination<T> extends SimplePage implements java.io.Serializable, P
 		this.list = list;
 	}
 
+
+
 }

+ 16 - 0
src/main/java/com/goafanti/core/mybatis/page/PagintionPlus.java

@@ -0,0 +1,16 @@
+package com.goafanti.core.mybatis.page;
+
+import java.math.BigDecimal;
+
+public class PagintionPlus<T> extends Pagination{
+
+    private BigDecimal totalAmount;
+
+    public BigDecimal getTotalAmount() {
+        return totalAmount;
+    }
+
+    public void setTotalAmount(BigDecimal totalAmount) {
+        this.totalAmount = totalAmount;
+    }
+}

+ 3 - 1
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -511,7 +511,9 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
     public Object pageList(InputPageListBo in) {
         Map<String ,Object> param=new HashMap<>();
         addParam(in, param);
-        return findPage("selectExpenseAccountList", "selectExpenseAccountCount", param, in.getPageNo(), in.getPageSize());
+        return findPagePlus("selectExpenseAccountList",
+                "selectExpenseAccountCount",
+                "selectExpenseAccountTotalAmount", param, in.getPageNo(), in.getPageSize());
     }
 
     @Override