Browse Source

[Improvement-15744][parameter] project parameter add update time and update user id (#15745)

* project parameter add update time and update user id

* project parameter add comment operator user id and UT

* project parameter add ui
dev_wenjun_refactorMaster
小可耐 7 months ago committed by GitHub
parent
commit
920ac154cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectParameterServiceImpl.java
  2. 3
      dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectParameterServiceTest.java
  3. 8
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProjectParameter.java
  4. 14
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectParameterMapper.xml
  5. 1
      dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql
  6. 1
      dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql
  7. 1
      dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql
  8. 1
      dolphinscheduler-dao/src/main/resources/sql/upgrade/3.2.2_schema/mysql/dolphinscheduler_ddl.sql
  9. 2
      dolphinscheduler-dao/src/main/resources/sql/upgrade/3.2.2_schema/postgresql/dolphinscheduler_ddl.sql
  10. 2
      dolphinscheduler-ui/src/locales/en_US/project.ts
  11. 2
      dolphinscheduler-ui/src/locales/zh_CN/project.ts
  12. 10
      dolphinscheduler-ui/src/views/projects/parameter/use-table.ts

2
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectParameterServiceImpl.java

@ -155,6 +155,8 @@ public class ProjectParameterServiceImpl extends BaseServiceImpl implements Proj
projectParameter.setParamName(projectParameterName); projectParameter.setParamName(projectParameterName);
projectParameter.setParamValue(projectParameterValue); projectParameter.setParamValue(projectParameterValue);
projectParameter.setUpdateTime(new Date());
projectParameter.setOperator(loginUser.getId());
if (projectParameterMapper.updateById(projectParameter) > 0) { if (projectParameterMapper.updateById(projectParameter) > 0) {
log.info("Project parameter is updated and id is :{}", projectParameter.getId()); log.info("Project parameter is updated and id is :{}", projectParameter.getId());

3
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectParameterServiceTest.java

@ -98,6 +98,9 @@ public class ProjectParameterServiceTest {
Mockito.when(projectParameterMapper.updateById(Mockito.any())).thenReturn(1); Mockito.when(projectParameterMapper.updateById(Mockito.any())).thenReturn(1);
result = projectParameterService.updateProjectParameter(loginUser, projectCode, 1, "key1", "value"); result = projectParameterService.updateProjectParameter(loginUser, projectCode, 1, "key1", "value");
Assertions.assertEquals(Status.SUCCESS.getCode(), result.getCode()); Assertions.assertEquals(Status.SUCCESS.getCode(), result.getCode());
ProjectParameter projectParameter = (ProjectParameter) result.getData();
Assertions.assertNotNull(projectParameter.getOperator());
Assertions.assertNotNull(projectParameter.getUpdateTime());
} }
@Test @Test

8
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProjectParameter.java

@ -42,6 +42,8 @@ public class ProjectParameter {
@TableField("user_id") @TableField("user_id")
private Integer userId; private Integer userId;
private Integer operator;
private long code; private long code;
@TableField("project_code") @TableField("project_code")
@ -56,4 +58,10 @@ public class ProjectParameter {
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;
@TableField(exist = false)
private String createUser;
@TableField(exist = false)
private String modifyUser;
} }

14
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectParameterMapper.xml

@ -19,7 +19,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.ProjectParameterMapper"> <mapper namespace="org.apache.dolphinscheduler.dao.mapper.ProjectParameterMapper">
<sql id="baseSql"> <sql id="baseSql">
id, param_name, param_value, code, project_code, user_id, create_time, update_time id, param_name, param_value, code, project_code, user_id, operator, create_time, update_time
</sql> </sql>
<select id="queryByCode" resultType="org.apache.dolphinscheduler.dao.entity.ProjectParameter"> <select id="queryByCode" resultType="org.apache.dolphinscheduler.dao.entity.ProjectParameter">
@ -51,11 +51,15 @@
<select id="queryProjectParameterListPaging" resultType="org.apache.dolphinscheduler.dao.entity.ProjectParameter"> <select id="queryProjectParameterListPaging" resultType="org.apache.dolphinscheduler.dao.entity.ProjectParameter">
select select
<include refid="baseSql"/> pp.id, param_name, param_value, code, project_code, user_id, operator, pp.create_time, pp.update_time,
from t_ds_project_parameter u.user_name as create_user,
u2.user_name as modify_user
from t_ds_project_parameter pp
left join t_ds_user u on pp.user_id = u.id
left join t_ds_user u2 on pp.operator = u2.id
where project_code = #{projectCode} where project_code = #{projectCode}
<if test="projectParameterIds != null and projectParameterIds.size() > 0"> <if test="projectParameterIds != null and projectParameterIds.size() > 0">
and id in and pp.id in
<foreach item="id" index="index" collection="projectParameterIds" open="(" separator="," close=")"> <foreach item="id" index="index" collection="projectParameterIds" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
@ -65,7 +69,7 @@
OR param_value LIKE concat('%', #{searchName}, '%') OR param_value LIKE concat('%', #{searchName}, '%')
) )
</if> </if>
order by update_time desc order by pp.update_time desc
</select> </select>
<select id="queryByProjectCode" resultType="org.apache.dolphinscheduler.dao.entity.ProjectParameter"> <select id="queryByProjectCode" resultType="org.apache.dolphinscheduler.dao.entity.ProjectParameter">

1
dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql

@ -670,6 +670,7 @@ CREATE TABLE t_ds_project_parameter
code bigint(20) NOT NULL, code bigint(20) NOT NULL,
project_code bigint(20) NOT NULL, project_code bigint(20) NOT NULL,
user_id int(11) DEFAULT NULL, user_id int(11) DEFAULT NULL,
operator int(11) DEFAULT NULL,
create_time datetime NOT NULL, create_time datetime NOT NULL,
update_time datetime DEFAULT NULL, update_time datetime DEFAULT NULL,
PRIMARY KEY (id), PRIMARY KEY (id),

1
dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql

@ -673,6 +673,7 @@ CREATE TABLE `t_ds_project_parameter` (
`code` bigint(20) NOT NULL COMMENT 'encoding', `code` bigint(20) NOT NULL COMMENT 'encoding',
`project_code` bigint(20) NOT NULL COMMENT 'project code', `project_code` bigint(20) NOT NULL COMMENT 'project code',
`user_id` int(11) DEFAULT NULL COMMENT 'creator id', `user_id` int(11) DEFAULT NULL COMMENT 'creator id',
`operator` int(11) DEFAULT NULL COMMENT 'operator user id',
`create_time` datetime NOT NULL COMMENT 'create time', `create_time` datetime NOT NULL COMMENT 'create time',
`update_time` datetime DEFAULT NULL COMMENT 'update time', `update_time` datetime DEFAULT NULL COMMENT 'update time',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),

1
dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql

@ -598,6 +598,7 @@ CREATE TABLE t_ds_project_parameter (
code bigint NOT NULL, code bigint NOT NULL,
project_code bigint NOT NULL, project_code bigint NOT NULL,
user_id int DEFAULT NULL , user_id int DEFAULT NULL ,
operator int DEFAULT NULL ,
create_time timestamp DEFAULT CURRENT_TIMESTAMP , create_time timestamp DEFAULT CURRENT_TIMESTAMP ,
update_time timestamp DEFAULT CURRENT_TIMESTAMP , update_time timestamp DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY (id) PRIMARY KEY (id)

1
dolphinscheduler-dao/src/main/resources/sql/upgrade/3.2.2_schema/mysql/dolphinscheduler_ddl.sql

@ -25,3 +25,4 @@ CREATE TABLE `t_ds_relation_project_worker_group` (
UNIQUE KEY unique_project_worker_group(project_code,worker_group) UNIQUE KEY unique_project_worker_group(project_code,worker_group)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin; ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin;
ALTER TABLE t_ds_project_parameter ADD `operator` int(11) DEFAULT NULL COMMENT 'operator user id';

2
dolphinscheduler-dao/src/main/resources/sql/upgrade/3.2.2_schema/postgresql/dolphinscheduler_ddl.sql

@ -28,3 +28,5 @@ CREATE TABLE t_ds_relation_project_worker_group (
DROP SEQUENCE IF EXISTS t_ds_relation_project_worker_group_sequence; DROP SEQUENCE IF EXISTS t_ds_relation_project_worker_group_sequence;
CREATE SEQUENCE t_ds_relation_project_worker_group_sequence; CREATE SEQUENCE t_ds_relation_project_worker_group_sequence;
ALTER TABLE t_ds_relation_project_worker_group ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_project_worker_group_sequence'); ALTER TABLE t_ds_relation_project_worker_group ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_relation_project_worker_group_sequence');
ALTER TABLE t_ds_project_parameter ADD COLUMN IF NOT EXISTS operator int;

2
dolphinscheduler-ui/src/locales/en_US/project.ts

@ -927,6 +927,8 @@ export default {
code: 'Parameter Code', code: 'Parameter Code',
name: 'Parameter Name', name: 'Parameter Name',
value: 'Parameter Value', value: 'Parameter Value',
create_user: 'Create User',
modify_user: 'Modify User',
create_time: 'Create Time', create_time: 'Create Time',
update_time: 'Update Time', update_time: 'Update Time',
name_tips: 'Please enter your parameter name', name_tips: 'Please enter your parameter name',

2
dolphinscheduler-ui/src/locales/zh_CN/project.ts

@ -897,6 +897,8 @@ export default {
code: '参数编码', code: '参数编码',
name: '参数名称', name: '参数名称',
value: '参数值', value: '参数值',
create_user: '创建用户',
modify_user: '修改用户',
create_time: '创建时间', create_time: '创建时间',
update_time: '更新时间', update_time: '更新时间',
name_tips: '请输入参数名称', name_tips: '请输入参数名称',

10
dolphinscheduler-ui/src/views/projects/parameter/use-table.ts

@ -69,6 +69,16 @@ export function useTable() {
key: 'paramValue', key: 'paramValue',
...COLUMN_WIDTH_CONFIG['name'] ...COLUMN_WIDTH_CONFIG['name']
}, },
{
title: t('project.parameter.create_user'),
key: 'createUser',
...COLUMN_WIDTH_CONFIG['name']
},
{
title: t('project.parameter.modify_user'),
key: 'modifyUser',
...COLUMN_WIDTH_CONFIG['name']
},
{ {
title: t('project.parameter.create_time'), title: t('project.parameter.create_time'),
key: 'createTime', key: 'createTime',

Loading…
Cancel
Save