处理动态表单表名修改找不到字段问题

This commit is contained in:
wenc000 2020-06-14 17:20:38 +08:00
parent e98276f3e5
commit fc32cff25d
5 changed files with 42 additions and 0 deletions

View File

@ -46,6 +46,14 @@ public interface IDynamicConfigFormDao {
*/ */
void updateForm(Map<String, Object> params) throws UpdateException; void updateForm(Map<String, Object> params) throws UpdateException;
/**
* 修改表单中的表名
*
* @param params
* @throws UpdateException
*/
void updateFormTableName(Map<String, Object> params) throws UpdateException;
/** /**
* 表单详情 * 表单详情
* *
@ -63,4 +71,5 @@ public interface IDynamicConfigFormDao {
* @throws SearchException * @throws SearchException
*/ */
List<DynamicConfigFormDTO> listForm(Map<String, Object> params) throws SearchException; List<DynamicConfigFormDTO> listForm(Map<String, Object> params) throws SearchException;
} }

View File

@ -53,6 +53,15 @@ public interface IDynamicConfigFormService {
*/ */
SuccessResult updateForm(String id, DynamicConfigFormVO dynamicConfigFormVO) throws Exception; SuccessResult updateForm(String id, DynamicConfigFormVO dynamicConfigFormVO) throws Exception;
/**
* 修改表单中的表名
*
* @param newTableName
* @param oldTableName
* @throws UpdateException
*/
void updateFormTableName(String newTableName, String oldTableName) throws UpdateException;
/** /**
* 字段列表显示修改 * 字段列表显示修改
* *

View File

@ -66,6 +66,15 @@ public class DynamicConfigFormServiceImpl extends AbstractService implements IDy
return new SuccessResult(); return new SuccessResult();
} }
@Override
public void updateFormTableName(String newTableName, String oldTableName) throws UpdateException {
Map<String, Object> params = getHashMap(4);
params.put("newTableName", newTableName);
params.put("oldTableName", oldTableName);
setUpdateInfo(params);
dynamicConfigFormDao.updateFormTableName(params);
}
@Override @Override
public SuccessResult updateFieldListShow(String id, FieldShowVO fieldShowVO) throws UpdateException { public SuccessResult updateFieldListShow(String id, FieldShowVO fieldShowVO) throws UpdateException {
Map<String, Object> params = getHashMap(2); Map<String, Object> params = getHashMap(2);

View File

@ -116,8 +116,11 @@ public class DynamicConfigTableServiceImpl extends AbstractService implements ID
public SuccessResult updateTable(String id, DynamicConfigTableVO dynamicConfigTableVO) throws Exception { public SuccessResult updateTable(String id, DynamicConfigTableVO dynamicConfigTableVO) throws Exception {
Map<String, Object> params = HashMapUtil.beanToMap(dynamicConfigTableVO); Map<String, Object> params = HashMapUtil.beanToMap(dynamicConfigTableVO);
params.put("id", id); params.put("id", id);
DynamicConfigTableDTO dynamicConfigTableDTO = dynamicConfigTableDao.getTableById(params);
setUpdateInfo(params); setUpdateInfo(params);
dynamicConfigTableDao.updateTable(params); dynamicConfigTableDao.updateTable(params);
// 修改表单中的表名
dynamicConfigFormService.updateFormTableName(dynamicConfigTableVO.getTableName(), dynamicConfigTableDTO.getTableName());
return new SuccessResult(); return new SuccessResult();
} }

View File

@ -154,6 +154,18 @@
id = #{id} id = #{id}
</update> </update>
<!-- 修改表单中的表名 -->
<update id="updateFormTableName" parameterType="map">
UPDATE
dynamic_config_form
SET
table_name = #{newTableName},
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
table_name = #{oldTableName}
</update>
<!-- 表单详情 --> <!-- 表单详情 -->
<select id="getFormById" parameterType="map" resultMap="dynamicConfigFormDTO"> <select id="getFormById" parameterType="map" resultMap="dynamicConfigFormDTO">
SELECT SELECT