SmsWrapper.java 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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.resource.wrapper;
  18. import org.springblade.common.cache.DictCache;
  19. import org.springblade.core.mp.support.BaseEntityWrapper;
  20. import org.springblade.core.tool.utils.BeanUtil;
  21. import org.springblade.modules.resource.entity.Sms;
  22. import org.springblade.modules.resource.vo.SmsVO;
  23. import java.util.Objects;
  24. /**
  25. * 短信配置表包装类,返回视图层所需的字段
  26. *
  27. * @author BladeX
  28. * @since 2020-02-20
  29. */
  30. public class SmsWrapper extends BaseEntityWrapper<Sms, SmsVO> {
  31. public static SmsWrapper build() {
  32. return new SmsWrapper();
  33. }
  34. @Override
  35. public SmsVO entityVO(Sms sms) {
  36. SmsVO smsVO = Objects.requireNonNull(BeanUtil.copy(sms, SmsVO.class));
  37. String categoryName = DictCache.getValue("sms", sms.getCategory());
  38. String statusName = DictCache.getValue("yes_no", sms.getStatus());
  39. smsVO.setCategoryName(categoryName);
  40. smsVO.setStatusName(statusName);
  41. return smsVO;
  42. }
  43. }