package cn.autoform.util.form.mapper; import cn.autoform.db.entity.FormFieldEntity; import cn.autoform.db.entity.form.FormCpnInfo; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; @Mapper public interface FormCpnInfoMapper { FormCpnInfoMapper MAP = Mappers.getMapper(FormCpnInfoMapper.class); @Mapping(target = "fieldKey", source = "tagAttribute.alias") @Mapping(target = "fieldOrderNum", source = "fieldOrderNum") @Mapping(target = "parentsubFormNum", source = "parentsubFormNum") @Mapping(target = "fieldtype", source = "tagType") @Mapping(target = "title", source = "tagAttribute.title") @Mapping(target = "columnOrderNum", source = "columnOrderNum") @Mapping(target = "dataSourceType", source = "tagAttribute.datasourcetype") @Mapping(target = "fieldset", expression = "java(cn.autoform.util.tool.JSONTool.toJson(formCpnInfo))") @Mapping(target = "tenantID", expression = "java(cn.autoform.util.thread.ThreadData.get(cn.autoform.util.thread.Keys.TENANT_ID))") @Mapping(target = "masterData", source = "tagAttribute.masterData") @Mapping(target = "editable", source = "tagAttribute.editable") @Mapping(target = "visible", source = "tagAttribute.visible") @Mapping(target = "dataSourceData", source = "tagAttribute.custom") @Mapping(target = "fieldId", source = "tagId") @Mapping(target = "fieldAttr", source = "tagAttribute.customArr") @Mapping(target = "value", source = "tagAttribute.chooseForm") FormFieldEntity of(FormCpnInfo formCpnInfo); }