All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.shoulder.web.template.crud.AbstractVODataConverter Maven / Gradle / Ivy

Go to download

shoulder WEB 模块,基于Spring Boot Web提供了 Controller AOP 日志、AOP异常处理,统一返回值,健康检查,租户、用户解析,Web 安全防护,通用CrudController,动态字典,标签管理,HTTP client AOP日志、AOP异常处理等能力,助力Web飞速开发。

The newest version!

package org.shoulder.web.template.crud;

import org.shoulder.core.converter.BaseDataConverter;

/**
 * VO 模型转换器
 * 自动转换 id、version、创建、更新时间、创建、更新人id、名称
 * 

* targetModel\.set(.*?)\(\)\; * targetModel.set$1(sourceModel.get$1()); * * @author lym */ @SuppressWarnings("unchecked") public abstract class AbstractVODataConverter extends BaseDataConverter { @Override protected void preHandle(S sourceModel, T targetModel) { // if (BaseVO.class.isAssignableFrom(sourceEntityClass) && BaseModel.class.isAssignableFrom(targetEntityClass)) { // // vo -> domain // BaseVO vo = (BaseVO) sourceModel; // BaseModel domain = (BaseModel) targetModel; // // version // domain.setId(conversionService.convert(vo.getId(), Long.class)); // domain.setVersion(vo.getVersion()); // // operator // domain.setCreator(conversionService.convert(vo.getCreator(), Operator.class)); // domain.setModifier(conversionService.convert(vo.getModifier(), Operator.class)); // }if (BaseModel.class.isAssignableFrom(sourceEntityClass) && BaseVO.class.isAssignableFrom(targetEntityClass)) { // // domain -> vo // BaseModel domain = (BaseModel) sourceModel; // BaseVO vo = (BaseVO) targetModel; // // // id // vo.setId(conversionService.convert(domain.getId(), String.class)); // vo.setVersion(domain.getVersion()); // // time // vo.setCreateTime(conversionService.convert(domain.getGmtCreate(), Date.class)); // vo.setUpdateTime(conversionService.convert(domain.getGmtModified(), Date.class)); // // operator // vo.setCreator(conversionService.convert(domain.getCreator(), OperatorVO.class)); // vo.setModifier(conversionService.convert(domain.getModifier(), OperatorVO.class)); // } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy