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

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

There is a newer version: 1.0.5
Show newest version
    /**
     * 写数据
     */
    public Object write(){
        Map map = new HashMap<>();
        <%for(column in table.columns){%>
        map.put("${column.fieldName}",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.fieldName}");
        <%}else if(column.type =="short"){%>
        this.${column.fieldName} = MapUtil.getShort(map ,"${column.fieldName}");
        <%}else if(column.type =="int"){%>
        this.${column.fieldName} = MapUtil.getInt(map ,"${column.fieldName}");
        <%}else if(column.type =="long"){%>
        this.${column.fieldName} = MapUtil.getLong(map ,"${column.fieldName}");
        <%}else if(column.type =="float"){%>
        this.${column.fieldName} = MapUtil.getFloat(map ,"${column.fieldName}");
        <%}else if(column.type =="double"){%>
        this.${column.fieldName} = MapUtil.getDouble(map ,"${column.fieldName}");
        <%}else if(column.type=="java.util.Date"){%>
        this.${column.fieldName} = MapUtil.getDate(map ,"${column.fieldName}");
        <%}else if(column.type=="String"){%>
        this.${column.fieldName} = MapUtil.getStr(map ,"${column.fieldName}");
        <%}else if(column.type=="boolean"){%>
        this.${column.fieldName} = MapUtil.getBoolean(map ,"${column.fieldName}");
        <%}else{%>
        this.${column.fieldName} = MapUtil.get(map ,"${column.fieldName}",${column.type}.class);
        <%}%>
        <%}%>
        return this;
    }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy