解决方案 »

  1.   

    谢谢你的回复,考虑过typeHandler,但是我看mybatis自有的一些实现类,感觉它是对每一个元数据进行处理的,它的方法的参数是这个元数据的索引或者列名。那么这样做其实也就把程序写死了。
      

  2.   

    那个属性的map可以再配置成一个类,类的嵌套配置是这样的,我下面有个例子<resultMap id="ss" class="scene">
    <result column="sid" property="sid" jdbcType="BIGINT" javaType="java.lang.Long" />
    <result column="sname" property="sname" jdbcType="VARCHAR" javaType="java.lang.String" />
    <result column="sstatus" property="sstatus" jdbcType="int" javaType="java.lang.Integer" />
    <result column="offer_total_flag" property="sofferTotalFlag" jdbcType="int" javaType="java.lang.Integer" />
    <result column="rid" property="rule.rid" jdbcType="BIGINT" javaType="java.lang.Long" />
    <result column="rscene_id" property="rule.rsceneId" jdbcType="BIGINT" javaType="java.lang.Long" />
    <result column="rgroup_name" property="rule.rgroupName" jdbcType="VARCHAR" javaType="java.lang.String" />
    <result column="rgroup_order" property="rule.rgroupOrder" jdbcType="int" javaType="java.lang.Integer" />
    <result column="rgroup_type" property="rule.rgroupType" jdbcType="int" javaType="java.lang.Integer" />
    <result column="rgroup_status" property="rule.rgroupStatus" jdbcType="int" javaType="java.lang.Integer" />
    <result column="rgroup_flag" property="rule.rgroupFlag" jdbcType="int" javaType="java.lang.Integer" />
    <result column="rgroup_content_flag" property="rule.rgroupContentFlag" jdbcType="int" javaType="java.lang.Integer" />
    <result column="rgroup_content_parent_id" property="rule.rgroupContentParentId" jdbcType="BIGINT" javaType="java.lang.Long" />
    <result column="rfield1" property="rule.rfield1" jdbcType="VARCHAR" javaType="java.lang.String" />
    <result column="rfield2" property="rule.rfield2" jdbcType="VARCHAR" javaType="java.lang.String" />
    <result column="rfield3" property="rule.rfield3" jdbcType="VARCHAR" javaType="java.lang.String" />
    <result column="cscene_id" property="rule.content.csceneId" jdbcType="BIGINT" javaType="java.lang.Long" />
    <result column="cgroup_id" property="rule.content.cgroupId" jdbcType="BIGINT" javaType="java.lang.Long" />
    <result column="cnode_id" property="rule.content.cnodeId" jdbcType="VARCHAR" javaType="java.lang.String" />
    <result column="cnode_name" property="rule.content.cnodeName" jdbcType="VARCHAR" javaType="java.lang.String" />
    <result column="cnode_value" property="rule.content.cnodeValue" jdbcType="VARCHAR" javaType="java.lang.String" />
    <result column="cnode_parent_id" property="rule.content.cnodeParentId" jdbcType="BIGINT" javaType="java.lang.Long" />
    <result column="cgroup_node_parent_id" property="rule.content.cgroupNodeParentId" jdbcType="BIGINT" javaType="java.lang.Long" />
    <result column="cnode_order" property="rule.content.cnodeOrder" jdbcType="int" javaType="java.lang.Integer" />
    <result column="cnode_flag" property="rule.content.cnodeFlag" jdbcType="int" javaType="java.lang.Integer" />
    <result column="cnode_offer_total" property="rule.content.cnodeOfferTotal" jdbcType="int" javaType="java.lang.Integer" />
    <result column="cfield1" property="rule.content.cfield1" jdbcType="VARCHAR" javaType="java.lang.String" />
    <result column="cfield2" property="rule.content.cfield2" jdbcType="VARCHAR" javaType="java.lang.String" />
    <result column="cfield3" property="rule.content.cfield3" jdbcType="VARCHAR" javaType="java.lang.String" />
    <result column="cid" property="cid" jdbcType="BIGINT" javaType="java.lang.Long" />
    </resultMap>
      

  3.   

    还是建议别费事了,mybatis对于一对多支持非常不好,就算能配置也不方便,不如算了。