update MP字段验证策略更改为 NOT_NULL 个别特殊字段使用注解单独处理
| | |
| | | # NOT_EMPTY 非空判断(只对字符串类型字段,其他类型字段依然为非NULL判断) |
| | | # DEFAULT 默认的,一般只用于注解里 |
| | | # NEVER 不加入 SQL |
| | | insertStrategy: NOT_EMPTY |
| | | insertStrategy: NOT_NULL |
| | | # 字段验证策略之 update,在 update 的时候的字段验证策略 |
| | | updateStrategy: NOT_EMPTY |
| | | updateStrategy: NOT_NULL |
| | | # 字段验证策略之 select,在 select 的时候的字段验证策略既 wrapper 根据内部 entity 生成的 where 条件 |
| | | selectStrategy: NOT_EMPTY |
| | | selectStrategy: NOT_NULL |
| | | |
| | | # Swagger配置 |
| | | swagger: |
| | |
| | | /** |
| | | * 密码 |
| | | */ |
| | | @TableField( |
| | | insertStrategy = FieldStrategy.NOT_EMPTY, |
| | | updateStrategy = FieldStrategy.NOT_EMPTY, |
| | | whereStrategy = FieldStrategy.NOT_EMPTY |
| | | ) |
| | | private String password; |
| | | |
| | | @JsonIgnore |
| | |
| | | /** |
| | | * 列描述 |
| | | */ |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | private String columnComment; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 是否主键(1是) |
| | | */ |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | private String isPk; |
| | | |
| | | /** |
| | | * 是否自增(1是) |
| | | */ |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | private String isIncrement; |
| | | |
| | | /** |
| | | * 是否必填(1是) |
| | | */ |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | private String isRequired; |
| | | |
| | | /** |
| | | * 是否为插入字段(1是) |
| | | */ |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | private String isInsert; |
| | | |
| | | /** |
| | | * 是否编辑字段(1是) |
| | | */ |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | private String isEdit; |
| | | |
| | | /** |
| | | * 是否列表字段(1是) |
| | | */ |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | private String isList; |
| | | |
| | | /** |
| | | * 是否查询字段(1是) |
| | | */ |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | private String isQuery; |
| | | |
| | | /** |
| | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.constant.GenConstants; |
| | | import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; |
| | |
| | | int row = baseMapper.updateById(genTable); |
| | | if (row > 0) { |
| | | for (GenTableColumn cenTableColumn : genTable.getColumns()) { |
| | | genTableColumnMapper.update(cenTableColumn, |
| | | new LambdaUpdateWrapper<GenTableColumn>() |
| | | .set(StringUtils.isBlank(cenTableColumn.getColumnComment()), GenTableColumn::getColumnComment, null) |
| | | .set(StringUtils.isBlank(cenTableColumn.getIsPk()), GenTableColumn::getIsPk, null) |
| | | .set(StringUtils.isBlank(cenTableColumn.getIsIncrement()), GenTableColumn::getIsIncrement, null) |
| | | .set(StringUtils.isBlank(cenTableColumn.getIsInsert()), GenTableColumn::getIsInsert, null) |
| | | .set(StringUtils.isBlank(cenTableColumn.getIsEdit()), GenTableColumn::getIsEdit, null) |
| | | .set(StringUtils.isBlank(cenTableColumn.getIsList()), GenTableColumn::getIsList, null) |
| | | .set(StringUtils.isBlank(cenTableColumn.getIsQuery()), GenTableColumn::getIsQuery, null) |
| | | .set(StringUtils.isBlank(cenTableColumn.getIsRequired()), GenTableColumn::getIsRequired, null) |
| | | .set(StringUtils.isBlank(cenTableColumn.getDictType()), GenTableColumn::getDictType, "") |
| | | .eq(GenTableColumn::getColumnId,cenTableColumn.getColumnId())); |
| | | genTableColumnMapper.updateById(cenTableColumn); |
| | | } |
| | | } |
| | | } |
| | |
| | | public Boolean updateByBo(SysOssConfigBo bo) { |
| | | SysOssConfig config = BeanUtil.toBean(bo, SysOssConfig.class); |
| | | validEntityBeforeSave(config); |
| | | LambdaUpdateWrapper<SysOssConfig> luw = new LambdaUpdateWrapper<>(); |
| | | luw.set(StringUtils.isBlank(config.getPrefix()), SysOssConfig::getPrefix, ""); |
| | | luw.set(StringUtils.isBlank(config.getRegion()), SysOssConfig::getRegion, ""); |
| | | luw.set(StringUtils.isBlank(config.getExt1()), SysOssConfig::getExt1, ""); |
| | | luw.eq(SysOssConfig::getOssConfigId, config.getOssConfigId()); |
| | | return setConfigCache(update(config, luw), config); |
| | | return setConfigCache(updateById(config), config); |
| | | } |
| | | |
| | | /** |