修改凭证查询速度和查询逻辑

This commit is contained in:
lvleigang 2024-08-23 11:39:00 +08:00
parent 50e8fdb834
commit ce93155ce7
7 changed files with 168 additions and 51 deletions

View File

@ -15,5 +15,7 @@ import java.util.List;
public interface IAcctVouchInfoDao extends IBaseDao<AcctVouchInfoEntity, String> {
List<AcctVouchInfoEntityVo> queryData(AcctVouchInfoEntity entity);
List<AcctVouchInfoEntityVo> queryDataFzxzl(AcctVouchInfoEntity entity);
}

View File

@ -24,6 +24,12 @@ public class AcctVouchInfoDaoImpl extends MybatisGenericDao<AcctVouchInfoEntity,
return o;
}
@Override
public List<AcctVouchInfoEntityVo> queryDataFzxzl(AcctVouchInfoEntity entity) {
List<AcctVouchInfoEntityVo> o = (List<AcctVouchInfoEntityVo>) super.selectList(getSqlIdPrifx() + "queryDataFzxzl", entity);
return o;
}
}

View File

@ -1,6 +1,8 @@
package com.hzya.frame.xsFinance.acctVouchInfo.entity;
import java.util.Date;
import java.util.List;
import com.hzya.frame.web.entity.BaseEntity;
/**
* 子表(AcctVouchInfo)实体类
@ -46,9 +48,12 @@ public class AcctVouchInfoEntity extends BaseEntity {
private String branch_code;
/** 院区名称 */
private String branch_name;
/** 院区名称 */
/** gsdm */
private String gsdm;
/** zdyfzhs */
private String zdyfzhs;
private List<AcctVouchInfoEntityVo> acctVouchInfoEntities;
public String getAcct_year() {
return acct_year;
}
@ -200,5 +205,21 @@ public class AcctVouchInfoEntity extends BaseEntity {
public void setGsdm(String gsdm) {
this.gsdm = gsdm;
}
public String getZdyfzhs() {
return zdyfzhs;
}
public void setZdyfzhs(String zdyfzhs) {
this.zdyfzhs = zdyfzhs;
}
public List<AcctVouchInfoEntityVo> getAcctVouchInfoEntities() {
return acctVouchInfoEntities;
}
public void setAcctVouchInfoEntities(List<AcctVouchInfoEntityVo> acctVouchInfoEntities) {
this.acctVouchInfoEntities = acctVouchInfoEntities;
}
}

View File

@ -168,15 +168,17 @@
<result property="org_name" column="org_name" jdbcType="VARCHAR"/>
<result property="branch_code" column="branch_code" jdbcType="VARCHAR"/>
<result property="branch_name" column="branch_name" jdbcType="VARCHAR"/>
<result property="zdyfzhs" column="zdyfzhs" jdbcType="VARCHAR"/>
</resultMap>
<select id="queryData" resultMap="get-AcctVouchInfoEntityVo-result" parameterType = "com.hzya.frame.xsFinance.acctVouchInfo.entity.AcctVouchInfoEntity">
select
<include refid="AcctVouchInfoEntity_Base_Column_List" />
from acct_vouch_info
<trim prefix="where" prefixOverrides="and">
<if test="acct_year != null and acct_year != ''"> and acct_year = '${acct_year}' </if>
<if test="acct_month != null and acct_month != ''"> and acct_month = '${acct_month}' </if>
<if test="org_code != null and org_code != ''"> and org_code = '${org_code}' </if>
<if test="gsdm != null and gsdm != ''"> and gsdm = '${gsdm}' </if>
<if test="acct_year != null and acct_year != ''"> and acct_year like '${acct_year}%' </if>
<if test="acct_month != null and acct_month != ''"> and acct_month like '%${acct_month}' </if>
<if test="dept_code != null and dept_code != ''"> and dept_code like '%${dept_code}%' </if>
<if test="dept_name != null and dept_name != ''"> and dept_name like '%${dept_name}%' </if>
<if test="acct_subj_code != null and acct_subj_code != ''"> and acct_subj_code like '%${acct_subj_code}%' </if>
@ -189,11 +191,27 @@
<if test="vouch_no != null"> and vouch_no like '%${vouch_no}%' </if>
<if test="summary != null and summary != ''"> and summary like '%${summary}%' </if>
<if test="bookkeeper != null and bookkeeper != ''"> and bookkeeper like '%${bookkeeper}%' </if>
<if test="org_code != null and org_code != ''"> and org_code like '%${org_code}%' </if>
<if test="org_name != null and org_name != ''"> and org_name like '%${org_name}%' </if>
<if test="branch_code != null and branch_code != ''"> and branch_code like '%${branch_code}%' </if>
<if test="branch_name != null and branch_name != ''"> and branch_name like '%${branch_name}%' </if>
</trim>
</select>
<select id="queryDataFzxzl" resultMap="get-AcctVouchInfoEntityVo-result" parameterType = "com.hzya.frame.xsFinance.acctVouchInfo.entity.AcctVouchInfoEntity">
select
fzdm as check_type_code,
fzmc as check_type_name,
lbdm as zdyfzhs,
kjnd as acct_year
from GL_Fzxzl
<trim prefix="where" prefixOverrides="and">
<if test="acctVouchInfoEntities != null and acctVouchInfoEntities.size() > 0 ">
and
<foreach collection="acctVouchInfoEntities" index="index" item="item" open="(" separator="or" close=")">
lbdm=#{item.zdyfzhs} and kjnd = #{item.acct_year}
</foreach>
</if>
</trim>
</select>
</mapper>

View File

@ -14,6 +14,30 @@ public class AcctVouchInfoEntityVo {
private String acct_year;
/** 月份 */
private String acct_month;
/** 金额 */
private Double amount;
/** 资金来源编码 */
private String fund_source_code;
/** 凭证号 */
private String vouch_no;
/** 摘要 */
private String summary;
/** 记账人 */
private String bookkeeper;
/** 单位编码 */
private String org_code;
/** 单位名称 */
private String org_name;
/** 院区编码 */
private String branch_code;
/** 院区名称 */
private String branch_name;
/** 科室编码 */
private String dept_code;
/** 科室名称 */
@ -28,24 +52,10 @@ public class AcctVouchInfoEntityVo {
private String check_type_name;
/** 借贷方向 */
private String direction;
/** 金额 */
private Double amount;
/** 资金来源编码 */
private String fund_source_code;
/** 凭证号 */
private String vouch_no;
/** 摘要 */
private String summary;
/** 记账人 */
private String bookkeeper;
/** 单位编码 */
private String org_code;
/** 单位名称 */
private String org_name;
/** 院区编码 */
private String branch_code;
/** 院区名称 */
private String branch_name;
private String zdyfzhs;
private String gsdm;
public String getAcct_year() {
return acct_year;
@ -190,5 +200,21 @@ public class AcctVouchInfoEntityVo {
public void setBranch_name(String branch_name) {
this.branch_name = branch_name;
}
public String getZdyfzhs() {
return zdyfzhs;
}
public void setZdyfzhs(String zdyfzhs) {
this.zdyfzhs = zdyfzhs;
}
public String getGsdm() {
return gsdm;
}
public void setGsdm(String gsdm) {
this.gsdm = gsdm;
}
}

View File

@ -52,9 +52,44 @@ public class AcctVouchInfoServiceImpl extends BaseService<AcctVouchInfoEntity, S
PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
List<AcctVouchInfoEntityVo> list = acctVouchInfoDao.queryData(entity);
PageInfo pageInfo = new PageInfo(list);
if(list != null && list.size() > 0){
for (int i = 0; i < list.size(); i++) {
if(list.get(i).getAcct_year() != null && list.get(i).getAcct_year().length() >= 6 ){
list.get(i).setAcct_year(list.get(i).getAcct_year().substring(0,4));
}
if(list.get(i).getAcct_month() != null && list.get(i).getAcct_month().length() >= 6 ){
list.get(i).setAcct_month(list.get(i).getAcct_month().substring(list.get(i).getAcct_month().length()-2));
}
}
}
//if(list != null && list.size() > 0){
// entity.setAcctVouchInfoEntities(list);
// List<AcctVouchInfoEntityVo> listnr = acctVouchInfoDao.queryDataFzxzl(entity);
// if(listnr != null && listnr.size() > 0){
// for (int i = 0; i < list.size(); i++) {
// for (int i1 = 0; i1 < listnr.size(); i1++) {
// if(list.get(i).getZdyfzhs().equals(listnr.get(i1).getZdyfzhs()) &&
// list.get(i).getAcct_year().equals(listnr.get(i1).getAcct_year())){
// list.get(i).setCheck_type_code(listnr.get(i1).getCheck_type_code());
// list.get(i).setCheck_type_name(listnr.get(i1).getCheck_type_name());
// }
// }
// }
// }
//}
return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
}else {
List<AcctVouchInfoEntityVo> list = acctVouchInfoDao.queryData(entity);
if(list != null && list.size() > 0){
for (int i = 0; i < list.size(); i++) {
if(list.get(i).getAcct_year() != null && list.get(i).getAcct_year().length() >= 6 ){
list.get(i).setAcct_year(list.get(i).getAcct_year().substring(0,4));
}
if(list.get(i).getAcct_month() != null && list.get(i).getAcct_month().length() >= 6 ){
list.get(i).setAcct_month(list.get(i).getAcct_month().substring(list.get(i).getAcct_month().length()-2));
}
}
}
return BaseResult.getSuccessMessageEntity("查询数据成功", list);
}
}

View File

@ -234,36 +234,45 @@
<!-- 分页查询列表 采用like格式 -->
<select id="queryData" resultMap="get-DictAcctSubjEntityVo-result" parameterType = "com.hzya.frame.xsFinance.dictAcctSubj.entity.DictAcctSubjEntity">
select
<include refid="DictAcctSubjEntity_Base_Column_List" />
from dict_acct_subj
kjnd as acct_year, -- 年度
kmdm as acct_subj_code, -- 会计科目编码
kmmc as acct_subj_name, -- 会计科目名称
convert(varchar(200),(case when LEN(kmdm) = 4 THEN kmdm else left(kmdm,len(kmdm)-2)end )) as supper_code, -- 上级编码
CASE WHEN LEN(kmdm) = 4 THEN 1 else LEN(kmdm)/2-1 end as subj_level, -- 科目级次
kmmx as is_last, -- 是否末级
isnull(kmqx,3) as subj_type_code, -- 科目类型编码
CASE
WHEN kmqx = '1' THEN
'收入类'
WHEN kmqx = '2' THEN
'支出类'
ELSE
'未定义类'
END as subj_type_name, -- 科目类型名称
case when yefx='J' then '借' when yefx='D' then '贷' end as direction, -- 借贷方向
case when kmmc='现金' then 1 else 0 end as is_cash, -- 是否现金
kmxz as subj_nature_code, -- 科目性质
case when fzhs is not null and fzhs !='' then 1 else 0 end as is_check, -- 是否辅助核算
syzt as Is_stop, -- 是否停用
'' as budg_subj_code, -- 预算会计科目编码
'' as budg_subj_name, -- 预算会计科目名称
'' as check_type_name1, -- 辅助核算项目1
'' as check_type_name2, -- 辅助核算项目2
'' as check_type_name3, -- 辅助核算项目3
'' as check_type_name4, -- 辅助核算项目4
'' as check_type_name5, -- 辅助核算项目5
'' as check_type_name6, -- 辅助核算项目6
'' as check_type_name7, -- 辅助核算项目7
'' as check_type_name8, -- 辅助核算项目8
'' as org_code, -- 单位编码
'' as org_name, -- 单位名称
'' as branch_code, -- 院区编码
'' as branch_name -- 院区名称
from GL_KMXX
<trim prefix="where" prefixOverrides="and">
<if test="acct_year != null and acct_year != ''"> and acct_year like '%${acct_year}%' </if>
<if test="acct_subj_code != null and acct_subj_code != ''"> and acct_subj_code like '%${acct_subj_code}%' </if>
<if test="acct_subj_name != null and acct_subj_name != ''"> and acct_subj_name like '%${acct_subj_name}%' </if>
<if test="supper_code != null and supper_code != ''"> and supper_code like '%${supper_code}%' </if>
<if test="subj_level != null and subj_level != ''"> and subj_level like '%${subj_level}%' </if>
<if test="is_last != null and is_last != ''"> and is_last like '%${is_last}%' </if>
<if test="subj_type_code != null and subj_type_code != ''"> and subj_type_code like '%${subj_type_code}%' </if>
<if test="subj_type_name != null and subj_type_name != ''"> and subj_type_name like '%${subj_type_name}%' </if>
<if test="direction != null and direction != ''"> and direction like '%${direction}%' </if>
<if test="is_cash != null and is_cash != ''"> and is_cash like '%${is_cash}%' </if>
<if test="subj_nature_code != null and subj_nature_code != ''"> and subj_nature_code like '%${subj_nature_code}%' </if>
<if test="is_check != null and is_check != ''"> and is_check like '%${is_check}%' </if>
<if test="is_stop != null and is_stop != ''"> and is_stop like '%${is_stop}%' </if>
<if test="budg_subj_code != null and budg_subj_code != ''"> and budg_subj_code like '%${budg_subj_code}%' </if>
<if test="budg_subj_name != null and budg_subj_name != ''"> and budg_subj_name like '%${budg_subj_name}%' </if>
<if test="check_type_name1 != null and check_type_name1 != ''"> and check_type_name1 like '%${check_type_name1}%' </if>
<if test="check_type_name2 != null and check_type_name2 != ''"> and check_type_name2 like '%${check_type_name2}%' </if>
<if test="check_type_name3 != null and check_type_name3 != ''"> and check_type_name3 like '%${check_type_name3}%' </if>
<if test="check_type_name4 != null and check_type_name4 != ''"> and check_type_name4 like '%${check_type_name4}%' </if>
<if test="check_type_name5 != null and check_type_name5 != ''"> and check_type_name5 like '%${check_type_name5}%' </if>
<if test="check_type_name6 != null and check_type_name6 != ''"> and check_type_name6 like '%${check_type_name6}%' </if>
<if test="check_type_name7 != null and check_type_name7 != ''"> and check_type_name7 like '%${check_type_name7}%' </if>
<if test="check_type_name8 != null and check_type_name8 != ''"> and check_type_name8 like '%${check_type_name8}%' </if>
<if test="org_code != null and org_code != ''"> and org_code like '%${org_code}%' </if>
<if test="org_name != null and org_name != ''"> and org_name like '%${org_name}%' </if>
<if test="branch_code != null and branch_code != ''"> and branch_code like '%${branch_code}%' </if>
<if test="branch_name != null and branch_name != ''"> and branch_name like '%${branch_name}%' </if>
<if test="acct_year != null and acct_year != ''"> and kjnd like '%${acct_year}%' </if>
<if test="acct_subj_code != null and acct_subj_code != ''"> and kmdm like '%${acct_subj_code}%' </if>
<if test="acct_subj_name != null and acct_subj_name != ''"> and kmmc like '%${acct_subj_name}%' </if>
</trim>
</select>
</mapper>