|
|
@@ -53,7 +53,8 @@ public class SpecialDateService extends ServiceImpl<SpecialDateMapper, SpecialDa
|
|
|
if (sdr == null || sdr.getId() == null) {
|
|
|
throw new ServerException("缺少日期记录ID,无法修改!");
|
|
|
}
|
|
|
- if (Long.valueOf(1L).equals(sdr.getId())) {
|
|
|
+ if (Long.valueOf(1L).equals(sdr.getId())
|
|
|
+ || isBuiltinRecord(sdr.getId())) {
|
|
|
throw new ServerException("内置日期不可修改!");
|
|
|
}
|
|
|
specialDateRecordMapper.updateById(sdr);
|
|
|
@@ -66,14 +67,22 @@ public class SpecialDateService extends ServiceImpl<SpecialDateMapper, SpecialDa
|
|
|
if (id == null) {
|
|
|
throw new ServerException("缺少日期记录ID,无法删除!");
|
|
|
}
|
|
|
- if (Long.valueOf(1L).equals(id)) {
|
|
|
- throw new ServerException("内置日期不可删除!");
|
|
|
- }
|
|
|
+ // 内置记录允许删除(业务要求),但编辑仍禁止
|
|
|
specialDateRecordMapper.deleteById(id);
|
|
|
remove(Wrappers.lambdaQuery(SpecialDate.class)
|
|
|
.eq(SpecialDate::getBatchId, id));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 是否内置特殊日期:{@code flag=0} 为系统内置、{@code flag=1} 为用户新增。
|
|
|
+ *
|
|
|
+ * <p>内置记录接口侧拒绝修改,避免绕过前端直接调接口;删除不限制。</p>
|
|
|
+ */
|
|
|
+ private boolean isBuiltinRecord(Long id) {
|
|
|
+ SpecialDateRecord existing = specialDateRecordMapper.selectById(id);
|
|
|
+ return existing != null && Integer.valueOf(0).equals(existing.getFlag());
|
|
|
+ }
|
|
|
+
|
|
|
public List<SpecialDateRecord> listRecord() {
|
|
|
return specialDateRecordMapper.selectList(Wrappers.emptyWrapper());
|
|
|
}
|