修复另存模板更新时间为空
新增电池组模板时将缺省 updateBy 继承为 createBy,满足数据库非空约束并补充回归测试。
| | |
| | | void insertShouldValidateFieldsAndReplaceRelations() |
| | | { |
| | | TBatteryGroupTemplate template = template(null, " 默认模板 ", Arrays.asList(1L, 2L)); |
| | | template.setUpdateBy(null); |
| | | when(batteryGroupTemplateMapper.selectEnabledFieldsByIds(template.getFieldIds())) |
| | | .thenReturn(Arrays.asList(field(1L), field(2L))); |
| | | doAnswer(invocation -> { |
| | |
| | | assertEquals(0, captor.getValue().get(0).getSortOrder()); |
| | | assertEquals(1, captor.getValue().get(1).getSortOrder()); |
| | | assertEquals("默认模板", template.getTemplateName()); |
| | | assertEquals("admin", template.getUpdateBy()); |
| | | } |
| | | |
| | | @Test |
| | |
| | | { |
| | | validateTemplate(template, false); |
| | | template.setTemplateName(trimToNull(template.getTemplateName())); |
| | | if (StringUtils.isEmpty(template.getUpdateBy())) |
| | | { |
| | | template.setUpdateBy(template.getCreateBy()); |
| | | } |
| | | template.setCreateTime(new Date()); |
| | | int rows = batteryGroupTemplateMapper.insertBatteryGroupTemplate(template); |
| | | replaceFields(template); |