hzer组件学习一

  • Post author:
  • Post category:其他



固定值集

  1. 1.固定值集获取

List<LovValueDTO> queryLovValue(String lovCode, Long tenanId)

  1. 2.固定值集翻译

目标方法上使用 @ProcessLovValue(targetField = BaseConstants.FIELD_BODY)

目标对象上使用 @LovValue(lovCode = “SPFM.COMPANY_PROCESS_STATUS”)

并添加翻译字段eg:

@LovValue(lovCode = “SPFM.COMPANY_PROCESS_STATUS”)

private ProcessStatus processStatus;

private String processStatusMeaning;

编码规则

  1. 1.使用说明

org.hzero.boot.platform.code.builder.CodeRuleBuilder#generateCode

参数具体意思如下:

参数名称

参数描述

level 应用维度,可选值:PLATFORM/TENANT/COMPANY

tenantId 租户ID

ruleCode 编码编码

levelCode 编码规则层级,可选值:GLOBAL/COMPANY

levelValue 编码规则层级值

variableMap 变量替换列表

导出excel

  1. 1.在导出的DTO类上,使用@ExcelSheet标注导出的Sheet,头行结构中,行上也需要使用该注解标注。在@ExcelSheet中,可配置导出Sheet的标题,分页查询大小等,基本不需配置,使用默认的即可。
  2. 2在导出DTO类中,在需要作为导出列的字段上,使用@ExcelColumn标注,该注解可配置列标题、显示顺序等。

Example:

@ExcelSheet(zh = “收货记录”, en = “Receiving record”)

public class ReveRecodeDTO {


@ExcelColumn(zh = “事务编号”, en = “trxNum”, showInChildren=true)

private String trxNum;

@ExcelColumn(zh = “客户”, en = “companyName”, groups = {Group2.class})

private String companyName;

@ExcelColumn(zh = “物品编码”, en = “itemCode”, order = 4, groups = {Group1.class})

private String itemCode;

@ExcelColumn(zh = “物品名称”, en = “itemName”, order = 3, groups = {Group1.class})

private String itemName;

@ExcelColumn(zh = “日期”, en = “trxDate”, pattern = BaseConstants.Pattern.DATE)

private Date trxDate;

@ExcelColumn(zh = “数量”, en = “quantity”, groups = {Group2.class})

private BigDecimal quantity;

@ExcelColumn(zh = “金额”, en = “netAmount”, pattern = BaseConstants.Pattern.TB_ONE_DECIMAL)

private BigDecimal netAmount;

@ExcelColumn(zh = “原因”, en = “moveReason”)

private String moveReason;

@ExcelColumn(zh = “接收人”, en = “receiptPerson”)

private String receiptPerson;

@ExcelColumn(zh = “备注”, en = “remark”, renders = RemarkValueRenderer.class)

private String remark;

@ExcelColumn(zh = “详情列表”, en = “detailsList”, child = true)

List<RecordLineDTO> detailsList;

public interface Group1 {}

public interface Group2 {}

public class RemarkValueRenderer implements ValueRenderer {


@Override

public Object render(Object value, Object data) {


RecordLineDTO dto = (RecordLineDTO) data;

return “显示备注:” + dto.remark;

}

}

// getter/setter

}

  1. 3.在导出接口上,使用@ExcelExport标注,注解需配置导出的DTO。

Example:

@GetMapping(“/export”)

@ExcelExport(ReveRecodeDTO.class)

public ResponseEntity export(ReveRecodeDTO record, ExportParam exportParam, HttpServletResponse response, PageRequest pageRequest) {


List<ReveRecodeDTO> list = repository.export(record, exportParam, pageRequest);

return Results.success(list);

}



版权声明:本文为Dingwensheng1222原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。