refactor: 通知公告重构
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package com.youlai.boot.system.converter;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.boot.system.model.bo.NoticeBO;
|
||||
import com.youlai.boot.system.model.entity.Notice;
|
||||
import com.youlai.boot.system.model.form.NoticeForm;
|
||||
import com.youlai.boot.system.model.vo.NoticeDetailVO;
|
||||
import com.youlai.boot.system.model.vo.NoticeVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
@@ -18,22 +20,20 @@ import org.mapstruct.Mappings;
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface NoticeConverter{
|
||||
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "tarIds", expression = "java(com.youlai.boot.common.util.CommonUtil.strToList(entity.getTarIds()))")
|
||||
@Mapping(target = "targetUserIds", expression = "java(cn.hutool.core.util.StrUtil.split(entity.getTargetUserIds(),\",\"))")
|
||||
})
|
||||
NoticeForm toForm(Notice entity);
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "tarIds", expression = "java(com.youlai.boot.common.util.CommonUtil.listToStr(formData.getTarIds()))")
|
||||
@Mapping(target = "targetUserIds", expression = "java(cn.hutool.core.collection.CollUtil.join(formData.getTargetUserIds(),\",\"))")
|
||||
})
|
||||
Notice toEntity(NoticeForm formData);
|
||||
|
||||
NoticeVO toVO(Notice notice);
|
||||
NoticeVO toPageVo(NoticeBO bo);
|
||||
|
||||
Page<NoticeVO> toPageVo(Page<NoticeBO> noticePage);
|
||||
|
||||
@Mappings({
|
||||
})
|
||||
NoticeVO toPageVo(NoticeBO bo);
|
||||
|
||||
NoticeDetailVO toDetailVO(NoticeBO noticeBO);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.mapstruct.Mappings;
|
||||
public interface UserConverter {
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "genderLabel", expression = "java(com.youlai.boot.common.base.IBaseEnum.getLabelByValue(bo.getGender(), com.youlai.boot.common.enums.GenderEnum.class))")
|
||||
@Mapping(target = "genderLabel", expression = "java(com.youlai.boot.common.base.IBaseEnum.getLabelByValue(bo.getGender(), com.youlai.boot.system.enums.GenderEnum.class))")
|
||||
})
|
||||
UserPageVO toPageVo(UserBO bo);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user