Example usage for org.springframework.data.redis.core BoundHashOperations putAll

List of usage examples for org.springframework.data.redis.core BoundHashOperations putAll

Introduction

In this page you can find the example usage for org.springframework.data.redis.core BoundHashOperations putAll.

Prototype

void putAll(Map<? extends HK, ? extends HV> m);

Source Link

Document

Set multiple hash fields to multiple values using data provided in m at the bound key.

Usage

From source file:com.greenline.guahao.biz.manager.cache.hrs.DepartmentCacheManager.java

/**
 * //  ww w. j a va  2s  .  c  om
 * 
 * @param dept
 */
public void setHospitalDept(String id, HospitalDepartmentDO dept) {
    if (StringUtils.isEmpty(id) || dept == null) {
        return;
    }
    // save as hash
    BoundHashOperations<String, String, String> ops = hdept(id);

    Map<String, String> data = new HashMap<String, String>();

    data.put("id", dept.getId());
    data.put("name", null2Empty(dept.getName()));
    data.put("description", null2Empty(dept.getDescription()));
    data.put("category", null2Empty(dept.getCategory()));
    data.put("deptId", null2Empty(dept.getDeptId()));// ID
    data.put("rule", null2Empty(dept.getRule()));// 
    data.put("hospitalId", null2Empty(dept.getHospitalId()));// ID
    Integer profitType = dept.getProfitType();
    if (null == profitType) {
        profitType = 1;
    }
    data.put("profitType", profitType.toString());

    ops.putAll(data);
    setExpire(ops);
}