Browse Source

添加组件类型常量

recovery
zy_Java 5 years ago
parent
commit
8769f5c50e
  1. 36
      form/src/main/java/com/ccsens/form/api/ModuleController.java
  2. 22
      form/src/main/java/com/ccsens/form/bean/dto/ModuleDto.java
  3. 12
      form/src/main/java/com/ccsens/form/bean/po/FormModuleConfigOption.java
  4. 48
      form/src/main/java/com/ccsens/form/bean/po/FormModuleConfigOptionExample.java
  5. 63
      form/src/main/java/com/ccsens/form/bean/vo/ModuleVo.java
  6. 17
      form/src/main/java/com/ccsens/form/persist/dao/ModuleDao.java
  7. 31
      form/src/main/java/com/ccsens/form/service/IModuleService.java
  8. 41
      form/src/main/java/com/ccsens/form/service/ModuleService.java
  9. 27
      form/src/main/java/com/ccsens/form/util/Constant.java
  10. 10
      form/src/main/resources/mapper_dao/ModuleDao.xml
  11. 30
      form/src/main/resources/mapper_raw/FormModuleConfigOptionMapper.xml

36
form/src/main/java/com/ccsens/form/api/ModuleController.java

@ -3,6 +3,7 @@ package com.ccsens.form.api;
import com.ccsens.cloudutil.annotation.MustLogin;
import com.ccsens.form.bean.dto.ModuleDto;
import com.ccsens.form.bean.vo.ModuleVo;
import com.ccsens.form.service.IModuleService;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.bean.dto.QueryDto;
import io.swagger.annotations.Api;
@ -15,6 +16,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @author
*/
@ -23,15 +27,37 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/module")
public class ModuleController {
@Resource
private IModuleService moduleService;
@MustLogin
@ApiOperation(value = "查找所有组件模板", notes = "")
@ApiOperation(value = "查找所有组件模板", notes = "zy:查找所有组件模板和对应的配置信息")
@RequestMapping(value = "/query", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<ModuleVo> selResult(@ApiParam @Validated @RequestBody QueryDto params) {
log.info("查看测评结果:{}",params);
public JsonResponse<List<ModuleVo.ModuleInfo>> queryModule(@ApiParam @Validated @RequestBody QueryDto params) {
log.info("查找所有组件模板:{}",params);
List<ModuleVo.ModuleInfo> moduleInfoList = moduleService.queryModule();
log.info("查找所有组件结果");
return JsonResponse.newInstance().ok(moduleInfoList);
}
log.info("查看测评结果");
return JsonResponse.newInstance().ok();
@MustLogin
@ApiOperation(value = "查找表单内组件和配置信息", notes = "zy:查找表单内添加的组件的配置和选项信息,如果没有则返回改组价模板的默认配置")
@RequestMapping(value = "/get/formModule", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<ModuleVo.ModuleInfo>> getFormModule(@ApiParam @Validated @RequestBody QueryDto<ModuleDto.GetFormModule> params) {
log.info("查找表单内组件和配置信息:{}",params);
List<ModuleVo.ModuleInfo> moduleInfoList = moduleService.getFormModule(params);
log.info("查找表单内组件和配置信息结果:{}",moduleInfoList);
return JsonResponse.newInstance().ok(moduleInfoList);
}
@MustLogin
@ApiOperation(value = "修改组件的配置信息和选项", notes = "查找该组件以前添加的配置和选项信息,删除后,重新添加新的的配置和选项")
@RequestMapping(value = "/update/formModule", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse updateFormModule(@ApiParam @Validated @RequestBody QueryDto<ModuleDto.UpdateFormModule> params) {
log.info("修改组件的配置信息和选项:{}",params);
moduleService.updateFormModule(params);
log.info("修改组件的配置信息和选项成功");
return JsonResponse.newInstance().ok();
}
}

22
form/src/main/java/com/ccsens/form/bean/dto/ModuleDto.java

@ -1,7 +1,29 @@
package com.ccsens.form.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @author
*/
@Data
public class ModuleDto {
@Data
@ApiModel("查找表单内的组件信息")
public static class GetFormModule{
@NotNull
@ApiModelProperty("表单组件关联id")
private Long formModuleId;
}
@Data
@ApiModel("修改组件配置和选项")
public static class UpdateFormModule{
@NotNull
@ApiModelProperty("表单组件关联id")
private Long formModuleId;
}
}

12
form/src/main/java/com/ccsens/form/bean/po/FormModuleConfigOption.java

@ -6,7 +6,7 @@ import java.util.Date;
public class FormModuleConfigOption implements Serializable {
private Long id;
private Long formModuleConfigId;
private Long formModuleId;
private Long parentId;
@ -34,12 +34,12 @@ public class FormModuleConfigOption implements Serializable {
this.id = id;
}
public Long getFormModuleConfigId() {
return formModuleConfigId;
public Long getFormModuleId() {
return formModuleId;
}
public void setFormModuleConfigId(Long formModuleConfigId) {
this.formModuleConfigId = formModuleConfigId;
public void setFormModuleId(Long formModuleId) {
this.formModuleId = formModuleId;
}
public Long getParentId() {
@ -113,7 +113,7 @@ public class FormModuleConfigOption implements Serializable {
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", formModuleConfigId=").append(formModuleConfigId);
sb.append(", formModuleId=").append(formModuleId);
sb.append(", parentId=").append(parentId);
sb.append(", optionKey=").append(optionKey);
sb.append(", optionValue=").append(optionValue);

48
form/src/main/java/com/ccsens/form/bean/po/FormModuleConfigOptionExample.java

@ -165,63 +165,63 @@ public class FormModuleConfigOptionExample {
return (Criteria) this;
}
public Criteria andFormModuleConfigIdIsNull() {
addCriterion("form_module_config_id is null");
public Criteria andFormModuleIdIsNull() {
addCriterion("form_module_id is null");
return (Criteria) this;
}
public Criteria andFormModuleConfigIdIsNotNull() {
addCriterion("form_module_config_id is not null");
public Criteria andFormModuleIdIsNotNull() {
addCriterion("form_module_id is not null");
return (Criteria) this;
}
public Criteria andFormModuleConfigIdEqualTo(Long value) {
addCriterion("form_module_config_id =", value, "formModuleConfigId");
public Criteria andFormModuleIdEqualTo(Long value) {
addCriterion("form_module_id =", value, "formModuleId");
return (Criteria) this;
}
public Criteria andFormModuleConfigIdNotEqualTo(Long value) {
addCriterion("form_module_config_id <>", value, "formModuleConfigId");
public Criteria andFormModuleIdNotEqualTo(Long value) {
addCriterion("form_module_id <>", value, "formModuleId");
return (Criteria) this;
}
public Criteria andFormModuleConfigIdGreaterThan(Long value) {
addCriterion("form_module_config_id >", value, "formModuleConfigId");
public Criteria andFormModuleIdGreaterThan(Long value) {
addCriterion("form_module_id >", value, "formModuleId");
return (Criteria) this;
}
public Criteria andFormModuleConfigIdGreaterThanOrEqualTo(Long value) {
addCriterion("form_module_config_id >=", value, "formModuleConfigId");
public Criteria andFormModuleIdGreaterThanOrEqualTo(Long value) {
addCriterion("form_module_id >=", value, "formModuleId");
return (Criteria) this;
}
public Criteria andFormModuleConfigIdLessThan(Long value) {
addCriterion("form_module_config_id <", value, "formModuleConfigId");
public Criteria andFormModuleIdLessThan(Long value) {
addCriterion("form_module_id <", value, "formModuleId");
return (Criteria) this;
}
public Criteria andFormModuleConfigIdLessThanOrEqualTo(Long value) {
addCriterion("form_module_config_id <=", value, "formModuleConfigId");
public Criteria andFormModuleIdLessThanOrEqualTo(Long value) {
addCriterion("form_module_id <=", value, "formModuleId");
return (Criteria) this;
}
public Criteria andFormModuleConfigIdIn(List<Long> values) {
addCriterion("form_module_config_id in", values, "formModuleConfigId");
public Criteria andFormModuleIdIn(List<Long> values) {
addCriterion("form_module_id in", values, "formModuleId");
return (Criteria) this;
}
public Criteria andFormModuleConfigIdNotIn(List<Long> values) {
addCriterion("form_module_config_id not in", values, "formModuleConfigId");
public Criteria andFormModuleIdNotIn(List<Long> values) {
addCriterion("form_module_id not in", values, "formModuleId");
return (Criteria) this;
}
public Criteria andFormModuleConfigIdBetween(Long value1, Long value2) {
addCriterion("form_module_config_id between", value1, value2, "formModuleConfigId");
public Criteria andFormModuleIdBetween(Long value1, Long value2) {
addCriterion("form_module_id between", value1, value2, "formModuleId");
return (Criteria) this;
}
public Criteria andFormModuleConfigIdNotBetween(Long value1, Long value2) {
addCriterion("form_module_config_id not between", value1, value2, "formModuleConfigId");
public Criteria andFormModuleIdNotBetween(Long value1, Long value2) {
addCriterion("form_module_id not between", value1, value2, "formModuleId");
return (Criteria) this;
}

63
form/src/main/java/com/ccsens/form/bean/vo/ModuleVo.java

@ -1,4 +1,67 @@
package com.ccsens.form.bean.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author
*/
@Data
public class ModuleVo {
@Data
@ApiModel("组件基本信息")
public static class ModuleInfo{
@ApiModelProperty("组件id")
private Long id;
@ApiModelProperty("组件类型 (单选:radio)(多选:CheckBox)(下拉菜单:pullDown)(文本:text)(多行文本:textarea)(富文本:richText)")
private byte type;
@ApiModelProperty("图标")
private String logo;
@ApiModelProperty("名称")
private String name;
@ApiModelProperty("是否有选项 0否 1是")
private byte option;
@ApiModelProperty("关联层级数")
private byte hierarchy;
@ApiModelProperty("组件配置")
private List<ModuleConfig> moduleConfigList;
@ApiModelProperty("选项信息")
private List<Option> optionList;
}
@Data
@ApiModel("组件配置信息")
public static class ModuleConfig{
@ApiModelProperty("组件配置的id")
private Long configId;
@ApiModelProperty("类型 0显示 1校验")
private byte type;
@ApiModelProperty("配置类型code")
private String configKey;
@ApiModelProperty("内容")
private String configValue;
}
@Data
@ApiModel("选项信息")
public static class Option{
@ApiModelProperty("选项id")
private Long id;
@ApiModelProperty("选项key")
private String optionKey;
@ApiModelProperty("选项value")
private String optionValue;
@ApiModelProperty("排序")
private int sequence;
@ApiModelProperty("是否选中 0否 1是")
private byte choose;
@ApiModelProperty("子选项")
private List<Option> subOption;
}
}

17
form/src/main/java/com/ccsens/form/persist/dao/ModuleDao.java

@ -0,0 +1,17 @@
package com.ccsens.form.persist.dao;
import com.ccsens.form.bean.vo.ModuleVo;
import com.ccsens.form.persist.mapper.ModuleMapper;
import java.util.List;
/**
* @author
*/
public interface ModuleDao extends ModuleMapper {
/**
* 查找所有的组件模板和对应配置信息
* @return
*/
List<ModuleVo.ModuleInfo> queryModule();
}

31
form/src/main/java/com/ccsens/form/service/IModuleService.java

@ -0,0 +1,31 @@
package com.ccsens.form.service;
import com.ccsens.form.bean.dto.ModuleDto;
import com.ccsens.form.bean.vo.ModuleVo;
import com.ccsens.util.bean.dto.QueryDto;
import java.util.List;
/**
* @author
*/
public interface IModuleService {
/**
* 查找所有组件模板
* @return 返回所有组件模板信息
*/
List<ModuleVo.ModuleInfo> queryModule();
/**
* 根据id查询表单内添加的组件的信息
* @param params 表单内添加的组件的id
* @return 返回组件的配置和选项信息
*/
List<ModuleVo.ModuleInfo> getFormModule(QueryDto<ModuleDto.GetFormModule> params);
/**
* 修改组件的配置和选项
* @param params 返回空
*/
void updateFormModule(QueryDto<ModuleDto.UpdateFormModule> params);
}

41
form/src/main/java/com/ccsens/form/service/ModuleService.java

@ -0,0 +1,41 @@
package com.ccsens.form.service;
import com.ccsens.form.bean.dto.ModuleDto;
import com.ccsens.form.bean.po.Module;
import com.ccsens.form.bean.vo.ModuleVo;
import com.ccsens.form.persist.dao.ModuleDao;
import com.ccsens.util.bean.dto.QueryDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* @author
*/
@Slf4j
@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class ModuleService implements IModuleService{
@Resource
private ModuleDao moduleDao;
@Override
public List<ModuleVo.ModuleInfo> queryModule() {
return moduleDao.queryModule();;
}
@Override
public List<ModuleVo.ModuleInfo> getFormModule(QueryDto<ModuleDto.GetFormModule> params) {
return null;
}
@Override
public void updateFormModule(QueryDto<ModuleDto.UpdateFormModule> params) {
}
}

27
form/src/main/java/com/ccsens/form/util/Constant.java

@ -0,0 +1,27 @@
package com.ccsens.form.util;
/**
* @author
*/
public class Constant {
/**组件类型*/
public static class ModuleType{
/**单选*/
public static final String RADIO = "radio";
/**多选*/
public static final String CHECKBOX = "checkBox";
/**下拉菜单*/
public static final String PULL_DOWN = "pullDown";
/**文本*/
public static final String TEXT = "text";
/**多行文本*/
public static final String TEXTAREA = "textarea";
/**富文本框*/
public static final String RICH_TEXT = "richText";
/**日期*/
public static final String DATE = "date";
}
}

10
form/src/main/resources/mapper_dao/ModuleDao.xml

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.form.persist.dao.ModuleDao">
<select id="queryModule" resultType="com.ccsens.form.bean.vo.ModuleVo$ModuleInfo">
</select>
</mapper>

30
form/src/main/resources/mapper_raw/FormModuleConfigOptionMapper.xml

@ -3,7 +3,7 @@
<mapper namespace="com.ccsens.form.persist.mapper.FormModuleConfigOptionMapper">
<resultMap id="BaseResultMap" type="com.ccsens.form.bean.po.FormModuleConfigOption">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="form_module_config_id" jdbcType="BIGINT" property="formModuleConfigId" />
<result column="form_module_id" jdbcType="BIGINT" property="formModuleId" />
<result column="parent_id" jdbcType="BIGINT" property="parentId" />
<result column="option_key" jdbcType="VARCHAR" property="optionKey" />
<result column="option_value" jdbcType="VARCHAR" property="optionValue" />
@ -72,8 +72,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, form_module_config_id, parent_id, option_key, option_value, sequence, operator,
created_at, updated_at, rec_status
id, form_module_id, parent_id, option_key, option_value, sequence, operator, created_at,
updated_at, rec_status
</sql>
<select id="selectByExample" parameterType="com.ccsens.form.bean.po.FormModuleConfigOptionExample" resultMap="BaseResultMap">
select
@ -106,11 +106,11 @@
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.form.bean.po.FormModuleConfigOption">
insert into t_form_module_config_option (id, form_module_config_id, parent_id,
insert into t_form_module_config_option (id, form_module_id, parent_id,
option_key, option_value, sequence,
operator, created_at, updated_at,
rec_status)
values (#{id,jdbcType=BIGINT}, #{formModuleConfigId,jdbcType=BIGINT}, #{parentId,jdbcType=BIGINT},
values (#{id,jdbcType=BIGINT}, #{formModuleId,jdbcType=BIGINT}, #{parentId,jdbcType=BIGINT},
#{optionKey,jdbcType=VARCHAR}, #{optionValue,jdbcType=VARCHAR}, #{sequence,jdbcType=INTEGER},
#{operator,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP},
#{recStatus,jdbcType=TINYINT})
@ -121,8 +121,8 @@
<if test="id != null">
id,
</if>
<if test="formModuleConfigId != null">
form_module_config_id,
<if test="formModuleId != null">
form_module_id,
</if>
<if test="parentId != null">
parent_id,
@ -153,8 +153,8 @@
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="formModuleConfigId != null">
#{formModuleConfigId,jdbcType=BIGINT},
<if test="formModuleId != null">
#{formModuleId,jdbcType=BIGINT},
</if>
<if test="parentId != null">
#{parentId,jdbcType=BIGINT},
@ -194,8 +194,8 @@
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.formModuleConfigId != null">
form_module_config_id = #{record.formModuleConfigId,jdbcType=BIGINT},
<if test="record.formModuleId != null">
form_module_id = #{record.formModuleId,jdbcType=BIGINT},
</if>
<if test="record.parentId != null">
parent_id = #{record.parentId,jdbcType=BIGINT},
@ -229,7 +229,7 @@
<update id="updateByExample" parameterType="map">
update t_form_module_config_option
set id = #{record.id,jdbcType=BIGINT},
form_module_config_id = #{record.formModuleConfigId,jdbcType=BIGINT},
form_module_id = #{record.formModuleId,jdbcType=BIGINT},
parent_id = #{record.parentId,jdbcType=BIGINT},
option_key = #{record.optionKey,jdbcType=VARCHAR},
option_value = #{record.optionValue,jdbcType=VARCHAR},
@ -245,8 +245,8 @@
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.form.bean.po.FormModuleConfigOption">
update t_form_module_config_option
<set>
<if test="formModuleConfigId != null">
form_module_config_id = #{formModuleConfigId,jdbcType=BIGINT},
<if test="formModuleId != null">
form_module_id = #{formModuleId,jdbcType=BIGINT},
</if>
<if test="parentId != null">
parent_id = #{parentId,jdbcType=BIGINT},
@ -277,7 +277,7 @@
</update>
<update id="updateByPrimaryKey" parameterType="com.ccsens.form.bean.po.FormModuleConfigOption">
update t_form_module_config_option
set form_module_config_id = #{formModuleConfigId,jdbcType=BIGINT},
set form_module_id = #{formModuleId,jdbcType=BIGINT},
parent_id = #{parentId,jdbcType=BIGINT},
option_key = #{optionKey,jdbcType=VARCHAR},
option_value = #{optionValue,jdbcType=VARCHAR},

Loading…
Cancel
Save