RegionWrapper.java 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are met:
  6. *
  7. * Redistributions of source code must retain the above copyright notice,
  8. * this list of conditions and the following disclaimer.
  9. * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * Neither the name of the dreamlu.net developer nor the names of its
  13. * contributors may be used to endorse or promote products derived from
  14. * this software without specific prior written permission.
  15. * Author: Chill 庄骞 (smallchill@163.com)
  16. */
  17. package org.springblade.modules.system.wrapper;
  18. import org.springblade.core.mp.support.BaseEntityWrapper;
  19. import org.springblade.core.tool.node.ForestNodeMerger;
  20. import org.springblade.core.tool.utils.BeanUtil;
  21. import org.springblade.modules.system.entity.Region;
  22. import org.springblade.modules.system.vo.RegionVO;
  23. import java.util.List;
  24. import java.util.Objects;
  25. /**
  26. * 包装类,返回视图层所需的字段
  27. *
  28. * @author Chill
  29. */
  30. public class RegionWrapper extends BaseEntityWrapper<Region, RegionVO> {
  31. public static RegionWrapper build() {
  32. return new RegionWrapper();
  33. }
  34. @Override
  35. public RegionVO entityVO(Region region) {
  36. return Objects.requireNonNull(BeanUtil.copy(region, RegionVO.class));
  37. }
  38. public List<RegionVO> listNodeLazyVO(List<RegionVO> list) {
  39. return ForestNodeMerger.merge(list);
  40. }
  41. }