Skip to content

Commit

Permalink
Support configuration template (apache#195)
Browse files Browse the repository at this point in the history
* conf template bug fix
* add special limit for param check
* configuration template code optimize
* EntranceRestfulApi code optimize
  • Loading branch information
casionone authored Jul 4, 2023
1 parent 6390aa7 commit ea38692
Show file tree
Hide file tree
Showing 15 changed files with 347 additions and 885 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ public Message status(
message = Message.ok();
message.setMethod("/api/entrance/" + id + "/status");
message.data("status", job.get().getState().toString()).data("execID", id);
if(job.get().getErrorResponse()!=null){
message.setMessage(job.get().getErrorResponse().message());
}
} else {
message =
Message.error(
Expand Down Expand Up @@ -660,7 +663,7 @@ public Message kill(
logger.error("kill job {} failed ", job.get().getId(), t);
message =
Message.error(
"An exception occurred while killing the job, kill failed(kill job的时候出现了异常,kill失败)",
"An exception occurred while killing the job, kill failed(kill job的时候出现了异常,kill失败) with error:"+t.getMessage(),
t);
message.setMethod("/api/entrance/" + id + "/kill");
message.setStatus(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,90 +19,14 @@

import org.apache.linkis.configuration.entity.ConfigKeyLimitForUser;

import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* linkis_ps_configuration_key_limit_for_user表的dao接口类 @Description
*
* @version 1.0
*/
/** for table linkis_ps_configuration_key_limit_for_user @Description */
public interface ConfigKeyLimitForUserMapper {

/**
* 根据主键删除数据库的记录
*
* @param id
*/
int deleteByPrimaryKey(Long id);

/**
* 新写入数据库记录
*
* @param configKeyLimitForUser
*/
int insert(ConfigKeyLimitForUser configKeyLimitForUser);

/**
* 批量插入记录,建议List一次不要超过1000条
*
* @param list
*/
int batchInsertList(List<ConfigKeyLimitForUser> list);

/**
* 动态字段,写入数据库记录
*
* @param configKeyLimitForUser
*/
int insertSelective(ConfigKeyLimitForUser configKeyLimitForUser);

/**
* 根据指定主键获取一条数据库记录
*
* @param id
*/
ConfigKeyLimitForUser selectByPrimaryKey(Long id);

/**
* 查询分页数据条数 - 示例方法
*
* @param id
*/
int selectCountByPage(Long id);

/**
* 查询分页数据列表 - 示例方法 public DataPage<ConfigKeyLimitForUser> selectByPage(Id id, int pageNo, int
* pageSize) { if (pageNo > 100) { pageNo = 100; } if (pageNo < 1) { pageNo = 1; } if (pageSize >
* 50) { pageSize = 50; } if (pageSize < 1) { pageSize = 1; } int totalCount =
* configKeyLimitForUserDAO.selectCountByPage(id); List<CreditLogEntity> list =
* configKeyLimitForUserDAO.selectListByPage(id, pageNo, pageSize);
* DataPage<ConfigKeyLimitForUser> dp = new DataPage<>(list, pageSize, pageNo, totalCount); return
* dp; }
*
* @param id
* @param pageNo
* @param pageSize
*/
List<ConfigKeyLimitForUser> selectListByPage(
@Param("id") Long id, @Param("pageNo") int pageNo, @Param("pageSize") int pageSize);

/**
* 动态字段,根据主键来更新符合条件的数据库记录
*
* @param configKeyLimitForUser
*/
int updateByPrimaryKeySelective(ConfigKeyLimitForUser configKeyLimitForUser);

/**
* 根据主键来更新符合条件的数据库记录
*
* @param configKeyLimitForUser
*/
int updateByPrimaryKey(ConfigKeyLimitForUser configKeyLimitForUser);

// === 下方为用户自定义模块,下次生成会保留 ===

int batchInsertOrUpdateList(List<ConfigKeyLimitForUser> list);
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,90 +18,17 @@
package org.apache.linkis.configuration.dao;

import org.apache.linkis.configuration.entity.TemplateConfigKey;
import org.apache.linkis.configuration.entity.TemplateConfigKeyVo;

import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* linkis_ps_configuration_template_config_key表的dao接口类 @Description
*
* @version 1.0
*/
/** The dao interface class of the linkis_ps_configuration_template_config_key table @Description */
public interface TemplateConfigKeyMapper {

/**
* 根据主键删除数据库的记录
*
* @param id
*/
int deleteByPrimaryKey(Long id);

/**
* 新写入数据库记录
*
* @param templateConfigKey
*/
int insert(TemplateConfigKey templateConfigKey);

/**
* 批量插入记录,建议List一次不要超过1000条
*
* @param list
*/
int batchInsertList(List<TemplateConfigKey> list);

/**
* 动态字段,写入数据库记录
*
* @param templateConfigKey
*/
int insertSelective(TemplateConfigKey templateConfigKey);

/**
* 根据指定主键获取一条数据库记录
*
* @param id
*/
TemplateConfigKey selectByPrimaryKey(Long id);

/**
* 查询分页数据条数 - 示例方法
*
* @param id
*/
int selectCountByPage(Long id);

/**
* 查询分页数据列表 - 示例方法 public DataPage<TemplateConfigKey> selectByPage(Id id, int pageNo, int
* pageSize) { if (pageNo > 100) { pageNo = 100; } if (pageNo < 1) { pageNo = 1; } if (pageSize >
* 50) { pageSize = 50; } if (pageSize < 1) { pageSize = 1; } int totalCount =
* templateConfigKeyDAO.selectCountByPage(id); List<CreditLogEntity> list =
* templateConfigKeyDAO.selectListByPage(id, pageNo, pageSize); DataPage<TemplateConfigKey> dp =
* new DataPage<>(list, pageSize, pageNo, totalCount); return dp; }
*
* @param id
* @param pageNo
* @param pageSize
*/
List<TemplateConfigKey> selectListByPage(
@Param("id") Long id, @Param("pageNo") int pageNo, @Param("pageSize") int pageSize);

/**
* 动态字段,根据主键来更新符合条件的数据库记录
*
* @param templateConfigKey
*/
int updateByPrimaryKeySelective(TemplateConfigKey templateConfigKey);

/**
* 根据主键来更新符合条件的数据库记录
*
* @param templateConfigKey
*/
int updateByPrimaryKey(TemplateConfigKey templateConfigKey);

// === 下方为用户自定义模块,下次生成会保留 ===
List<TemplateConfigKey> selectListByTemplateUuid(@Param("templateUuid") String templateUuid);

int deleteByTemplateUuidAndKeyIdList(
Expand All @@ -111,4 +38,10 @@ int deleteByTemplateUuidAndKeyIdList(

List<TemplateConfigKey> selectListByTemplateUuidList(
@Param("templateUuidList") List<String> templateUuidList);

List<TemplateConfigKeyVo> selectByLabelAndKeyIds(
@Param("label") String label, @Param("keyIdList") List<Long> keyIdList);

TemplateConfigKeyVo selectByLabelAndKeyId(
@Param("label") String label, @Param("keyId") Long keyId);
}
Loading

0 comments on commit ea38692

Please sign in to comment.