Mybatis增删改查之Oracle

Mybatis增删改查之Oracle

一. 查询
  1. 普通查询(返回普通的持久层对象,由于数据库字段风格和java不同,所以建立一个map映射)

    <resultMap type="com.xxx.domain.RuleCondition" id="RuleConditionResultMapWithoutBondList">
       <id column="RC_ID" jdbcType="NUMERIC" property="ruleConditionId"/>
       <result column="RULE_CAT1" jdbcType="VARCHAR" property="ruleCatOne"/>
       <result column="RULE_CAT2" jdbcType="VARCHAR" property="ruleCatTwo"/>
       <result column="RC_OPER_TYPE" jdbcType="VARCHAR" property="ruleOperateSymbol"/>
       <result column="RULE_REF" jdbcType="VARCHAR" property="ruleRef"/>
       <result column="START_EFFECT_TIME" jdbcType="VARCHAR" property="effectTimeOfStart"/>
       <result column="END_EFFECT_TIME" jdbcType="VARCHAR" property="effectTimeOfEnd"/>
       <result column="BOND_CODE_1" jdbcType="VARCHAR" property="bondCodeOne"/>
       <result column="BOND_CODE_2" jdbcType="VARCHAR" property="bondCodeTwo"/>
       <result column="BP_THRESHOLD" jdbcType="NUMERIC" property="bpThreshold"/>
       <result column="RC_STATUS" jdbcType="VARCHAR" property="ruleStatus"/>
       <result column="OPERATOR_ID" jdbcType="VARCHAR" property="operatorId"/>
       <result column="LAST_UPDATED_DATE" jdbcType="DATE" property="lastUpdateTime"/>
     </resultMap> 
    <select id="getRuleConditionWithoutBondListById" resultMap="RuleConditionResultMapWithoutBondList">
       select RC_ID,
              RULE_CAT1,
              RULE_CAT2,
              RC_OPER_TYPE,
              RULE_REF,
              START_EFFECT_TIME,
              END_EFFECT_TIME,
              BOND_CODE_1,
              BOND_CODE_2,
              BP_THRESHOLD,
              RC_STATUS,
              LAST_UPDATED_DATE
       FROM RULES_CONDITION
       WHERE RC_ID = #{ruleConditionId,jdbcType=NUMERIC}
     </select>

    (更多…)