动态表单 命名规范

This commit is contained in:
樊宇 2021-11-04 17:35:01 +08:00
parent b7a90c2c12
commit b369b363b6
16 changed files with 196 additions and 129 deletions

View File

@ -1,9 +1,9 @@
package cn.iocoder.yudao.adminserver.modules.activiti.controller.form; package cn.iocoder.yudao.adminserver.modules.activiti.controller.form;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.*; import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.*;
import cn.iocoder.yudao.adminserver.modules.activiti.convert.form.OsFormConvert; import cn.iocoder.yudao.adminserver.modules.activiti.convert.form.WfFormConvert;
import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.OsFormDO; import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.WfForm;
import cn.iocoder.yudao.adminserver.modules.activiti.service.form.OsFormService; import cn.iocoder.yudao.adminserver.modules.activiti.service.form.WfFormService;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
@ -28,24 +28,24 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E
// TODO @风里雾里 Os=Wf/os 改成 /wl 开头目前这个模块咱先定位成给工作流用的 // TODO @风里雾里 Os=Wf/os 改成 /wl 开头目前这个模块咱先定位成给工作流用的
@Api(tags = "动态表单") @Api(tags = "动态表单")
@RestController @RestController
@RequestMapping("/os/form") @RequestMapping("/wl/form")
@Validated @Validated
public class OsFormController { public class WlFormController {
@Resource @Resource
private OsFormService formService; private WfFormService formService;
@PostMapping("/create") @PostMapping("/create")
@ApiOperation("创建动态表单") @ApiOperation("创建动态表单")
@PreAuthorize("@ss.hasPermission('os:form:create')") @PreAuthorize("@ss.hasPermission('os:form:create')")
public CommonResult<Long> createForm(@Valid @RequestBody OsFormCreateReqVO createReqVO) { public CommonResult<Long> createForm(@Valid @RequestBody WfFormCreateReqVO createReqVO) {
return success(formService.createForm(createReqVO)); return success(formService.createForm(createReqVO));
} }
@PutMapping("/update") @PutMapping("/update")
@ApiOperation("更新动态表单") @ApiOperation("更新动态表单")
@PreAuthorize("@ss.hasPermission('os:form:update')") @PreAuthorize("@ss.hasPermission('os:form:update')")
public CommonResult<Boolean> updateForm(@Valid @RequestBody OsFormUpdateReqVO updateReqVO) { public CommonResult<Boolean> updateForm(@Valid @RequestBody WfFormUpdateReqVO updateReqVO) {
formService.updateForm(updateReqVO); formService.updateForm(updateReqVO);
return success(true); return success(true);
} }
@ -63,38 +63,38 @@ public class OsFormController {
@ApiOperation("获得动态表单") @ApiOperation("获得动态表单")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('os:form:query')") @PreAuthorize("@ss.hasPermission('os:form:query')")
public CommonResult<OsFormRespVO> getForm(@RequestParam("id") Long id) { public CommonResult<WfFormRespVO> getForm(@RequestParam("id") Long id) {
OsFormDO form = formService.getForm(id); WfForm form = formService.getForm(id);
return success(OsFormConvert.INSTANCE.convert(form)); return success(WfFormConvert.INSTANCE.convert(form));
} }
@GetMapping("/list") @GetMapping("/list")
@ApiOperation("获得动态表单列表") @ApiOperation("获得动态表单列表")
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
@PreAuthorize("@ss.hasPermission('os:form:query')") @PreAuthorize("@ss.hasPermission('os:form:query')")
public CommonResult<List<OsFormRespVO>> getFormList(@RequestParam("ids") Collection<Long> ids) { public CommonResult<List<WfFormRespVO>> getFormList(@RequestParam("ids") Collection<Long> ids) {
List<OsFormDO> list = formService.getFormList(ids); List<WfForm> list = formService.getFormList(ids);
return success(OsFormConvert.INSTANCE.convertList(list)); return success(WfFormConvert.INSTANCE.convertList(list));
} }
@GetMapping("/page") @GetMapping("/page")
@ApiOperation("获得动态表单分页") @ApiOperation("获得动态表单分页")
@PreAuthorize("@ss.hasPermission('os:form:query')") @PreAuthorize("@ss.hasPermission('os:form:query')")
public CommonResult<PageResult<OsFormRespVO>> getFormPage(@Valid OsFormPageReqVO pageVO) { public CommonResult<PageResult<WfFormRespVO>> getFormPage(@Valid WfFormPageReqVO pageVO) {
PageResult<OsFormDO> pageResult = formService.getFormPage(pageVO); PageResult<WfForm> pageResult = formService.getFormPage(pageVO);
return success(OsFormConvert.INSTANCE.convertPage(pageResult)); return success(WfFormConvert.INSTANCE.convertPage(pageResult));
} }
@GetMapping("/export-excel") @GetMapping("/export-excel")
@ApiOperation("导出动态表单 Excel") @ApiOperation("导出动态表单 Excel")
@PreAuthorize("@ss.hasPermission('os:form:export')") @PreAuthorize("@ss.hasPermission('os:form:export')")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public void exportFormExcel(@Valid OsFormExportReqVO exportReqVO, public void exportFormExcel(@Valid WfFormExportReqVO exportReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
List<OsFormDO> list = formService.getFormList(exportReqVO); List<WfForm> list = formService.getFormList(exportReqVO);
// 导出 Excel // 导出 Excel
List<OsFormExcelVO> datas = OsFormConvert.INSTANCE.convertList02(list); List<WfFormExcelVO> datas = WfFormConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "动态表单.xls", "数据", OsFormExcelVO.class, datas); ExcelUtils.write(response, "动态表单.xls", "数据", WfFormExcelVO.class, datas);
} }
} }

View File

@ -9,7 +9,7 @@ import javax.validation.constraints.*;
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成 * 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/ */
@Data @Data
public class OsFormBaseVO { public class WfFormBaseVO {
@ApiModelProperty(value = "表单名称", required = true) @ApiModelProperty(value = "表单名称", required = true)
@NotNull(message = "表单名称不能为空") @NotNull(message = "表单名称不能为空")

View File

@ -7,6 +7,6 @@ import io.swagger.annotations.*;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class OsFormCreateReqVO extends OsFormBaseVO { public class WfFormCreateReqVO extends WfFormBaseVO {
} }

View File

@ -11,7 +11,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
* @author 芋艿 * @author 芋艿
*/ */
@Data @Data
public class OsFormExcelVO { public class WfFormExcelVO {
@ExcelProperty("表单编号") @ExcelProperty("表单编号")
private Long id; private Long id;

View File

@ -8,7 +8,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@ApiModel(value = "动态表单 Excel 导出 Request VO", description = "参数和 OsFormPageReqVO 是一致的") @ApiModel(value = "动态表单 Excel 导出 Request VO", description = "参数和 OsFormPageReqVO 是一致的")
@Data @Data
public class OsFormExportReqVO { public class WfFormExportReqVO {
@ApiModelProperty(value = "表单名称") @ApiModelProperty(value = "表单名称")
private String name; private String name;

View File

@ -11,7 +11,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class OsFormPageReqVO extends PageParam { public class WfFormPageReqVO extends PageParam {
@ApiModelProperty(value = "表单名称") @ApiModelProperty(value = "表单名称")
private String name; private String name;

View File

@ -8,7 +8,7 @@ import io.swagger.annotations.*;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class OsFormRespVO extends OsFormBaseVO { public class WfFormRespVO extends WfFormBaseVO {
@ApiModelProperty(value = "表单编号", required = true) @ApiModelProperty(value = "表单编号", required = true)
private Long id; private Long id;

View File

@ -8,7 +8,7 @@ import javax.validation.constraints.*;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class OsFormUpdateReqVO extends OsFormBaseVO { public class WfFormUpdateReqVO extends WfFormBaseVO {
@ApiModelProperty(value = "表单编号", required = true) @ApiModelProperty(value = "表单编号", required = true)
@NotNull(message = "表单编号不能为空") @NotNull(message = "表单编号不能为空")

View File

@ -1,10 +1,10 @@
package cn.iocoder.yudao.adminserver.modules.activiti.convert.form; package cn.iocoder.yudao.adminserver.modules.activiti.convert.form;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.OsFormCreateReqVO; import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormCreateReqVO;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.OsFormExcelVO; import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormExcelVO;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.OsFormRespVO; import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormRespVO;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.OsFormUpdateReqVO; import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormUpdateReqVO;
import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.OsFormDO; import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.WfForm;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
@ -17,20 +17,20 @@ import java.util.List;
* @author 芋艿 * @author 芋艿
*/ */
@Mapper @Mapper
public interface OsFormConvert { public interface WfFormConvert {
OsFormConvert INSTANCE = Mappers.getMapper(OsFormConvert.class); WfFormConvert INSTANCE = Mappers.getMapper(WfFormConvert.class);
OsFormDO convert(OsFormCreateReqVO bean); WfForm convert(WfFormCreateReqVO bean);
OsFormDO convert(OsFormUpdateReqVO bean); WfForm convert(WfFormUpdateReqVO bean);
OsFormRespVO convert(OsFormDO bean); WfFormRespVO convert(WfForm bean);
List<OsFormRespVO> convertList(List<OsFormDO> list); List<WfFormRespVO> convertList(List<WfForm> list);
PageResult<OsFormRespVO> convertPage(PageResult<OsFormDO> page); PageResult<WfFormRespVO> convertPage(PageResult<WfForm> page);
List<OsFormExcelVO> convertList02(List<OsFormDO> list); List<WfFormExcelVO> convertList02(List<WfForm> list);
} }

View File

@ -1,45 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
// TODO @风里雾里切到 https://gitee.com/zhijiantianya/ruoyi-vue-pro/blob/feature/activiti/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/workflow/dal/dataobject/form/WfForm.java status 添加进去哈
/**
* 动态表单 DO
*
* @author 芋艿
*/
@TableName("os_form")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OsFormDO extends BaseDO {
/**
* 表单编号
*/
@TableId
private Long id;
/**
* 表单名称
*/
private String name;
/**
* 商户状态
*/
private Integer status;
/**
* 表单JSON
*/
private String formJson;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.*;
import java.util.List;
/**
* 工作流的表单定义
* 用于工作流的申请表单需要动态配置的场景
*
* @author 芋道源码
*/
@TableName(value = "wf_form", autoResultMap = true)
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WfForm extends BaseDO {
/**
* 编号
*/
@TableId
private Long id;
/**
* 表单名
*/
private String name;
/**
* 状态
*/
private Integer status;
/**
* 表单JSON
*/
private String formJson;
/**
* 表单配置
*
* 目前直接将 https://github.com/JakHuang/form-generator 生成的 JSON 直接保存
* 定义https://github.com/JakHuang/form-generator/issues/46
*/
@TableField(typeHandler = JacksonTypeHandler.class)
private List<String> fields;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.*;
import java.util.List;
import java.util.Map;
/**
* 工作流的表单结果
* 用户每次填写工作流的申请表单时会保存一条记录到该表
*
* @author 芋道源码
*/
@TableName(value = "wf_form", autoResultMap = true)
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WfFormData extends BaseDO {
/**
* 编号
*/
private Long id;
/**
* 表单编号
*
* 关联 {@link WfForm#getId()}
*/
private Long formId;
/**
* 状态
*/
private Integer status;
/**
* 表单配置
*
* 冗余 {@link WfForm#getFields()}
* 主要考虑表单是可以修改的
*/
@TableField(typeHandler = JacksonTypeHandler.class)
private List<String> fields;
/**
* 表单值
*/
@TableField(typeHandler = JacksonTypeHandler.class)
private Map<String, Object> values;
}

View File

@ -2,9 +2,9 @@ package cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.form;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.OsFormExportReqVO; import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormExportReqVO;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.OsFormPageReqVO; import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormPageReqVO;
import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.OsFormDO; import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.WfForm;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
@ -15,13 +15,13 @@ import java.util.List;
/** /**
* 动态表单 Mapper * 动态表单 Mapper
* *
* @author 芋艿 * @author 风里雾里
*/ */
@Mapper @Mapper
public interface OsFormMapper extends BaseMapperX<OsFormDO> { public interface WfFormMapper extends BaseMapperX<WfForm> {
default PageResult<OsFormDO> selectPage(OsFormPageReqVO reqVO) { default PageResult<WfForm> selectPage(WfFormPageReqVO reqVO) {
return selectPage(reqVO, new QueryWrapperX<OsFormDO>() return selectPage(reqVO, new QueryWrapperX<WfForm>()
.likeIfPresent("name", reqVO.getName()) .likeIfPresent("name", reqVO.getName())
.eqIfPresent("status", reqVO.getStatus()) .eqIfPresent("status", reqVO.getStatus())
.eqIfPresent("form_json", reqVO.getFormJson()) .eqIfPresent("form_json", reqVO.getFormJson())
@ -30,8 +30,8 @@ public interface OsFormMapper extends BaseMapperX<OsFormDO> {
.orderByDesc("id") ); .orderByDesc("id") );
} }
default List<OsFormDO> selectList(OsFormExportReqVO reqVO) { default List<WfForm> selectList(WfFormExportReqVO reqVO) {
return selectList(new QueryWrapperX<OsFormDO>() return selectList(new QueryWrapperX<WfForm>()
.likeIfPresent("name", reqVO.getName()) .likeIfPresent("name", reqVO.getName())
.eqIfPresent("status", reqVO.getStatus()) .eqIfPresent("status", reqVO.getStatus())
.eqIfPresent("form_json", reqVO.getFormJson()) .eqIfPresent("form_json", reqVO.getFormJson())

View File

@ -9,6 +9,6 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
* 001 oa * 001 oa
* activiti 系统使用 1-003-000-000 * activiti 系统使用 1-003-000-000
*/ */
public interface FormErrorCodeConstants { public interface WfFormErrorCodeConstants {
ErrorCode FORM_NOT_EXISTS = new ErrorCode(1003001002, "动态表单不存在"); ErrorCode FORM_NOT_EXISTS = new ErrorCode(1003001002, "动态表单不存在");
} }

View File

@ -1,10 +1,10 @@
package cn.iocoder.yudao.adminserver.modules.activiti.service.form; package cn.iocoder.yudao.adminserver.modules.activiti.service.form;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.OsFormCreateReqVO; import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormCreateReqVO;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.OsFormExportReqVO; import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormExportReqVO;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.OsFormPageReqVO; import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormPageReqVO;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.OsFormUpdateReqVO; import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormUpdateReqVO;
import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.OsFormDO; import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.WfForm;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import java.util.*; import java.util.*;
@ -14,9 +14,9 @@ import javax.validation.*;
/** /**
* 动态表单 Service 接口 * 动态表单 Service 接口
* *
* @author 芋艿 * TODO @风里雾里
*/ */
public interface OsFormService { public interface WfFormService {
/** /**
* 创建动态表单 * 创建动态表单
@ -24,14 +24,14 @@ public interface OsFormService {
* @param createReqVO 创建信息 * @param createReqVO 创建信息
* @return 编号 * @return 编号
*/ */
Long createForm(@Valid OsFormCreateReqVO createReqVO); Long createForm(@Valid WfFormCreateReqVO createReqVO);
/** /**
* 更新动态表单 * 更新动态表单
* *
* @param updateReqVO 更新信息 * @param updateReqVO 更新信息
*/ */
void updateForm(@Valid OsFormUpdateReqVO updateReqVO); void updateForm(@Valid WfFormUpdateReqVO updateReqVO);
/** /**
* 删除动态表单 * 删除动态表单
@ -46,7 +46,7 @@ public interface OsFormService {
* @param id 编号 * @param id 编号
* @return 动态表单 * @return 动态表单
*/ */
OsFormDO getForm(Long id); WfForm getForm(Long id);
/** /**
* 获得动态表单列表 * 获得动态表单列表
@ -54,7 +54,7 @@ public interface OsFormService {
* @param ids 编号 * @param ids 编号
* @return 动态表单列表 * @return 动态表单列表
*/ */
List<OsFormDO> getFormList(Collection<Long> ids); List<WfForm> getFormList(Collection<Long> ids);
/** /**
* 获得动态表单分页 * 获得动态表单分页
@ -62,7 +62,7 @@ public interface OsFormService {
* @param pageReqVO 分页查询 * @param pageReqVO 分页查询
* @return 动态表单分页 * @return 动态表单分页
*/ */
PageResult<OsFormDO> getFormPage(OsFormPageReqVO pageReqVO); PageResult<WfForm> getFormPage(WfFormPageReqVO pageReqVO);
/** /**
* 获得动态表单列表, 用于 Excel 导出 * 获得动态表单列表, 用于 Excel 导出
@ -70,6 +70,6 @@ public interface OsFormService {
* @param exportReqVO 查询条件 * @param exportReqVO 查询条件
* @return 动态表单列表 * @return 动态表单列表
*/ */
List<OsFormDO> getFormList(OsFormExportReqVO exportReqVO); List<WfForm> getFormList(WfFormExportReqVO exportReqVO);
} }

View File

@ -1,13 +1,13 @@
package cn.iocoder.yudao.adminserver.modules.activiti.service.form.impl; package cn.iocoder.yudao.adminserver.modules.activiti.service.form.impl;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.OsFormCreateReqVO; import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormCreateReqVO;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.OsFormExportReqVO; import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormExportReqVO;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.OsFormPageReqVO; import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormPageReqVO;
import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.OsFormUpdateReqVO; import cn.iocoder.yudao.adminserver.modules.activiti.controller.form.vo.WfFormUpdateReqVO;
import cn.iocoder.yudao.adminserver.modules.activiti.convert.form.OsFormConvert; import cn.iocoder.yudao.adminserver.modules.activiti.convert.form.WfFormConvert;
import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.OsFormDO; import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.form.WfForm;
import cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.form.OsFormMapper; import cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.form.WfFormMapper;
import cn.iocoder.yudao.adminserver.modules.activiti.service.form.OsFormService; import cn.iocoder.yudao.adminserver.modules.activiti.service.form.WfFormService;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -16,36 +16,36 @@ import javax.annotation.Resource;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.adminserver.modules.activiti.enums.form.FormErrorCodeConstants.FORM_NOT_EXISTS; import static cn.iocoder.yudao.adminserver.modules.activiti.enums.form.WfFormErrorCodeConstants.FORM_NOT_EXISTS;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
/** /**
* 动态表单 Service 实现类 * 动态表单 Service 实现类
* *
* @author 芋艿 // TODO @风里雾里作者改成你自己哈 * TODO @风里雾里
*/ */
@Service @Service
@Validated @Validated
public class OsFormServiceImpl implements OsFormService { public class WfFormServiceImpl implements WfFormService {
@Resource @Resource
private OsFormMapper formMapper; private WfFormMapper formMapper;
@Override @Override
public Long createForm(OsFormCreateReqVO createReqVO) { public Long createForm(WfFormCreateReqVO createReqVO) {
// 插入 // 插入
OsFormDO form = OsFormConvert.INSTANCE.convert(createReqVO); WfForm form = WfFormConvert.INSTANCE.convert(createReqVO);
formMapper.insert(form); formMapper.insert(form);
// 返回 // 返回
return form.getId(); return form.getId();
} }
@Override @Override
public void updateForm(OsFormUpdateReqVO updateReqVO) { public void updateForm(WfFormUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
this.validateFormExists(updateReqVO.getId()); this.validateFormExists(updateReqVO.getId());
// 更新 // 更新
OsFormDO updateObj = OsFormConvert.INSTANCE.convert(updateReqVO); WfForm updateObj = WfFormConvert.INSTANCE.convert(updateReqVO);
formMapper.updateById(updateObj); formMapper.updateById(updateObj);
} }
@ -64,22 +64,22 @@ public class OsFormServiceImpl implements OsFormService {
} }
@Override @Override
public OsFormDO getForm(Long id) { public WfForm getForm(Long id) {
return formMapper.selectById(id); return formMapper.selectById(id);
} }
@Override @Override
public List<OsFormDO> getFormList(Collection<Long> ids) { public List<WfForm> getFormList(Collection<Long> ids) {
return formMapper.selectBatchIds(ids); return formMapper.selectBatchIds(ids);
} }
@Override @Override
public PageResult<OsFormDO> getFormPage(OsFormPageReqVO pageReqVO) { public PageResult<WfForm> getFormPage(WfFormPageReqVO pageReqVO) {
return formMapper.selectPage(pageReqVO); return formMapper.selectPage(pageReqVO);
} }
@Override @Override
public List<OsFormDO> getFormList(OsFormExportReqVO exportReqVO) { public List<WfForm> getFormList(WfFormExportReqVO exportReqVO) {
return formMapper.selectList(exportReqVO); return formMapper.selectList(exportReqVO);
} }