feat: 模板字段支持列表展示2

This commit is contained in:
chenjianxing 2021-06-08 20:44:10 +08:00 committed by jianxing
parent a5d7427fd9
commit c91bfd84d2
7 changed files with 117 additions and 17 deletions

View File

@ -21,5 +21,7 @@ public class CustomFieldTemplate implements Serializable {
private String customData;
private String key;
private static final long serialVersionUID = 1L;
}
}

View File

@ -643,6 +643,76 @@ public class CustomFieldTemplateExample {
addCriterion("custom_data not between", value1, value2, "customData");
return (Criteria) this;
}
public Criteria andKeyIsNull() {
addCriterion("`key` is null");
return (Criteria) this;
}
public Criteria andKeyIsNotNull() {
addCriterion("`key` is not null");
return (Criteria) this;
}
public Criteria andKeyEqualTo(String value) {
addCriterion("`key` =", value, "key");
return (Criteria) this;
}
public Criteria andKeyNotEqualTo(String value) {
addCriterion("`key` <>", value, "key");
return (Criteria) this;
}
public Criteria andKeyGreaterThan(String value) {
addCriterion("`key` >", value, "key");
return (Criteria) this;
}
public Criteria andKeyGreaterThanOrEqualTo(String value) {
addCriterion("`key` >=", value, "key");
return (Criteria) this;
}
public Criteria andKeyLessThan(String value) {
addCriterion("`key` <", value, "key");
return (Criteria) this;
}
public Criteria andKeyLessThanOrEqualTo(String value) {
addCriterion("`key` <=", value, "key");
return (Criteria) this;
}
public Criteria andKeyLike(String value) {
addCriterion("`key` like", value, "key");
return (Criteria) this;
}
public Criteria andKeyNotLike(String value) {
addCriterion("`key` not like", value, "key");
return (Criteria) this;
}
public Criteria andKeyIn(List<String> values) {
addCriterion("`key` in", values, "key");
return (Criteria) this;
}
public Criteria andKeyNotIn(List<String> values) {
addCriterion("`key` not in", values, "key");
return (Criteria) this;
}
public Criteria andKeyBetween(String value1, String value2) {
addCriterion("`key` between", value1, value2, "key");
return (Criteria) this;
}
public Criteria andKeyNotBetween(String value1, String value2) {
addCriterion("`key` not between", value1, value2, "key");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
@ -737,4 +807,4 @@ public class CustomFieldTemplateExample {
this(condition, value, secondValue, null);
}
}
}
}

View File

@ -10,6 +10,7 @@
<result column="order" jdbcType="INTEGER" property="order" />
<result column="default_value" jdbcType="VARCHAR" property="defaultValue" />
<result column="custom_data" jdbcType="VARCHAR" property="customData" />
<result column="key" jdbcType="VARCHAR" property="key" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -70,7 +71,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, field_id, template_id, scene, required, `order`, default_value, custom_data
id, field_id, template_id, scene, required, `order`, default_value, custom_data,
`key`
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.CustomFieldTemplateExample" resultMap="BaseResultMap">
select
@ -87,7 +89,7 @@
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
select
<include refid="Base_Column_List" />
from custom_field_template
where id = #{id,jdbcType=VARCHAR}
@ -103,12 +105,14 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.CustomFieldTemplate">
insert into custom_field_template (id, field_id, template_id,
scene, required, `order`,
default_value, custom_data)
values (#{id,jdbcType=VARCHAR}, #{fieldId,jdbcType=VARCHAR}, #{templateId,jdbcType=VARCHAR},
#{scene,jdbcType=VARCHAR}, #{required,jdbcType=BIT}, #{order,jdbcType=INTEGER},
#{defaultValue,jdbcType=VARCHAR}, #{customData,jdbcType=VARCHAR})
insert into custom_field_template (id, field_id, template_id,
scene, required, `order`,
default_value, custom_data, `key`
)
values (#{id,jdbcType=VARCHAR}, #{fieldId,jdbcType=VARCHAR}, #{templateId,jdbcType=VARCHAR},
#{scene,jdbcType=VARCHAR}, #{required,jdbcType=BIT}, #{order,jdbcType=INTEGER},
#{defaultValue,jdbcType=VARCHAR}, #{customData,jdbcType=VARCHAR}, #{key,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.CustomFieldTemplate">
insert into custom_field_template
@ -137,6 +141,9 @@
<if test="customData != null">
custom_data,
</if>
<if test="key != null">
`key`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -163,6 +170,9 @@
<if test="customData != null">
#{customData,jdbcType=VARCHAR},
</if>
<if test="key != null">
#{key,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.CustomFieldTemplateExample" resultType="java.lang.Long">
@ -198,6 +208,9 @@
<if test="record.customData != null">
custom_data = #{record.customData,jdbcType=VARCHAR},
</if>
<if test="record.key != null">
`key` = #{record.key,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -212,7 +225,8 @@
required = #{record.required,jdbcType=BIT},
`order` = #{record.order,jdbcType=INTEGER},
default_value = #{record.defaultValue,jdbcType=VARCHAR},
custom_data = #{record.customData,jdbcType=VARCHAR}
custom_data = #{record.customData,jdbcType=VARCHAR},
`key` = #{record.key,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -241,6 +255,9 @@
<if test="customData != null">
custom_data = #{customData,jdbcType=VARCHAR},
</if>
<if test="key != null">
`key` = #{key,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -252,7 +269,8 @@
required = #{required,jdbcType=BIT},
`order` = #{order,jdbcType=INTEGER},
default_value = #{defaultValue,jdbcType=VARCHAR},
custom_data = #{customData,jdbcType=VARCHAR}
custom_data = #{customData,jdbcType=VARCHAR},
`key` = #{key,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
</mapper>

View File

@ -166,7 +166,8 @@
test_case.create_time, test_case.update_time, test_case.test_id, test_case.sort, test_case.num,
test_case.other_test_name, test_case.review_status, test_case.tags,
test_case.demand_id, test_case.demand_name, test_case.follow_people, test_case.`status`,
test_case.custom_num, test_case.step_model, test_case.create_user,u.name as createName
test_case.custom_num, test_case.step_model, test_case.create_user,u.name as createName,
test_case.custom_fields
</if>
from test_case left join user u on test_case.create_user=u.id
<include refid="queryWhereCondition"/>

View File

@ -1,11 +1,8 @@
package io.metersphere.controller;
import io.metersphere.base.domain.CustomFieldTemplate;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.dto.CustomFieldTemplateDao;
import io.metersphere.service.CustomFieldTemplateService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@ -25,4 +22,9 @@ public class CustomFieldTemplateController {
public List<CustomFieldTemplateDao> list(@RequestBody CustomFieldTemplate request) {
return customFieldTemplateService.list(request);
}
@PostMapping("/update")
public void update(@RequestBody CustomFieldTemplate request) {
customFieldTemplateService.update(request);
}
}

View File

@ -12,4 +12,6 @@ public class CustomFieldDao extends CustomField {
private String defaultValue;
private String customData;
private String key;
}

View File

@ -113,4 +113,9 @@ public class CustomFieldTemplateService {
sqlSession.flushStatements();
sqlSession.close();
}
public void update(CustomFieldTemplate request) {
customFieldTemplateMapper.updateByPrimaryKeySelective(request);
}
}