修改MDM方法,根据表名称获取字段,转换小写后传递数据
This commit is contained in:
parent
4b9e19ab81
commit
1b2fe8d78a
|
@ -24,7 +24,6 @@ import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao;
|
||||||
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
|
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
|
||||||
import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
|
import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
|
||||||
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
|
||||||
import com.hzya.frame.sysnew.application.script.dao.ISysApplicationScriptDao;
|
import com.hzya.frame.sysnew.application.script.dao.ISysApplicationScriptDao;
|
||||||
import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity;
|
import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity;
|
||||||
import com.hzya.frame.sysnew.grovy.service.IGroovyIntegrationService;
|
import com.hzya.frame.sysnew.grovy.service.IGroovyIntegrationService;
|
||||||
|
@ -47,11 +46,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主数据模版(MdmModule)表服务接口
|
* 主数据模版(MdmModule)表服务接口
|
||||||
|
@ -296,7 +291,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
|
|
||||||
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
|
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
|
||||||
if("2".equals(mdmModuleDbEntities.get(i).getDbType())){
|
if("2".equals(mdmModuleDbEntities.get(i).getDbType())){
|
||||||
Map<String,String> map = new HashMap<>();
|
Map<String,Object> map = new HashMap<>();
|
||||||
map.put("tableName",mdmModuleDbEntities.get(i).getDbName());
|
map.put("tableName",mdmModuleDbEntities.get(i).getDbName());
|
||||||
map.put("formmainId",object.getString("id"));
|
map.put("formmainId",object.getString("id"));
|
||||||
List<JSONObject> detail = mdmModuleDao.queryMdmSTDetail(map);
|
List<JSONObject> detail = mdmModuleDao.queryMdmSTDetail(map);
|
||||||
|
@ -1017,7 +1012,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
|
|
||||||
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
|
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
|
||||||
if("2".equals(mdmModuleDbEntities.get(i).getDbType())){
|
if("2".equals(mdmModuleDbEntities.get(i).getDbType())){
|
||||||
Map<String,String> map = new HashMap<>();
|
Map<String,Object> map = new HashMap<>();
|
||||||
map.put("tableName",mdmModuleDbEntities.get(i).getDbName());
|
map.put("tableName",mdmModuleDbEntities.get(i).getDbName());
|
||||||
map.put("formmainId",object.getString("id"));
|
map.put("formmainId",object.getString("id"));
|
||||||
List<JSONObject> detail = mdmModuleDao.queryMdmSTDetail(map);
|
List<JSONObject> detail = mdmModuleDao.queryMdmSTDetail(map);
|
||||||
|
|
|
@ -20,6 +20,8 @@ public class MdmQuery {
|
||||||
private List<String> returnField;
|
private List<String> returnField;
|
||||||
//明细表查询条件
|
//明细表查询条件
|
||||||
private List<MdmQuery> detailQueryCondition;
|
private List<MdmQuery> detailQueryCondition;
|
||||||
|
//小写字段
|
||||||
|
private List<String> fields;
|
||||||
|
|
||||||
public Integer getPageNum() {
|
public Integer getPageNum() {
|
||||||
return pageNum;
|
return pageNum;
|
||||||
|
@ -76,4 +78,12 @@ public class MdmQuery {
|
||||||
public void setMdmCode(Long mdmCode) {
|
public void setMdmCode(Long mdmCode) {
|
||||||
this.mdmCode = mdmCode;
|
this.mdmCode = mdmCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getFields() {
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFields(List<String> fields) {
|
||||||
|
this.fields = fields;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,10 +50,19 @@ public interface IMdmModuleDao extends IBaseDao<MdmModuleEntity, String> {
|
||||||
|
|
||||||
|
|
||||||
JSONObject queryMdmST(Map<String, Object> maps);
|
JSONObject queryMdmST(Map<String, Object> maps);
|
||||||
List<JSONObject> queryMdmSTDetail(Map<String, String> maps);
|
List<JSONObject> queryMdmSTDetail(Map<String, Object> maps);
|
||||||
|
|
||||||
List<JSONObject> queryMdmSTs(Map<String, Object> map);
|
List<JSONObject> queryMdmSTs(Map<String, Object> map);
|
||||||
|
|
||||||
void updateMdmSTs(Map<String, Object> updateMap);
|
void updateMdmSTs(Map<String, Object> updateMap);
|
||||||
|
/****
|
||||||
|
* 查询主数据字段
|
||||||
|
* @content:
|
||||||
|
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @date 2024-06-27 16:26
|
||||||
|
* @param
|
||||||
|
* @return java.util.List<java.lang.Object>
|
||||||
|
**/
|
||||||
|
List<String> queryMdMFields(Map<String, Object> maps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
package com.hzya.frame.mdm.mdmModule.dao.impl;
|
package com.hzya.frame.mdm.mdmModule.dao.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||||
import com.hzya.frame.mdm.entity.MdmDataDto;
|
import com.hzya.frame.mdm.entity.MdmDataDto;
|
||||||
import com.hzya.frame.mdm.entity.MdmDto;
|
import com.hzya.frame.mdm.entity.MdmDto;
|
||||||
import com.hzya.frame.mdm.entity.MdmQuery;
|
import com.hzya.frame.mdm.entity.MdmQuery;
|
||||||
import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity;
|
|
||||||
import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao;
|
import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao;
|
||||||
|
import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity;
|
||||||
import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity;
|
import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity;
|
||||||
import com.hzya.frame.sys.entity.FormmainDeleteDto;
|
import com.hzya.frame.sys.entity.FormmainDeleteDto;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -114,6 +114,10 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HashMap<String, Object>> queryMdmShowData(MdmQuery entity) {
|
public List<HashMap<String, Object>> queryMdmShowData(MdmQuery entity) {
|
||||||
|
HashMap<String, Object> maps = new HashMap<>();
|
||||||
|
maps.put("tableName",entity.getTableName());
|
||||||
|
List<String> fields = queryMdMFields(maps);
|
||||||
|
entity.setFields(fields);
|
||||||
List<HashMap<String, Object>> o = (List<HashMap<String, Object>>) super.selectList(getSqlIdPrifx() + "queryMdmShowData", entity);
|
List<HashMap<String, Object>> o = (List<HashMap<String, Object>>) super.selectList(getSqlIdPrifx() + "queryMdmShowData", entity);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
@ -151,6 +155,9 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject queryMdmST(Map<String, Object> maps) {
|
public JSONObject queryMdmST(Map<String, Object> maps) {
|
||||||
|
|
||||||
|
List<String> fields = queryMdMFields(maps);
|
||||||
|
maps.put("fields",fields);
|
||||||
JSONObject o = (JSONObject) super.selectOne(getSqlIdPrifx() + "queryMdmST", maps);
|
JSONObject o = (JSONObject) super.selectOne(getSqlIdPrifx() + "queryMdmST", maps);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
@ -166,7 +173,15 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<JSONObject> queryMdmSTDetail(Map<String, String> maps) {
|
public List<String> queryMdMFields(Map<String, Object> maps) {
|
||||||
|
List<String> o = (List<String>) super.selectList(getSqlIdPrifx() + "queryMdMFields", maps);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<JSONObject> queryMdmSTDetail(Map<String, Object> maps) {
|
||||||
|
List<String> fields = queryMdMFields(maps);
|
||||||
|
maps.put("fields", fields );
|
||||||
List<JSONObject> o = (List<JSONObject>) super.selectList(getSqlIdPrifx() + "queryMdmSTDetail", maps);
|
List<JSONObject> o = (List<JSONObject>) super.selectList(getSqlIdPrifx() + "queryMdmSTDetail", maps);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,22 +20,25 @@
|
||||||
<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"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 查询的字段-->
|
<!-- 查询的字段-->
|
||||||
<sql id="MdmModuleEntity_Base_Column_List">
|
<sql id="MdmModuleEntity_Base_Column_List">
|
||||||
id
|
id
|
||||||
,mdm_name
|
,mdm_name
|
||||||
,mdm_logo
|
,mdm_logo
|
||||||
,mdm_code
|
,mdm_code
|
||||||
,mdm_type
|
,mdm_type
|
||||||
,remark
|
,remark
|
||||||
,sorts
|
,sorts
|
||||||
,create_user_id
|
,create_user_id
|
||||||
,create_time
|
,create_time
|
||||||
,modify_user_id
|
,modify_user_id
|
||||||
,modify_time
|
,modify_time
|
||||||
,sts
|
,sts
|
||||||
,org_id
|
,org_id
|
||||||
,company_id
|
,company_id
|
||||||
</sql>
|
</sql>
|
||||||
<!--通过ID获取数据 -->
|
<!--通过ID获取数据 -->
|
||||||
<select id="entity_get" resultMap="get-MdmModuleEntity-result">
|
<select id="entity_get" resultMap="get-MdmModuleEntity-result">
|
||||||
|
@ -551,7 +554,10 @@ where id = #{id}
|
||||||
</trim>
|
</trim>
|
||||||
</if>
|
</if>
|
||||||
<if test="returnField == null or returnField.size == 0">
|
<if test="returnField == null or returnField.size == 0">
|
||||||
a.*
|
|
||||||
|
<foreach item="field" collection="fields" separator="," >
|
||||||
|
a.${field}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
from ${tableName} a
|
from ${tableName} a
|
||||||
<trim prefix="where" prefixOverrides="and">
|
<trim prefix="where" prefixOverrides="and">
|
||||||
|
@ -803,11 +809,23 @@ where id = #{id}
|
||||||
select count(1) from ${tableName} where sts='Y'
|
select count(1) from ${tableName} where sts='Y'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 根据表名称查询所有的字段,返回小写个是-->
|
||||||
|
<select id="queryMdMFields" resultType="String" parameterType="java.util.HashMap" >
|
||||||
|
SELECT
|
||||||
|
LOWER(COLUMN_NAME) as fileds
|
||||||
|
FROM
|
||||||
|
INFORMATION_SCHEMA. COLUMNS
|
||||||
|
WHERE
|
||||||
|
TABLE_NAME = #{tableName}
|
||||||
|
|
||||||
|
</select>
|
||||||
<!-- 分页查询列表 采用like格式 -->
|
<!-- 分页查询列表 采用like格式 -->
|
||||||
<select id="queryMdmST" resultType="com.alibaba.fastjson.JSONObject"
|
<select id="queryMdmST" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.util.HashMap">
|
||||||
parameterType="java.util.HashMap">
|
select
|
||||||
select * from ${tableName}
|
<foreach item="field" collection="fields" separator="," >
|
||||||
|
${field}
|
||||||
|
</foreach>
|
||||||
|
from ${tableName}
|
||||||
<trim prefix="where" prefixOverrides="and">
|
<trim prefix="where" prefixOverrides="and">
|
||||||
<if test="documentRule != null and documentRule !='' ">and document_rule = #{documentRule}</if>
|
<if test="documentRule != null and documentRule !='' ">and document_rule = #{documentRule}</if>
|
||||||
<if test="dataStatus != null and dataStatus !='' ">and data_status = #{dataStatus}</if>
|
<if test="dataStatus != null and dataStatus !='' ">and data_status = #{dataStatus}</if>
|
||||||
|
@ -875,7 +893,12 @@ where id = #{id}
|
||||||
<!-- 分页查询列表 采用like格式 -->
|
<!-- 分页查询列表 采用like格式 -->
|
||||||
<select id="queryMdmSTDetail" resultType="com.alibaba.fastjson.JSONObject"
|
<select id="queryMdmSTDetail" resultType="com.alibaba.fastjson.JSONObject"
|
||||||
parameterType="java.util.HashMap">
|
parameterType="java.util.HashMap">
|
||||||
select * from ${tableName} where sts='Y' and formmain_id = #{formmainId}
|
select
|
||||||
|
<foreach item="field" collection="fields" separator="," >
|
||||||
|
${field}
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
from ${tableName} where sts='Y' and formmain_id = #{formmainId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="updateMdmSTs" parameterType="java.util.HashMap">
|
<update id="updateMdmSTs" parameterType="java.util.HashMap">
|
||||||
|
|
|
@ -1700,7 +1700,7 @@ public class MdmServiceImpl implements IMdmService {
|
||||||
|
|
||||||
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
|
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
|
||||||
if ("2".equals(mdmModuleDbEntities.get(i).getDbType())) {
|
if ("2".equals(mdmModuleDbEntities.get(i).getDbType())) {
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("tableName", mdmModuleDbEntities.get(i).getDbName());
|
map.put("tableName", mdmModuleDbEntities.get(i).getDbName());
|
||||||
map.put("formmainId", object.getString("id"));
|
map.put("formmainId", object.getString("id"));
|
||||||
List<JSONObject> detail = mdmModuleDao.queryMdmSTDetail(map);
|
List<JSONObject> detail = mdmModuleDao.queryMdmSTDetail(map);
|
||||||
|
@ -2639,5 +2639,15 @@ public class MdmServiceImpl implements IMdmService {
|
||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
/***
|
||||||
|
* 查询所有的字段根据表名称
|
||||||
|
* @content:
|
||||||
|
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @date 2024-06-27 16:29
|
||||||
|
* @param
|
||||||
|
* @return java.util.List<com.alibaba.fastjson.JSONObject>
|
||||||
|
**/
|
||||||
|
private List<String> queryMdMFields(Map<String, Object> maps){
|
||||||
|
return mdmModuleDao.queryMdMFields(maps);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue