常用sql的mybatis写法

插入或者更新

    
        INSERT INTO `csm`.`ms_device`
        (
        `createTime`,
        `modifyTime`,
        `regionId`,
        `deviceKey`,
        `activeTime`
        )
        VALUES
        (
        #{po.createTime},
        #{po.modifyTime},
        #{po.regionId},
        #{po.deviceKey},
        #{po.activeTime}
        )
        ON DUPLICATE KEY UPDATE activeTime = #{po.activeTime}
    

批量插入

    
        INSERT IGNORE INTO `ms_reg_photo`
        (
        `personId`,
        `regPhotoUrl`,
        `createTime`
        )
        VALUES
        
            (
            #{po.personId},
            #{po.regPhotoUrl},
            #{po.createTime}
            )
        
    

你可能感兴趣的:(常用sql的mybatis写法)