Compare commits
2 Commits
926c2f0bda
...
67ab11cddc
Author | SHA1 | Date |
---|---|---|
|
67ab11cddc | |
|
dea87559c8 |
|
@ -3,6 +3,8 @@ package com.hzya.frame.voucher.ae.comf.bd.controller;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao;
|
||||||
|
import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity;
|
||||||
import com.hzya.frame.mdm.mdmModule.service.IMdmModuleService;
|
import com.hzya.frame.mdm.mdmModule.service.IMdmModuleService;
|
||||||
import com.hzya.frame.voucher.ae.comf.bd.dao.*;
|
import com.hzya.frame.voucher.ae.comf.bd.dao.*;
|
||||||
import com.hzya.frame.voucher.ae.comf.bd.entity.*;
|
import com.hzya.frame.voucher.ae.comf.bd.entity.*;
|
||||||
|
@ -39,6 +41,8 @@ public class BdController extends DefaultController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMdmModuleService mdmModuleService;
|
private IMdmModuleService mdmModuleService;
|
||||||
|
@Autowired
|
||||||
|
private IMdmModuleDao mdmModuleDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMdmDbFiledVODAO mdmDbFiledVODAO;
|
private IMdmDbFiledVODAO mdmDbFiledVODAO;
|
||||||
|
@ -223,6 +227,79 @@ public class BdController extends DefaultController {
|
||||||
return getFailureMessageEntity(e.getMessage());
|
return getFailureMessageEntity(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询基础档案表bd_bdinfo
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/queryBdInfo", method = RequestMethod.POST)
|
||||||
|
public JsonResultEntity queryBdInfo(@RequestBody BdBdinfoEntity entity) {
|
||||||
|
try {
|
||||||
|
List<BdBdinfoEntity> list = mdmDBQueryVODAO.queryBdBdinfoList(entity);
|
||||||
|
return getSuccessMessageEntity("请求成功", list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return getFailureMessageEntity(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询辅助核算关联的档案
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/queryBdInfoBySubjass", method = RequestMethod.POST)
|
||||||
|
public JsonResultEntity queryBdInfoBySubjass(@RequestBody BdAccassitemVO entity) {
|
||||||
|
try {
|
||||||
|
List<BdAccassitemVO> list = mdmDBQueryVODAO.queryBdInfoBySubjass(entity);
|
||||||
|
|
||||||
|
return getSuccessMessageEntity("请求成功", list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return getFailureMessageEntity(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询辅助核算关联的档案-事项分录可选
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/queryBdInfoBySubjassFilter", method = RequestMethod.POST)
|
||||||
|
public JsonResultEntity queryBdInfoBySubjassFilter(@RequestBody BdAccassitemVO entity) {
|
||||||
|
try {
|
||||||
|
List<BdAccassitemVO> all = new ArrayList<>();
|
||||||
|
//查询所有关联
|
||||||
|
List<BdAccassitemVO> list = mdmDBQueryVODAO.queryBdInfoBySubjass(entity);
|
||||||
|
//查询现有的档案
|
||||||
|
List<MdmModuleEntity> query = mdmModuleDao.queryMdm(null);
|
||||||
|
System.out.println(query);
|
||||||
|
for (BdAccassitemVO bdBdinfoEntity : list) {
|
||||||
|
for (MdmModuleEntity mdmModuleEntity : query) {
|
||||||
|
if (bdBdinfoEntity.getPkAccassitem().equals(mdmModuleEntity.getU8cDbPk())
|
||||||
|
|| bdBdinfoEntity.getPkAccassitem().equals(mdmModuleEntity.getNccDbPk())
|
||||||
|
|| bdBdinfoEntity.getPkAccassitem().equals(mdmModuleEntity.getYsDbPk())) {
|
||||||
|
all.add(bdBdinfoEntity);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getSuccessMessageEntity("请求成功", all);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return getFailureMessageEntity(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// *
|
||||||
|
// */
|
||||||
|
// @RequestMapping(value = "/", method = RequestMethod.POST)
|
||||||
|
// public JsonResultEntity (@RequestBody entity) {
|
||||||
|
// try {
|
||||||
|
// List<> list = mdmDBQueryVODAO.(entity);
|
||||||
|
// return getSuccessMessageEntity("请求成功", list);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// return getFailureMessageEntity(e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package com.hzya.frame.voucher.ae.comf.bd.dao;
|
package com.hzya.frame.voucher.ae.comf.bd.dao;
|
||||||
|
|
||||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||||
import com.hzya.frame.voucher.ae.comf.bd.entity.vo.CashFlowVO;
|
import com.hzya.frame.voucher.ae.comf.bd.entity.vo.*;
|
||||||
import com.hzya.frame.voucher.ae.comf.bd.entity.vo.GlSubrelationVO;
|
|
||||||
import com.hzya.frame.voucher.ae.comf.bd.entity.vo.MdmDBQueryVO;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -15,4 +13,6 @@ public interface IMdmDBQueryVODAO extends IBaseDao<MdmDBQueryVO, String> {
|
||||||
List<Map<String, Object>> queryMdmDb(MdmDBQueryVO u8CQueryVO);
|
List<Map<String, Object>> queryMdmDb(MdmDBQueryVO u8CQueryVO);
|
||||||
List<CashFlowVO> queryCashflowVO(CashFlowVO cashFlowVO);
|
List<CashFlowVO> queryCashflowVO(CashFlowVO cashFlowVO);
|
||||||
List<GlSubrelationVO> queryGlsubrelationVO(GlSubrelationVO glSubrelationVO);
|
List<GlSubrelationVO> queryGlsubrelationVO(GlSubrelationVO glSubrelationVO);
|
||||||
|
List<BdBdinfoEntity> queryBdBdinfoList(BdBdinfoEntity entity);
|
||||||
|
List<BdAccassitemVO> queryBdInfoBySubjass(BdAccassitemVO entity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,7 @@ package com.hzya.frame.voucher.ae.comf.bd.dao.impl;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||||
import com.hzya.frame.voucher.ae.comf.bd.dao.IMdmDBQueryVODAO;
|
import com.hzya.frame.voucher.ae.comf.bd.dao.IMdmDBQueryVODAO;
|
||||||
import com.hzya.frame.voucher.ae.comf.bd.entity.vo.CashFlowVO;
|
import com.hzya.frame.voucher.ae.comf.bd.entity.vo.*;
|
||||||
import com.hzya.frame.voucher.ae.comf.bd.entity.vo.GlSubrelationVO;
|
|
||||||
import com.hzya.frame.voucher.ae.comf.bd.entity.vo.MdmDBQueryVO;
|
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -36,4 +34,17 @@ public class MdmDBQueryVODAOImpl extends MybatisGenericDao<MdmDBQueryVO, String>
|
||||||
List<GlSubrelationVO> glSubrelationVOS =(List<GlSubrelationVO>) selectList("com.hzya.frame.voucher.ae.comf.bd.dao.impl.MdmDBQueryVODAOImpl.queryGlsubrelationVO", glSubrelationVO);
|
List<GlSubrelationVO> glSubrelationVOS =(List<GlSubrelationVO>) selectList("com.hzya.frame.voucher.ae.comf.bd.dao.impl.MdmDBQueryVODAOImpl.queryGlsubrelationVO", glSubrelationVO);
|
||||||
return glSubrelationVOS;
|
return glSubrelationVOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BdBdinfoEntity> queryBdBdinfoList(BdBdinfoEntity entity) {
|
||||||
|
List<BdBdinfoEntity> list =(List<BdBdinfoEntity>) selectList("com.hzya.frame.voucher.ae.comf.bd.dao.impl.MdmDBQueryVODAOImpl.queryBdBdinfoList", entity);
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BdAccassitemVO> queryBdInfoBySubjass(BdAccassitemVO entity) {
|
||||||
|
List<BdAccassitemVO> list =(List<BdAccassitemVO>) selectList("com.hzya.frame.voucher.ae.comf.bd.dao.impl.MdmDBQueryVODAOImpl.queryBdInfoBySubjass", entity);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.hzya.frame.voucher.ae.comf.bd.entity.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zydd on 2025-06-25 10:20
|
||||||
|
* 会计辅助核算项目
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BdAccassitemVO {
|
||||||
|
private String pkAccassitem;
|
||||||
|
private String code;
|
||||||
|
private String name;
|
||||||
|
private String pkDefdef;
|
||||||
|
private String classid;
|
||||||
|
private String tablename;
|
||||||
|
private String tablepkname;
|
||||||
|
private String dr;
|
||||||
|
private String ts;
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.hzya.frame.voucher.ae.comf.bd.entity.vo;
|
||||||
|
|
||||||
|
import com.hzya.frame.web.entity.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zydd on 2025-06-20 08:49
|
||||||
|
* 基础数据:基础数据资源表 mdm_bd_bdinfo
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BdBdinfoEntity extends BaseEntity {
|
||||||
|
/** 基础数据主键 */
|
||||||
|
private String pkDdinfo;
|
||||||
|
/** 基础数据编码 */
|
||||||
|
private String bdcode;
|
||||||
|
/** 基础数据名称 */
|
||||||
|
private String bdname;
|
||||||
|
/** 公司主键 */
|
||||||
|
private String pkCorp;
|
||||||
|
/** 基本档案表名 */
|
||||||
|
private String basedoctablename;
|
||||||
|
/** 基本表主键 */
|
||||||
|
private String basedoctablepkname;
|
||||||
|
/** 是否自定义档案 */
|
||||||
|
private String isdef;
|
||||||
|
/** 自定义档案主键 */
|
||||||
|
private String pkDefdef;
|
||||||
|
/** 参照节点名 */
|
||||||
|
private String refnodename;
|
||||||
|
/** 对应表名 */
|
||||||
|
private String tablename;
|
||||||
|
/** 对应主键名 */
|
||||||
|
private String tablepkname;
|
||||||
|
/** */
|
||||||
|
private String dr;
|
||||||
|
/** */
|
||||||
|
private String ts;
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.hzya.frame.voucher.ae.comf.bd.entity.vo;
|
||||||
|
|
||||||
|
import com.hzya.frame.web.entity.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zydd on 2025-06-20 09:45
|
||||||
|
* 辅助核算关联的基础档案表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BdSubjassBdInfoVO extends BaseEntity {
|
||||||
|
private String pk_subjass;
|
||||||
|
private String pk_corp;
|
||||||
|
private String pk_glorgbook;
|
||||||
|
private String pk_bdinfo;
|
||||||
|
/** 基础数据编码 */
|
||||||
|
private String bdcode;
|
||||||
|
/** 基础数据名称 */
|
||||||
|
private String bdname;
|
||||||
|
private String pk_accsubj;
|
||||||
|
private String isnonleafused;
|
||||||
|
private String isempty;
|
||||||
|
private String dr;
|
||||||
|
private String ts;
|
||||||
|
}
|
|
@ -31,9 +31,10 @@ public class GlSubrelationVO {
|
||||||
/** 借方科目编码 */
|
/** 借方科目编码 */
|
||||||
private String jsubjcode;
|
private String jsubjcode;
|
||||||
/** 借方科目名称 */
|
/** 借方科目名称 */
|
||||||
private String jsubjname;
|
private String jdispname;
|
||||||
/** 借方辅助核算 */
|
/** 借方辅助核算 */
|
||||||
private String dfreevalueid;
|
private String dfreevalueid;
|
||||||
|
private String dfreevaluename;
|
||||||
/** 借方默认 */
|
/** 借方默认 */
|
||||||
private String isdd;
|
private String isdd;
|
||||||
|
|
||||||
|
@ -43,9 +44,10 @@ public class GlSubrelationVO {
|
||||||
/** 贷方科目编码 */
|
/** 贷方科目编码 */
|
||||||
private String dsubjcode;
|
private String dsubjcode;
|
||||||
/** 贷方科目名称 */
|
/** 贷方科目名称 */
|
||||||
private String dsubjname;
|
private String ddispname;
|
||||||
/** 贷方辅助核算 */
|
/** 贷方辅助核算 */
|
||||||
private String cfreevalueid;
|
private String cfreevalueid;
|
||||||
|
private String cfreevaluename;
|
||||||
/** 贷方默认*/
|
/** 贷方默认*/
|
||||||
private String iscd;
|
private String iscd;
|
||||||
|
|
||||||
|
|
|
@ -75,11 +75,66 @@
|
||||||
LEFT JOIN mdm_bd_accsubj accsubjd ON subrelation.pk_creditsubject=accsubjd.pk_accsubj
|
LEFT JOIN mdm_bd_accsubj accsubjd ON subrelation.pk_creditsubject=accsubjd.pk_accsubj
|
||||||
WHERE
|
WHERE
|
||||||
1=1
|
1=1
|
||||||
|
and subrelation.dr != 1
|
||||||
<if test="pkCashflow != null and pkCashflow != ''">AND subrelation.pk_cashflow = #{pkCashflow}</if>
|
<if test="pkCashflow != null and pkCashflow != ''">AND subrelation.pk_cashflow = #{pkCashflow}</if>
|
||||||
<if test="pkGlorgbook != null and pkGlorgbook != ''">AND subrelation.pk_glorgbook = #{pkGlorgbook}</if>
|
<if test="pkGlorgbook != null and pkGlorgbook != ''">AND subrelation.pk_glorgbook = #{pkGlorgbook}</if>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
cashflow.cfitemcode ASC
|
cashflow.cfitemcode ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<select id="queryBdBdinfoList" parameterType="com.hzya.frame.voucher.ae.comf.bd.entity.vo.BdBdinfoEntity" resultType="com.hzya.frame.voucher.ae.comf.bd.entity.vo.BdBdinfoEntity">
|
||||||
|
SELECT
|
||||||
|
pk_bdinfo as pkDdinfo,
|
||||||
|
pk_corp as pkCorp,
|
||||||
|
basedoctablename as basedoctablename,
|
||||||
|
basedoctablepkname as basedoctablepkname,
|
||||||
|
bdcode as bdcode,
|
||||||
|
bdname as bdname,
|
||||||
|
isdef as isdef,
|
||||||
|
pk_defdef as pkDefdef,
|
||||||
|
refnodename as refnodename,
|
||||||
|
tablename as tablename,
|
||||||
|
tablepkname as tablepkname,
|
||||||
|
dr as dr,
|
||||||
|
ts as ts
|
||||||
|
FROM
|
||||||
|
mdm_bd_bdinfo
|
||||||
|
where
|
||||||
|
dr != 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- <select id="queryBdInfoBySubjass" parameterType="com.hzya.frame.voucher.ae.comf.bd.entity.vo.BdBdinfoEntity" resultType="com.hzya.frame.voucher.ae.comf.bd.entity.vo.BdBdinfoEntity">-->
|
||||||
|
<!-- SELECT-->
|
||||||
|
<!-- pk_bdinfo as pkDdinfo,-->
|
||||||
|
<!-- pk_corp as pkCorp,-->
|
||||||
|
<!-- basedoctablename as basedoctablename,-->
|
||||||
|
<!-- basedoctablepkname as basedoctablepkname,-->
|
||||||
|
<!-- bdcode as bdcode,-->
|
||||||
|
<!-- bdname as bdname,-->
|
||||||
|
<!-- isdef as isdef,-->
|
||||||
|
<!-- pk_defdef as pkDefdef,-->
|
||||||
|
<!-- refnodename as refnodename,-->
|
||||||
|
<!-- tablename as tablename,-->
|
||||||
|
<!-- tablepkname as tablepkname,-->
|
||||||
|
<!-- dr as dr,-->
|
||||||
|
<!-- ts as ts-->
|
||||||
|
<!-- FROM-->
|
||||||
|
<!-- mdm_bd_bdinfo-->
|
||||||
|
<!-- WHERE-->
|
||||||
|
<!-- dr != 1-->
|
||||||
|
<!-- AND pk_bdinfo IN (-->
|
||||||
|
<!-- SELECT-->
|
||||||
|
<!-- DISTINCT pk_bdinfo-->
|
||||||
|
<!-- FROM-->
|
||||||
|
<!-- mdm_bd_subjass)-->
|
||||||
|
<!-- </select>-->
|
||||||
|
|
||||||
|
|
||||||
|
<select id="queryBdInfoBySubjass" parameterType="com.hzya.frame.voucher.ae.comf.bd.entity.vo.BdAccassitemVO" resultType="com.hzya.frame.voucher.ae.comf.bd.entity.vo.BdAccassitemVO">
|
||||||
|
SELECT pk_accassitem,code,name,pk_defdef,classid,tablename,tablepkname,dr,ts FROM mdm_bd_accassitem
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
@ -66,5 +66,15 @@ public class MdmFileMappingController extends DefaultController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/queryMdmAndFiledssByMdmId", method = RequestMethod.POST)
|
||||||
|
public JsonResultEntity queryMdmAndFiledssByMdmId(@RequestBody MdmModuleDbEntity entity) {
|
||||||
|
try {
|
||||||
|
MdmModuleDbEntity all = mdmService.queryMdmAndFiledssByMdmId(entity);
|
||||||
|
return getSuccessMessageEntity("请求成功", all);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return getFailureMessageEntity(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,4 +10,6 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface IMdmService {
|
public interface IMdmService {
|
||||||
List<MdmModuleDbEntity> queryMdmAndFiledsByMdmId(MdmModuleDbEntity entity);
|
List<MdmModuleDbEntity> queryMdmAndFiledsByMdmId(MdmModuleDbEntity entity);
|
||||||
|
|
||||||
|
MdmModuleDbEntity queryMdmAndFiledssByMdmId(MdmModuleDbEntity entity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,22 @@
|
||||||
package com.hzya.frame.voucher.ae.comf.module.service.impl;
|
package com.hzya.frame.voucher.ae.comf.module.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.mdm.mdmModule.service.IMdmModuleService;
|
||||||
import com.hzya.frame.mdm.mdmModuleDb.dao.IMdmModuleDbDao;
|
import com.hzya.frame.mdm.mdmModuleDb.dao.IMdmModuleDbDao;
|
||||||
import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity;
|
import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity;
|
||||||
import com.hzya.frame.mdm.mdmModuleDbFileds.dao.IMdmModuleDbFiledsDao;
|
import com.hzya.frame.mdm.mdmModuleDbFileds.dao.IMdmModuleDbFiledsDao;
|
||||||
import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity;
|
import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity;
|
||||||
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao.IMdmModuleDbFiledsRuleDao;
|
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao.IMdmModuleDbFiledsRuleDao;
|
||||||
|
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity;
|
||||||
import com.hzya.frame.voucher.ae.comf.module.service.IMdmService;
|
import com.hzya.frame.voucher.ae.comf.module.service.IMdmService;
|
||||||
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by zydd on 2025-05-27 15:06
|
* Created by zydd on 2025-05-27 15:06
|
||||||
|
@ -19,18 +24,22 @@ import java.util.List;
|
||||||
@Service
|
@Service
|
||||||
public class MdmServiceImpl implements IMdmService {
|
public class MdmServiceImpl implements IMdmService {
|
||||||
|
|
||||||
|
private int i = 0;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMdmModuleDbDao mdmModuleDbDao;
|
private IMdmModuleDbDao mdmModuleDbDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMdmModuleDbFiledsDao mdmModuleDbFiledsDao;
|
private IMdmModuleDbFiledsDao mdmModuleDbFiledsDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMdmModuleDbFiledsRuleDao mdmModuleDbFiledsRuleDao;
|
private IMdmModuleDbFiledsRuleDao mdmModuleDbFiledsRuleDao;
|
||||||
|
@Autowired
|
||||||
|
private IMdmModuleService mdmModuleService;
|
||||||
|
|
||||||
|
|
||||||
//根据单据id查询表以及相关字段
|
//根据单据id查询表以及相关字段
|
||||||
@Override
|
@Override
|
||||||
public List<MdmModuleDbEntity> queryMdmAndFiledsByMdmId(MdmModuleDbEntity entity) {
|
public List<MdmModuleDbEntity> queryMdmAndFiledsByMdmId(MdmModuleDbEntity entity) {
|
||||||
Assert.notNull(entity.getMdmId(),"根据");
|
Assert.notNull(entity.getMdmId(), "mdmId不能为空");
|
||||||
List<MdmModuleDbEntity> res = new ArrayList<>();
|
List<MdmModuleDbEntity> res = new ArrayList<>();
|
||||||
//查询单据
|
//查询单据
|
||||||
List<MdmModuleDbEntity> mdmModuleDbEntityList = mdmModuleDbDao.query(entity);
|
List<MdmModuleDbEntity> mdmModuleDbEntityList = mdmModuleDbDao.query(entity);
|
||||||
|
@ -48,4 +57,95 @@ public class MdmServiceImpl implements IMdmService {
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询字段rules,查询是否关联别的表
|
||||||
|
*
|
||||||
|
* @param entity
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public MdmModuleDbEntity queryMdmAndFiledssByMdmId(MdmModuleDbEntity entity) {
|
||||||
|
i = 0;
|
||||||
|
List<MdmModuleDbEntity> mdmModuleDbEntityList = queryMdmAndFiledsByMdmId(entity);
|
||||||
|
if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MdmModuleDbEntity mdmModuleDbEntity = mdmModuleDbEntityList.get(0);
|
||||||
|
List<MdmModuleDbFiledsEntity> sublistMdmModuleDbFileds = mdmModuleDbEntity.getSublistMdmModuleDbFileds();
|
||||||
|
//查询每个字段的rule
|
||||||
|
List<MdmModuleDbFiledsEntity> dbEntities = new ArrayList<>();
|
||||||
|
if (sublistMdmModuleDbFileds != null && sublistMdmModuleDbFileds.size() > 0) {
|
||||||
|
for (int i = 0; i < sublistMdmModuleDbFileds.size(); i++) {
|
||||||
|
if ("1".equals(sublistMdmModuleDbFileds.get(i).getViewType())) {
|
||||||
|
dbEntities.add(sublistMdmModuleDbFileds.get(i));
|
||||||
|
MdmModuleDbFiledsRuleEntity ruleEntity = new MdmModuleDbFiledsRuleEntity();
|
||||||
|
ruleEntity.setMdmId(sublistMdmModuleDbFileds.get(i).getMdmId());
|
||||||
|
ruleEntity.setFiledId(sublistMdmModuleDbFileds.get(i).getId());
|
||||||
|
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(ruleEntity);
|
||||||
|
sublistMdmModuleDbFileds.get(i).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRuleEntities);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mdmModuleDbEntity.setSublistMdmModuleDbFileds(dbEntities);
|
||||||
|
|
||||||
|
//根据rule再查询关联的数据
|
||||||
|
for (MdmModuleDbFiledsEntity dbEntity : dbEntities) {
|
||||||
|
for (MdmModuleDbFiledsRuleEntity filedRule : dbEntity.getMdmModuleDbFiledsRules()) {
|
||||||
|
if ("typeOptionRuleForm".equals(filedRule.getFormName()) && "service".equals(filedRule.getRuleCode())) {
|
||||||
|
System.out.println(filedRule.getRuleValue());
|
||||||
|
//根据db_name查询字段
|
||||||
|
queryFiledsByDbname(dbEntity, filedRule);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mdmModuleDbEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据db_name查询字段,注意循环嵌套
|
||||||
|
* 根据rule form_name='typeOptionRuleForm' rule_code='service'
|
||||||
|
*/
|
||||||
|
public void queryFiledsByDbname(MdmModuleDbFiledsEntity dbfiledEntity, MdmModuleDbFiledsRuleEntity filedRule) {
|
||||||
|
if (i >= 3) {
|
||||||
|
Assert.state(false, "字段:{},关联层数超过3层,请查询是否存在死循环嵌套", dbfiledEntity.getChName());
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
//查询表,再查询字段
|
||||||
|
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
|
||||||
|
mdmModuleDbEntity.setDbName(filedRule.getRuleValue());
|
||||||
|
List<MdmModuleDbEntity> mdmModuleDbEntityList = mdmModuleDbDao.query(mdmModuleDbEntity);
|
||||||
|
if (mdmModuleDbEntityList.size() == 0) {
|
||||||
|
Assert.state(false, "查询表:{}。失败", filedRule.getRuleValue());
|
||||||
|
}
|
||||||
|
dbfiledEntity.setMdmModuleDbEntity(mdmModuleDbEntityList.get(0));
|
||||||
|
|
||||||
|
//查询字段
|
||||||
|
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity();
|
||||||
|
mdmModuleDbFiledsEntity.setDbId(mdmModuleDbEntityList.get(0).getId());
|
||||||
|
List<MdmModuleDbFiledsEntity> filedList = mdmModuleDbFiledsDao.query(mdmModuleDbFiledsEntity);
|
||||||
|
|
||||||
|
//过滤viewType1
|
||||||
|
List<MdmModuleDbFiledsEntity> filedType1 = filedList.stream().filter(dbField -> "1".equals(dbField.getViewType())).collect(Collectors.toList());
|
||||||
|
mdmModuleDbEntityList.get(0).setSublistMdmModuleDbFileds(filedType1);
|
||||||
|
|
||||||
|
//查询rule
|
||||||
|
for (MdmModuleDbFiledsEntity dbFiledsEntity : filedType1) {
|
||||||
|
MdmModuleDbFiledsRuleEntity ruleEntity = new MdmModuleDbFiledsRuleEntity();
|
||||||
|
ruleEntity.setMdmId(dbFiledsEntity.getMdmId());
|
||||||
|
ruleEntity.setFiledId(dbFiledsEntity.getId());
|
||||||
|
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(ruleEntity);
|
||||||
|
dbFiledsEntity.setMdmModuleDbFiledsRules(mdmModuleDbFiledsRuleEntities);
|
||||||
|
}
|
||||||
|
|
||||||
|
//在再判断filedType1中的rule是否有form_name='typeOptionRuleForm' rule_code='service',有则嵌套,没有则返回
|
||||||
|
for (MdmModuleDbFiledsEntity dbFiledEntity : filedType1) {
|
||||||
|
for (MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRule : dbFiledEntity.getMdmModuleDbFiledsRules()) {
|
||||||
|
if ("typeOptionRuleForm".equals(mdmModuleDbFiledsRule.getFormName()) && "service".equals(mdmModuleDbFiledsRule.getRuleCode())) {
|
||||||
|
queryFiledsByDbname(dbFiledEntity, mdmModuleDbFiledsRule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,10 @@ public class MdmModuleEntity extends BaseEntity {
|
||||||
private String modifyUser;
|
private String modifyUser;
|
||||||
/** 0:预制 1:手工 */
|
/** 0:预制 1:手工 */
|
||||||
private String tag;
|
private String tag;
|
||||||
|
private String u8cDbPk;
|
||||||
|
private String nccDbPk;
|
||||||
|
private String ysDbPk;
|
||||||
|
|
||||||
|
|
||||||
public String getTag() {
|
public String getTag() {
|
||||||
return tag;
|
return tag;
|
||||||
|
@ -37,6 +41,30 @@ public class MdmModuleEntity extends BaseEntity {
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getU8cDbPk() {
|
||||||
|
return u8cDbPk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setU8cDbPk(String u8cDbPk) {
|
||||||
|
this.u8cDbPk = u8cDbPk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNccDbPk() {
|
||||||
|
return nccDbPk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNccDbPk(String nccDbPk) {
|
||||||
|
this.nccDbPk = nccDbPk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getYsDbPk() {
|
||||||
|
return ysDbPk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYsDbPk(String ysDbPk) {
|
||||||
|
this.ysDbPk = ysDbPk;
|
||||||
|
}
|
||||||
|
|
||||||
public String getMdmName() {
|
public String getMdmName() {
|
||||||
return mdmName;
|
return mdmName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
||||||
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
||||||
<result property="tag" column="tag" jdbcType="VARCHAR"/>
|
<result property="tag" column="tag" jdbcType="VARCHAR"/>
|
||||||
|
<result property="u8cDbPk" column="u8c_db_pk" jdbcType="VARCHAR"/>
|
||||||
|
<result property="nccDbPk" column="ncc_db_pk" jdbcType="VARCHAR"/>
|
||||||
|
<result property="ysDbPk" column="ys_db_pk" jdbcType="VARCHAR"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,6 +44,9 @@
|
||||||
,org_id
|
,org_id
|
||||||
,company_id
|
,company_id
|
||||||
,tag
|
,tag
|
||||||
|
,u8c_db_pk
|
||||||
|
,ncc_db_pk
|
||||||
|
,ys_db_pk
|
||||||
</sql>
|
</sql>
|
||||||
<!--通过ID获取数据 -->
|
<!--通过ID获取数据 -->
|
||||||
<select id="entity_get" resultMap="get-MdmModuleEntity-result">
|
<select id="entity_get" resultMap="get-MdmModuleEntity-result">
|
||||||
|
@ -70,6 +76,9 @@
|
||||||
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
|
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
|
||||||
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
|
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
|
||||||
<if test="tag != null and tag != ''">and tag = #{tag}</if>
|
<if test="tag != null and tag != ''">and tag = #{tag}</if>
|
||||||
|
<if test="u8cDbPk != null and u8cDbPk != ''">and u8c_db_pk = #{u8cDbPk}</if>
|
||||||
|
<if test="nccDbPk != null and nccDbPk != ''">and ncc_db_pk = #{nccDbPk}</if>
|
||||||
|
<if test="ysDbPk != null and ysDbPk != ''">and ys_db_pk = #{ysDbPk}</if>
|
||||||
and sts='Y'
|
and sts='Y'
|
||||||
</trim>
|
</trim>
|
||||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||||
|
@ -95,6 +104,9 @@
|
||||||
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
|
<if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
|
||||||
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
|
<if test="companyId != null and companyId != ''">and company_id = #{companyId}</if>
|
||||||
<if test="tag != null and tag != ''">and tag = #{tag}</if>
|
<if test="tag != null and tag != ''">and tag = #{tag}</if>
|
||||||
|
<if test="u8cDbPk != null and u8cDbPk != ''">and u8c_db_pk = #{u8cDbPk}</if>
|
||||||
|
<if test="nccDbPk != null and nccDbPk != ''">and ncc_db_pk = #{nccDbPk}</if>
|
||||||
|
<if test="ysDbPk != null and ysDbPk != ''">and ys_db_pk = #{ysDbPk}</if>
|
||||||
and sts='Y'
|
and sts='Y'
|
||||||
</trim>
|
</trim>
|
||||||
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
|
||||||
|
@ -182,6 +194,9 @@
|
||||||
<if test="companyId != null and companyId != ''">company_id ,</if>
|
<if test="companyId != null and companyId != ''">company_id ,</if>
|
||||||
<if test="sts == null ">sts,</if>
|
<if test="sts == null ">sts,</if>
|
||||||
<if test="tag == null ">tag ,</if>
|
<if test="tag == null ">tag ,</if>
|
||||||
|
<if test="u8cDbPk != null and u8cDbPk != ''">u8c_db_pk,</if>
|
||||||
|
<if test="nccDbPk != null and nccDbPk != ''">ncc_db_pk,</if>
|
||||||
|
<if test="ysDbPk != null and ysDbPk != ''">ys_db_pk,</if>
|
||||||
</trim>
|
</trim>
|
||||||
)values(
|
)values(
|
||||||
<trim suffix="" suffixOverrides=",">
|
<trim suffix="" suffixOverrides=",">
|
||||||
|
@ -202,6 +217,9 @@
|
||||||
<if test="companyId != null and companyId != ''">#{companyId} ,</if>
|
<if test="companyId != null and companyId != ''">#{companyId} ,</if>
|
||||||
<if test="sts == null ">'Y',</if>
|
<if test="sts == null ">'Y',</if>
|
||||||
<if test="tag == null ">'1',</if>
|
<if test="tag == null ">'1',</if>
|
||||||
|
<if test="u8cDbPk != null and u8cDbPk != ''">#{u8cDbPk},</if>
|
||||||
|
<if test="nccDbPk != null and nccDbPk != ''">#{nccDbPk},</if>
|
||||||
|
<if test="ysDbPk != null and ysDbPk != ''">#{ysDbPk},</if>
|
||||||
</trim>
|
</trim>
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
@ -289,6 +307,9 @@ where id = #{id}
|
||||||
<select id="queryMdm" resultMap="get-MdmModuleEntity-result"
|
<select id="queryMdm" resultMap="get-MdmModuleEntity-result"
|
||||||
parameterType="com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity">
|
parameterType="com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity">
|
||||||
select
|
select
|
||||||
|
a.u8c_db_pk as u8c_db_pk,
|
||||||
|
a.ncc_db_pk as ncc_db_pk,
|
||||||
|
a.ys_db_pk as ys_db_pk,
|
||||||
a.id as id,
|
a.id as id,
|
||||||
a.mdm_name as mdm_name,
|
a.mdm_name as mdm_name,
|
||||||
a.mdm_logo as mdm_logo,
|
a.mdm_logo as mdm_logo,
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.hzya.frame.mdm.mdmModuleDbFileds.entity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity;
|
||||||
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity;
|
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity;
|
||||||
import com.hzya.frame.web.entity.BaseEntity;
|
import com.hzya.frame.web.entity.BaseEntity;
|
||||||
|
|
||||||
|
@ -253,5 +254,18 @@ public class MdmModuleDbFiledsEntity extends BaseEntity {
|
||||||
public void setIsSysName(String isSysName) {
|
public void setIsSysName(String isSysName) {
|
||||||
this.isSysName = isSysName;
|
this.isSysName = isSysName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联的表
|
||||||
|
*/
|
||||||
|
private MdmModuleDbEntity mdmModuleDbEntity;
|
||||||
|
|
||||||
|
public MdmModuleDbEntity getMdmModuleDbEntity() {
|
||||||
|
return mdmModuleDbEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMdmModuleDbEntity(MdmModuleDbEntity mdmModuleDbEntity) {
|
||||||
|
this.mdmModuleDbEntity = mdmModuleDbEntity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue