mirror of
https://github.com/youlaitech/youlai-boot.git
synced 2026-09-02 22:44:53 +08:00
36 lines
911 B
Java
36 lines
911 B
Java
package com.youlai.boot.system.converter;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.youlai.boot.system.model.entity.Role;
|
|
import com.youlai.boot.system.model.vo.RolePageVo;
|
|
import com.youlai.boot.common.model.Option;
|
|
import com.youlai.boot.system.model.form.RoleForm;
|
|
import org.mapstruct.Mapper;
|
|
import org.mapstruct.Mapping;
|
|
import org.mapstruct.Mappings;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 角色对象转换器
|
|
*
|
|
* @author haoxr
|
|
* @since 2022/5/29
|
|
*/
|
|
@Mapper(componentModel = "spring")
|
|
public interface RoleConverter {
|
|
|
|
Page<RolePageVo> toPageVo(Page<Role> page);
|
|
|
|
@Mappings({
|
|
@Mapping(target = "value", source = "id"),
|
|
@Mapping(target = "label", source = "name")
|
|
})
|
|
Option<Long> toOption(Role role);
|
|
|
|
List<Option<Long>> toOptions(List<Role> roles);
|
|
|
|
Role toEntity(RoleForm roleForm);
|
|
|
|
RoleForm toForm(Role entity);
|
|
} |