首页 > 代码库 > Mbatis的直接执行SQL

Mbatis的直接执行SQL

mybatis直接执行SQL实际就是在mapper里面加个String

mapper.xml<select id="selectBySql" parameterType="String">${value}</select>

对于同结构的表可以统一处理

 <insert id="insertTraject" parameterType="com.piccapp.dto.entity.TrajectoryData">    insert into ${tablename} (ID, C_SYS_R_TIME, CREATECODE,       SYSTEMCODE, INTERFACENAME, CONTENTTYPE,       INPUTTIME, CONTENTTEXT)      values (${tablename}_sequence.nextval, #{cSysRTime,jdbcType=VARCHAR}, #{createCode,jdbcType=VARCHAR},       #{systemCode,jdbcType=VARCHAR}, #{interfaceName,jdbcType=VARCHAR}, #{contenttype,jdbcType=VARCHAR},       #{inputtime,jdbcType=TIMESTAMP}, #{param,jdbcType=BLOB})  </insert>
tablename在实体TrajectoryData里面

Mbatis的直接执行SQL