All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ys.artifact-orm.1.0.1.source-code.bean-redis.btl Maven / Gradle / Ivy

There is a newer version: 1.0.5
Show newest version
    /**
     * 写数据
     */
    public Object write(){
        Map map = new HashMap<>();
        <%
        var hashArray = [];
        for(column in table.columns){
        var hashCode = @column.getFieldName().hashCode()+"";
        if(array.contain(hashArray,hashCode)){
            println("		"+column.fieldName+":HashCode重复,请重命名");
            continue;
        }else{
            array.add(hashArray,hashCode);
        }
        %>
        map.put(${hashCode},this.${column.fieldName});
        <%}%>
        return map;
    }

    /**
     * 读数据
     */
    public ${table.className} read(Object object){
        Map map = (Map)object;
        <%
        for(column in table.columns){
        if(column.type =="byte"){
        %>
        this.${column.fieldName} = MapUtil.getByte(map ,${@column.getFieldName().hashCode()});
        <%}else if(column.type =="short"){%>
        this.${column.fieldName} = MapUtil.getShort(map ,${@column.getFieldName().hashCode()});
        <%}else if(column.type =="int"){%>
        this.${column.fieldName} = MapUtil.getInt(map ,${@column.getFieldName().hashCode()});
        <%}else if(column.type =="long"){%>
        this.${column.fieldName} = MapUtil.getLong(map ,${@column.getFieldName().hashCode()});
        <%}else if(column.type =="float"){%>
        this.${column.fieldName} = MapUtil.getFloat(map ,${@column.getFieldName().hashCode()});
        <%}else if(column.type =="double"){%>
        this.${column.fieldName} = MapUtil.getDouble(map ,${@column.getFieldName().hashCode()});
        <%}else if(column.type=="java.util.Date"){%>
        this.${column.fieldName} = MapUtil.getDate(map ,${@column.getFieldName().hashCode()});
        <%}else if(column.type=="String"){%>
        this.${column.fieldName} = MapUtil.getStr(map ,${@column.getFieldName().hashCode()});
        <%}else if(column.type=="boolean"){%>
        this.${column.fieldName} = MapUtil.getBoolean(map ,${@column.getFieldName().hashCode()});
        <%}else{%>
        this.${column.fieldName} = MapUtil.get(map ,${@column.getFieldName().hashCode()},${column.type}.class);
        <%}%>
        <%}%>
        return this;
    }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy