update set列，不考虑乐观锁注解 @Version

@param entityClass
@param entityName  实体映射名
@param notNull     是否判断!=null
@param notEmpty    是否判断String类型!=''
@return
196279
public static String updateSetColumnsIgnoreVersion(Class<?> entityClass, String entityName, boolean notNull, boolean notEmpty) {
        StringBuilder sql = new StringBuilder();
        sql.append("<set>");
        //获取全部列
        Set<EntityColumn> columnSet = EntityHelper.getColumns(entityClass);
        // 逻辑删除列
        EntityColumn logicDeleteColumn = null;
        //当某个列有主键策略时，不需要考虑他的属性是否为空，因为如果为空，一定会根据主键策略给他生成一个值
        for (EntityColumn column : columnSet) {
            if (column.getEntityField().isAnnotationPresent(LogicDelete.class)) {
                if (logicDeleteColumn != null) {
                    throw new LogicDeleteException(entityClass.getCanonicalName() + " 中包含多个带有 @LogicDelete 注解的字段，一个类中只能存在一个带有 @LogicDelete 注解的字段!");
                }
                logicDeleteColumn = column;
            }
            if (!column.isId() && column.isUpdatable()) {
                if(column.getEntityField().isAnnotationPresent(Version.class)){
                    //ignore
                } else if (column == logicDeleteColumn) {
                    sql.append(logicDeleteColumnEqualsValue(column, false)).append(",");
                } else if (notNull) {
                    sql.append(SqlHelper.getIfNotNull(entityName, column, column.getColumnEqualsHolder(entityName) + ",", notEmpty));
                } else {
                    sql.append(column.getColumnEqualsHolder(entityName) + ",");
                }
            }
        }
        sql.append("</set>");
        return sql.toString();
    }
16622
public String[] getEntityClass(Object obj, String name, Siren4JEntity entityAnno) {
        Class<?> clazz = obj.getClass();
        String[] compClass = entityAnno == null ? null : entityAnno.entityClass();
        //If entity class specified then use it.
        if (compClass != null && !ArrayUtils.isEmpty(compClass)) {
            return compClass;
        }
        //Else use name or class.
        List<String> entityClass = new ArrayList<String>();
        entityClass.add(StringUtils.defaultString(name, clazz.getName()));
        if (obj instanceof CollectionResource) {
            String tag = getCollectionClassTag();
            if (StringUtils.isNotBlank(tag)) {
                entityClass.add(tag);
            }
        }
        return entityClass.toArray(new String[]{});
    }
563023
public static String getIfNotNull(EntityColumn column, String contents, boolean empty) {
        return getIfNotNull(null, column, contents, empty);
    }
1252327
@Override
    public Object find(Class entityClass, Object key)
    {
        return find(entityClass, key, null);
    }
614927
public static String getIfNotNull(String entityName, EntityColumn column, String contents, boolean empty) {
        StringBuilder sql = new StringBuilder();
        sql.append("<if test=\"");
        if (StringUtil.isNotEmpty(entityName)) {
            sql.append(entityName).append(".");
        }
        sql.append(column.getProperty()).append(" != null");
        if (empty && column.getJavaType().equals(String.class)) {
            sql.append(" and ");
            if (StringUtil.isNotEmpty(entityName)) {
                sql.append(entityName).append(".");
            }
            sql.append(column.getProperty()).append(" != '' ");
        }
        sql.append("\">");
        sql.append(contents);
        sql.append("</if>");
        return sql.toString();
    }
170913
public static void notEmpty(Collection collection, String name) {
    notNull(collection, name);

    if (collection.isEmpty()) {
      throw new IllegalArgumentException(name + " must not be empty");
    }
  }
951996
public ActiveEntity update(String primaryKey) {
		try {
			db.update(this, Entity.create().set(primaryKey, this.get(primaryKey)));
		} catch (SQLException e) {
			throw new DbRuntimeException(e);
		}
		return this;
	}
975480
public int update(Entity record, Entity where) throws SQLException{
		if (CollectionUtil.isEmpty(record)) {
			return 0;
		}
		return db.update(fixEntity(record), where);
	}
102376
public int update(Connection conn, Entity record, Entity where) throws SQLException {
		checkConn(conn);
		if(CollectionUtil.isEmpty(record)){
			throw new SQLException("Empty entity provided!");
		}
		if(CollectionUtil.isEmpty(where)){
			//不允许做全表更新
			throw new SQLException("Empty where provided!");
		}
		
		//表名可以从被更新记录的Entity中获得，也可以从Where中获得
		String tableName = record.getTableName();
		if(StrUtil.isBlank(tableName)){
			tableName = where.getTableName();
			record.setTableName(tableName);
		}
		
		final Query query = new Query(SqlUtil.buildConditions(where), tableName);
		PreparedStatement ps = null;
		try {
			ps = dialect.psForUpdate(conn, record, query);
			return ps.executeUpdate();
		} catch (SQLException e) {
			throw e;
		} finally {
			DbUtil.close(ps);
		}
	}
165712
public SQLBuilder set(final Object entity, final Set<String> excludedPropNames) {
        if (entity instanceof String) {
            return set(N.asArray((String) entity));
        } else if (entity instanceof Map) {
            if (N.isNullOrEmpty(excludedPropNames)) {
                return set((Map<String, Object>) entity);
            } else {
                final Map<String, Object> props = new LinkedHashMap<>((Map<String, Object>) entity);
                Maps.removeKeys(props, excludedPropNames);
                return set(props);
            }
        } else {
            final Class<?> entityClass = entity.getClass();
            this.entityClass = entityClass;
            final Collection<String> propNames = getUpdatePropNamesByClass(entityClass, excludedPropNames);
            final Set<String> dirtyPropNames = N.isDirtyMarker(entityClass) ? ((DirtyMarker) entity).dirtyPropNames() : null;
            final Map<String, Object> props = N.newHashMap(N.initHashCapacity(N.isNullOrEmpty(dirtyPropNames) ? propNames.size() : dirtyPropNames.size()));

            for (String propName : propNames) {
                if (N.isNullOrEmpty(dirtyPropNames) || dirtyPropNames.contains(propName)) {
                    props.put(propName, ClassUtil.getPropValue(entity, propName));
                }
            }

            return set(props);
        }
    }
31334
public <P extends ParaObject> P update(P obj) {
		if (obj == null) {
			return null;
		}
		return getEntity(invokePatch(obj.getType().concat("/").concat(obj.getId()), Entity.json(obj)), obj.getClass());
	}
1168705
public void setEntityArns(java.util.Collection<String> entityArns) {
        if (entityArns == null) {
            this.entityArns = null;
            return;
        }

        this.entityArns = new java.util.ArrayList<String>(entityArns);
    }
461992
@SuppressWarnings("unchecked")
  public <E> E update(E entity) {
    try {
      entityManager.executeEntityListeners(CallbackType.PRE_UPDATE, entity);
      Intent intent = (nativeWriter instanceof Batch) ? Intent.BATCH_UPDATE : Intent.UPDATE;
      Entity nativeEntity = (Entity) Marshaller.marshal(entityManager, entity, intent);
      nativeWriter.update(nativeEntity);
      E updatedEntity = (E) Unmarshaller.unmarshal(nativeEntity, entity.getClass());
      entityManager.executeEntityListeners(CallbackType.POST_UPDATE, updatedEntity);
      return updatedEntity;
    } catch (DatastoreException exp) {
      throw DatastoreUtils.wrap(exp);
    }

  }
790527
@Transactional
  @PutMapping("/{entityTypeId}/{id}")
  @ResponseStatus(OK)
  public void update(
      @PathVariable("entityTypeId") String entityTypeId,
      @PathVariable("id") String untypedId,
      @RequestBody Map<String, Object> entityMap) {
    updateInternal(entityTypeId, untypedId, entityMap);
  }
682573
public static String notAllNullParameterCheck(String parameterName, Set<EntityColumn> columnSet) {
        StringBuilder sql = new StringBuilder();
        sql.append("<bind name=\"notAllNullParameterCheck\" value=\"@tk.mybatis.mapper.util.OGNL@notAllNullParameterCheck(");
        sql.append(parameterName).append(", '");
        StringBuilder fields = new StringBuilder();
        for (EntityColumn column : columnSet) {
            if (fields.length() > 0) {
                fields.append(",");
            }
            fields.append(column.getProperty());
        }
        sql.append(fields);
        sql.append("')\"/>");
        return sql.toString();
    }
370543
public static AuditEntryBean clientVersionUpdated(ClientVersionBean bean, EntityUpdatedData data,
            ISecurityContext securityContext) {
        if (data.getChanges().isEmpty()) {
            return null;
        }
        AuditEntryBean entry = newEntry(bean.getClient().getOrganization().getId(), AuditEntityType.Client, securityContext);
        entry.setEntityId(bean.getClient().getId());
        entry.setEntityVersion(bean.getVersion());
        entry.setWhat(AuditEntryType.Update);
        entry.setData(toJSON(data));
        return entry;
    }
911583
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
    public ResponseEntity<E> update(@PathVariable int id, HttpServletRequest request) {

        String errorPrefix = "Error updating "
            + getEntityClass().getSimpleName() + " with ID " + id + ": ";

        Reader reader = null;

        try {
            // read and parse the json request body
            reader = request.getReader();
            JsonNode jsonObject = objectMapper.readTree(reader);

            // validate json object
            if (jsonObject == null || !jsonObject.has("id")) {
                LOG.error(errorPrefix
                    + "The JSON body is empty or has no 'id' property.");
                return new ResponseEntity<E>(HttpStatus.BAD_REQUEST);
            }

            // assure that the path variable id equals the payload id
            final int payloadId = jsonObject.get("id").asInt();
            if (payloadId != id) {
                LOG.error(errorPrefix + "Requested to update entity with ID "
                    + id + ", but payload ID is " + payloadId);
                return new ResponseEntity<E>(HttpStatus.BAD_REQUEST);
            }

            // get the persisted entity
            E entity = service.findById(id);

            if (entity != null) {
                // we call this transactional method (instead of save or update)
                // to make sure that the possibly modified entity does not
                // get persisted / synced unexpectedly by hibernate
                // (due to FlushMode.AUTO) when another database-related
                // interaction is triggered in the meantime (which could happen
                // for example in a permission evaluation).
                // In other words: Do not get an entity, modify it and save it
                // in a non-transactional way (e.g. controller method), as
                // a possible permission evaluation could trigger an unwanted
                // persist action before the permission was evaluated.
                entity = service.updatePartialWithJsonNode(entity, jsonObject, objectMapper);
                return new ResponseEntity<E>(entity, HttpStatus.OK);
            }
            return new ResponseEntity<E>(HttpStatus.NOT_FOUND);
        } catch (Exception e) {
            LOG.error(errorPrefix + e.getMessage());
            return new ResponseEntity<E>(HttpStatus.NOT_FOUND);
        } finally {
            IOUtils.closeQuietly(reader);
        }
    }