META-INF.templates.wrapper.vm Maven / Gradle / Ivy
/*
* Copyright (c) 2018-2058, Zodiac Stack All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*/
#set($wrapperPackage=$package.Entity.replace("entity","wrapper"))
package $!{wrapperPackage};
import org.zodiac.mybatisplus.support.BaseEntityWrapper;
import org.zodiac.commons.util.BeanUtil;
import $!{package.Entity}.$!{entity};
#set($voPackage=$package.Entity.replace("entity","vo"))
import $!{voPackage}.$!{entity}VO;
import java.util.Objects;
/**
* $!{table.comment}包装类,返回视图层所需的字段。
*
* @author $!{author}
* @since $!{date}
*/
public class $!{entity}Wrapper extends BaseEntityWrapper<$!{entity}, $!{entity}VO> {
public static $!{entity}Wrapper build() {
return new $!{entity}Wrapper();
}
@Override
public $!{entity}VO entityVO($!{entity} $!{table.entityPath}) {
$!{entity}VO $!{table.entityPath}VO = Objects.requireNonNull(BeanUtil.copy($!{table.entityPath}, $!{entity}VO.class));
//User createUser = UserCache.getUser($!{table.entityPath}.getCreateUser());
//User updateUser = UserCache.getUser($!{table.entityPath}.getUpdateUser());
//$!{table.entityPath}VO.setCreateUserName(createUser.getName());
//$!{table.entityPath}VO.setUpdateUserName(updateUser.getName());
return $!{table.entityPath}VO;
}
}